@NonNull Lists [message #896835] |
Fri, 20 July 2012 00:40  |
Eclipse User |
|
|
|
Hi
I've just started using the Juno @NonNull annotations. Great for
deblurring APIs.
But as with any good facility, I want more. I see that @NonNull fields
are imminent (and essential). But what about
----
Null variable arguments
@NonNull String... seems to mean a non-null array of arguments rather
than an array of @NonNull arguments.
----
Lists of @NonNull.
I want to do List<@NonNull String> so that I don't need to null-check
iteration elements.
----
And is there a way to import an auxiliary set of declarations for
unannotated code such as
@NonNull String String.trim();
Regards
Ed Willink
|
|
|
Re: @NonNull Lists [message #896899 is a reply to message #896835] |
Fri, 20 July 2012 06:59   |
Eclipse User |
|
|
|
Hi Ed,
thanks for asking.
Ed Willink wrote on Fri, 20 July 2012 06:40Hi
I've just started using the Juno @NonNull annotations. Great for deblurring APIs.
But as with any good facility, I want more.
I want more, too 
Quote:I see that @NonNull fields are imminent (and essential).
That's currently in beta status (available for early access), please have a look at http://wiki.eclipse.org/JDT_Core/Null_Analysis/Beta
Quote:
Null variable arguments
@NonNull String... seems to mean a non-null array of arguments rather
than an array of @NonNull arguments.
We went back and forth here, but decided that a full solution has to wait for JSR 308, at what time we'll be able to say things like
@Nullable String @Nonnull[] args; // array can be null, elements cannot
Quote:
Lists of @NonNull.
I want to do List<@NonNull String> so that I don't need to null-check
iteration elements.
With JSR 308 this will be possible. Today that's just not valid Java syntax.
Quote:
And is there a way to import an auxiliary set of declarations for
unannotated code such as
@NonNull String String.trim();
Here I don't have an excuse other than: not enough time. Please see https://bugs.eclipse.org/331651 for our plans in this regard.
Your list is right on, exactly the things that are in our pipe line. Regarding null annotations for fields we are explicitly asking for feedback regarding the current beta. The wiki page links to a bugzilla, please add your comments when you try it.
Thanks,
Stephan
|
|
|
Re: @NonNull Lists [message #897094 is a reply to message #896899] |
Sat, 21 July 2012 12:48  |
Eclipse User |
|
|
|
On related note, I am more than happy to see @NonNull annotation on Juno. Thank you guys for adding this feature. IntelliJ has there @NotNull and @Nullable from long time and this is something I really looking forward. If we can get the feature asked by @Ed Willink, it would be awesome.
|
|
|
Powered by
FUDForum. Page generated in 0.04814 seconds