I've installed the last JDK 8 (b116) but I noticed that I can't use type annotations. For example reading the Java tutorial if I write:
String str = null;
String myString = (@NonNull String) str;
or
TEST st = new @Interned TEST();
the compiler give me the following error:
annotation type not applicable to this kind of declaration
Now it works. Before using a type annotations we must annotate the annotation
with @Target(ElementType.TYPE_USE)
. Look at the comments below!
I also don't understand if the annotations like: NonNull
, Interned
, etc. will be
inserted in the JDK or if we have to download the Checker Framework
@Target
annotation. – Rubiaceous