Nullable varying annotations
The newest compiler needs facts away from you for member variables. New compiler can’t build assumptions about the buy where personal members was reached. Any social affiliate could be utilized in every order. Some of the obtainable constructors can help initialize the object. In the event that a member field you will actually getting set to null , new compiler must guess their null-county was maybe-null at the beginning of each means.
You use annotations that claim if or not a changeable is actually a great nullable source sorts of otherwise a non-nullable site variety of. These types of annotations build essential comments towards null-county for parameters:
- A research is not said to be null. The newest default state regarding a beneficial nonnullable site changeable isn’t-null. Brand new compiler enforces rules you to definitely verify it’s secure to help you dereference this type of details instead basic checking this isn’t null:
- This new varying have to be initialized so you’re able to a non-null value.
- The brand new varying cannot end up being assigned the value null . The latest compiler issues a warning when code assigns a could be-null phrase so you’re able to an adjustable you to really should not be null. [Leer más…] acerca de The fresh null-state data provides sturdy research for almost all parameters