Extension JSR-308 JSR-305?

Eclipse zero parsing now supports JSR-308, i.e. now you can put @Nonull

etc. to parameters of the type type.

However, the widely used package com.google.code.findbugs:jsr305:3.0.0

has no specific JSR-308 targets. Is there any JSR-308 oriented version of this or a way to extend JSR-305 annotations?


source to share

2 answers

Apparently in Eclipse at least the semantics of annotations have changed, so an annotation intended for both uses can be dangerous.



JSR 305 has long been abandoned ( its status was asked on the mailing list in 2010, but it was never answered). You shouldn't expect JSR 305 to evolve to take advantage of new Java features such as type annotations (JSR 308).

On the other hand, there are many annotation definitions that you can use in place of the JSR 305 versions. For example, the Checker Framework manual lists 11 @NonNull annotation options that you can choose from.

You are probably best off choosing annotations that are defined so that they can be used in places of type annotations. (Or you can create a custom version of JSR 305 annotations that adds TYPE_USE to the @Target meta annotations.)



All Articles