Currently I am researching on the new features of Java8: http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html
From the link above, it is clearly demonstrated:
Type Annotations provide the ability to apply an annotation anywhere a type is used, not just on a declaration. Used with a pluggable type system, this feature enables improved type checking of your code.
But when I tried to add type annotation such as @NotNull
or @Readonly
etc. in Eclipse Neon, it can not recognize these annotations at all! This is way frustrating.
Did I miss something? or if I need to do more configuration like adding extra jars, how come this is still listed as the Java 8 new feature?
@Jens Thanks :) I searched again from Google and found the following link: https://docs.oracle.com/javase/tutorial/java/annotations/type_annotations.html
In the linked page, it was told The Java SE 8 release does not provide a type checking framework, but it allows you to write (or download) a type checking framework that is implemented as one or more pluggable modules that are used in conjunction with the Java compiler.
So the key is to have a checker framework
either DIY or by using existing checker framework
. In the end of the the linked page, there is another link page of an existing Checker Framework
- https://checkerframework.org/ and this one is probably so far the best framework we can use :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.