Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » the annotaion @NonNull is disallowed for this location
the annotaion @NonNull is disallowed for this location [message #1382022] Sun, 25 May 2014 20:58 Go to next message
Nicola Zanaga is currently offline Nicola ZanagaFriend
Messages: 56
Registered: July 2009
Member
now, i'm sure to use eclipse 4.4rc3, jdk.8 and the correct org.eclipse.jdt.annotation, but i get the error: the annotaion @NonNull is disallowed for this location


It seems that using the complete name "java.io.File" instead of "File" generates the error.



import java.io.File;

import org.eclipse.jdt.annotation.NonNull;

public class Test6 {
@NonNull File testOk() {
return new File("x");
}

@NonNull java.io.File testErr() {
return new File("x");
}
}
Re: the annotaion @NonNull is disallowed for this location [message #1382023 is a reply to message #1382022] Sun, 25 May 2014 20:58 Go to previous messageGo to next message
Nicola Zanaga is currently offline Nicola ZanagaFriend
Messages: 56
Registered: July 2009
Member
eclipse 4.4rc2 Smile
Re: the annotaion @NonNull is disallowed for this location [message #1383892 is a reply to message #1382022] Mon, 26 May 2014 22:06 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Nicola Zanaga wrote on Sun, 25 May 2014 22:58

It seems that using the complete name "java.io.File" instead of "File" generates the error.


You're right, with type annotations in Java 8 the correct syntax is:

	java.io.@NonNull File testErr()  {
		return new File("x"); 
	}


best,
Stephan
Previous Topic:"enable syntactic null analysis for fields" broken with eclise 4.4rc1 jdk1.8
Next Topic:Eclipse + Git, more than just an egit question
Goto Forum:
  


Current Time: Fri Apr 19 15:43:57 GMT 2024

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

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

Back to the top