OnCreate(@nullable Bundle savedInstances);中的@nullable有什么用?

What is the use of @nullable in OnCreate(@nullable Bundle savedInstances);?

@nullable 的用途是什么,在什么情况下不使用 @nullable 会成为 onCreate(@nullable Bundle SavedInstances);

中的问题

Nullable

Denotes that a parameter, field or method return value can be null.

When decorating a method call parameter, this denotes that the parameter can legitimately be null and the method will gracefully deal with it. Typically used on optional parameters.

When decorating a method, this denotes the method might legitimately return null.

This is a marker annotation and it has no specific attributes.

https://developer.android.com/reference/android/support/annotation/Nullable.html

您可以从 OnCreate(@nullable Bundle savedInstances); 安全地 ignore/remove @nullable 因为它表示参数,Bundle 可以为 null 并且它在运行时没有作用 See the Documentation here for more details