In Java, I use the 'null analysis' using annotations. I don't use Eclipse's default annotations and I have defined my owns.
For each package, I used to add a global NonNullByDefault annotation in the package-info.java file.
With Java version <= Java7, the code below has no problem, everything works fine.
@my.package.annotations.NonNullByDefault
package my.foo.package;
But when I set Eclipse to be Java8 compliant (the only JDK installed on my system is Java8), then an error occurs:
A default nullness annotation has not been specified for the package my.foo.package - Java Problem
My annotation is declared in the following way:
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.PACKAGE, ElementType.TYPE,
ElementType.METHOD, ElementType.CONSTRUCTOR })
public @interface NonNullByDefault {
// marker annotation
}
What's new in Java8 about that? Can someone explain me the good way to use my annotations?
NonNullByDefaultannotation.