You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am interested in the feature of using @NonNull on an array, such that the array's elements are also being checked. Optionally using something such as @NonNullElements might be introduced to not modify how @NonNull operates.
@NonNull String[] stringArray;
stringArray = null; // NOK
stringArray = new String[]{null}; // NOK
The benefits would be for developers who mistakenly think they are safe from doing null-checking on the elements themselves. Despite having all these null-checking annotations as help, a developer must still do these checks to be safe.
The text was updated successfully, but these errors were encountered:
Too specific, not boilerplate. I also think that developers presuming that @NonNull on an array implies that individual elements also cannot be null is bizarre and not worth catering to. It is nonsensical to think this. Specifically:
arrays of non-primitive types are obsolete. Do not use these in your codebase; use List<String> instead.
There are type-use annotations; String @NonNull [] is more appropriate (but adding explicit nullcheck code to this is not a good idea; whilst for arrays lombok would know how, for something like List<@NonNull String> lombok would not.
Hello,
I am interested in the feature of using
@NonNull
on an array, such that the array's elements are also being checked. Optionally using something such as@NonNullElements
might be introduced to not modify how@NonNull
operates.I believe this is related to #2019 and specifically #2019 (comment)
The benefits would be for developers who mistakenly think they are safe from doing null-checking on the elements themselves. Despite having all these null-checking annotations as help, a developer must still do these checks to be safe.
The text was updated successfully, but these errors were encountered: