samedi 9 mai 2015

Using Null Analysis annotations in Java8

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

What's new in Java8 about that ? Can someone explain me the good way to use my annotations ?

Thanks !

Aucun commentaire:

Enregistrer un commentaire