Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » unable to assign a @NonNull value to @Nullable value for arrays
unable to assign a @NonNull value to @Nullable value for arrays [message #1386818] Fri, 20 June 2014 19:29 Go to next message
Nicola Zanaga is currently offline Nicola ZanagaFriend
Messages: 56
Registered: July 2009
eclipse 4.4rc4,
consider this example:

public class Test001 {
    void test()  {
        @NonNull Object b = new Object();
        Object @NonNull[] c = { new Object() };
        test2( b );
        test3( c );
    void test2(@Nullable Object z)  {  }
    void test3(Object @Nullable[] z)  {  }

calling test3 (c) gives the error:
Null type mismatch (type annotations): required 'Object @Nullable[]' but this expression has type 'Object @NonNull[]'

but test2(b) work fine

I suppose there are problems with array assignment
Re: unable to assign a @NonNull value to @Nullable value for arrays [message #1386825 is a reply to message #1386818] Fri, 20 June 2014 23:00 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Probably related to

I've added your example to the bug.
Previous Topic:Eclipse JUnit Pluin Code
Next Topic:Can't create new Java Project
Goto Forum:

Current Time: Sun Jun 23 10:45:57 GMT 2024

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

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

Back to the top