With the release of Eclipse's java 8 support, I understood that null annotations on types (JSR 308) were possible, as described here. I have installed JDK8, and the Java 8 feature patch for Eclipse Kepler. I was expecting to be able to declare a list that does not allow nulls like this:
List<@NonNull String> nonulls;
However, the compiler tells me that "The annotation @NonNull is disallowed for this location" :(
My project is configured to use compiler compliance level 1.8, and the org.eclipse.jdt.annotation jar is included in the class path.
What am I missing here?
Regards,
@NonNull
's package? The annotation should be defined with@Target(ElementType.TYPE_USE)
. – Pu