You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
I've been using javax.annotation.Nullable and javax.annotation.Nonnull in my
code, as they're IDE neutral and capable of being recognized by several popular
tools.
However, Java 1.8 requires that inner-class and qualified type references use
an annotation syntax which is compatible with it's new JSR-308 support (e.g. A
"@Nullable MyOuterClass.MyInnerClass" parameter becomes "MyOuterClass.@Nullable
MyInnerClass").
Doing that with the JSR-305 annotations causes javac to complain "annotation
type not applicable to this kind of declaration", and Eclipse to complain
"Annotation types that do not specify explicit target element types cannot be
applied here".
This is because the JSR-305 annotation definitions lack a declaration of the
form:
@java.lang.annotation.Target({ java.lang.annotation.ElementType.FIELD,
java.lang.annotation.ElementType.METHOD,
java.lang.annotation.ElementType.PARAMETER,
java.lang.annotation.ElementType.LOCAL_VARIABLE })
While JSR-305 may not currently be moving forward as an official standard, it's
still of great value to many people as a defacto one, so if there is any way
@Target could be added in order for that to continue with Java 1.8 until
something more official comes along, it would be most excellent.
Many thanks for your consideration.
Original issue reported on code.google.com by [email protected] on 3 Jan 2014 at 12:59
The text was updated successfully, but these errors were encountered:
Correction - It appears as though @Target({ TYPE_USE }) is what the null
annotations are actually required to have in this case, and since TYPE_USE is
new in Java 1.8, that certainly complicates this request.
Original issue reported on code.google.com by
[email protected]
on 3 Jan 2014 at 12:59The text was updated successfully, but these errors were encountered: