Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » @NonNull Lists
@NonNull Lists [message #896835] Fri, 20 July 2012 04:40 Go to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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 10:59 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Hi Ed,

thanks for asking.

Ed Willink wrote on Fri, 20 July 2012 06:40
Hi

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 Smile

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 16:48 Go to previous message
Javin Paul is currently offline Javin PaulFriend
Messages: 48
Registered: July 2011
Location: mumbai
Member

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.
Previous Topic:templates broken in juno
Next Topic:why my Eclipse IDE do not support Arabic and Farsi fonts?
Goto Forum:
  


Current Time: Fri Mar 29 14:40:10 GMT 2024

Powered by FUDForum. Page generated in 0.02914 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top