there is no standard
@nonnull annotation. creating such an annotation was the goal of jsr 305, which has been abandoned for a long time. there will not be a standard
@nonnull annotation until jsr 305 is reconstituted. oracle has no current plans to do so. (jee annotations are outside the scope of jsr 305.)
for futureproofing, the most important factor to consider is whether the annotation is a type annotation or a declaration annotation. because
@nonnull states a property of the variable's value rather than of the variable itself, it should be a type annotation. being a type annotation also lets the annotation be written on more locations, as in
you can determine whether an annotation is a type annotation by looking at the
@target meta-annotation on the annotation's definition. as of this writing, it seems that only the checker framework and eclipse versions are type annotations, so i would choose them over the ones that are declaration annotations. note that the developers of any of the other annotations could update them to be type annotations as well; i don't know of their plans.
the only downside is that using a type annotation requires use of a java 8 compiler. the checker framework has mechanisms for letting code containing its annotations be compiled by a java 7 compiler.
- Which @NonNull Java annotation to use
- Which Java debugger do *you* use
- Which JRE version to use while making new Java Project in Eclipse and what are the drawbacks?
- Compilation error when trying to build a maven project with JAVA custom annotation which has ENUM variables defined in it
- Can you define which Java Version your Java web application should use
- Which directory do I use to import this Java project?
- What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?
- Which Eclipse version should I use for an Android app?
- @Documented annotation in java
- What is the use of Order And Export tab in Java Build Path
- Google App Engine JSP can't deploy: java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE
- Which subversive connector discovery to use
- Embedding resources (images, sound bits, etc) into a Java project then use those resources
- Which is the Best Java IDE for Spring Framework?
- What is the difference between Eclipse and Netbeans if I want to use only the Java in it?
- Java: How do I know which jar file to use given a class name?
- How can I use the java Eclipse Abstract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)
- What are the best Java code generation tools or plugins to use in Eclipse?
- Setup Java 6 annotation processing configuration for eclipse compiler with maven
- Can I use Java annotations to define compile time checks?
- Does eclipse use Java Instrumentation API for Hot Code replace
- NetBeans or Eclipse. Which IDE should I use first?
- How to use Java 8 docs in Eclipse
- How to use Eclipse for both Java and PHP?
- Cannot use external libraries for google app engine java project
- Why does eclipse automatically add a java super() method in a constructor when I use the editors code generator?
- How to use different line wrapping for strings and other items in Eclipse for Java
- How to use wkhtmltopdf in Java web application?
- eclipse java annotation processing
- Is there a Java program snippet which can compile with a Java 5 compiler on JRE 6 but not Java 6 compiler?
More Query from same tag
- Timer in Eclipse for Android Game
- Create a Maven project with hibernate
- Supplied javaHome is not a valid folder in eclipse
- Java Web Service client error
- Eclipse PreferencePage "Apply" and "OK" greyed-out
- Using NDK to build Project in cygwin
- How to debug lombok objects
- Preserve line-break in Eclipse CSS formatter
- Getting cassandra connection error
- Parsing a text file into strings with ArrayList<String> for Q&A structured application
- Eclipse RCP cancel job with InterruptedException
- Adding google-play-service source to my android application
- How to harmonize Eclipse projects between Windows and Ubuntu?
- eclipse won't let me access the constructor
- How can like 'z%' in eclipse query when 'z' is my parameter
- Use Local Eclipse IDE Debugger with Remote Project Source (Linux)
- Error while installing Jython for PyDev
- How can I specify an Eclipse .classpath entry for specific O/S platform?
- tool for checking paths executed during running a program in eclipse
- Android eclipse debugging on emulator avoid installing every time
- Related to importing WebDriver and FirefoxDriver in eclipse
- missing requirement osgi.wiring.package when starting bundle
- Spring Resful WS issue
- Internal error during "Initialize Java Debug Session" on Eclipse
- How to fix the formatting in Eclipse Mars?
- How do i deploy a Fragment in a Fragment
- Debug with jetty server, remote server
- Create new project with Eclipse by using GIT
- Eclipse: Accessing a editor template from plugin code
- PHP.. not working on the Mac when I click on the file