nullable
- Ejemplos
Anota los argumentos anulables o devuelve los tipos usando @nullable. | Nullable arguments and return types must be annotated using @nullable. |
Se puede especificar cualquier tipo de valor excepto Nullable. | You can specify any value type except Nullable. |
Los métodos LoaderCallbacks ahora tienen las anotaciones @Nullable y @NonNull apropiadas. | LoaderCallbacks methods now have the appropriate @Nullable and @NonNull annotations. |
Las claves primarias de una columna individual pueden ser Nullable si es un Integer o un Long. | Single column primary keys can be Nullable if it is an Integer or a Long. |
Android Studio inserta las anotaciones @Nullable y@NonNull de Android en las ubicaciones detectadas de tu código. | Android Studio inserts the Android @Nullable and @NonNull annotations in detected locations in your code. |
Solo debes usar @Nullable en el valor de retorno de un método si se debe verificar explícitamente la nulidad de cada uso de dicho método. | You should only use @Nullable on a method's return value if every use of the method should be explicitly null-checked. |
Por otro lado, si intentas hacer referencia al resultado de un método marcado por @Nullable sin verificar primero si el resultado es nulo, se genera una advertencia de nulidad. | On the other hand, attempting to reference the result of a method marked by @Nullable without first checking if the result is null generates a nullness warning. |
Nota: cuando se agregan anotaciones de nulidad, el autocompletado puede sugerir las anotaciones @Nullable y @NotNull de IntelliJ en lugar de las anotaciones de valor nulo de Android, y se puede importar la biblioteca correspondiente de manera automática. | Note: When adding nullness annotations, autocomplete may suggest the IntelliJ @Nullable and @NotNull annotations instead of the Android null annotations and may auto-import the corresponding library. |
La anotación @Nullable permite indicar una variable, un parámetro o un valor de retorno que puede ser nulo, mientras que la anotación @NonNull permite indicar una variable, un parámetro o un valor de retorno que no puede ser nulo. | The @Nullable annotation indicates a variable, parameter, or return value that can be null while @NonNull indicates a variable, parameter, or return value that cannot be null. |
