Search code examples
javaspring-bootannotation-processingjsrchecker-framework

Pluggable Type Checkers and Checkers framework, is really needed all this setup?


I am trying to understand how Checker Framework implements Pluggable Type Checkers. By reading the documentation,

Checker Framework (Maven)

I see a lot of setup involved, and looks to me either outdated or not quite mantained.

As far as I read, Java 8 supported both Type Annotations and Pluggable Type Checkers on JSR-308 and JSR-269 , allowing an interface to create custom annotations on almost every element, and process it with a snippet of interfaced code with a simple flag on javac (-processor), which maven supports through META-INF/services/javax.annotation.processing.Processor

Then why documentation states that Checker requires that many customization..?:

  - com.google.errorprone.javac "error-prone" jdk if javac should support custom annotation processors (JSR-269)?
  - maven dependency plugin
  - mvn compiler plugin with annotationProcessorPaths (which I understand it overrides anything from the META-INF file) instead of `META-INF/services/javax.annotation.processing.Processor`

I presume Checker framework has remained effectively a collection of custom annotation processors since Java 8 feature. Is it like that? It does not seem needed anymore to enable the compiler, to create custom checkings (JSR-269) and to enable /* @Nullable */ and the like... I'll be happy to stand corrected


Solution

  • I see a lot of setup involved, and looks to me either outdated or not quite mantained.

    What, specifically, looks outdated or "not quite maintained"? What is your evidence? If you just make unsubstantiated assertions, the community cannot help you.

    As far as I read, Java 8 supported both Type Annotations and Pluggable Type Checkers on JSR-308 and JSR-269

    Your reading is incorrect. JSR 308 supports Type Annotations, but JSR 269 does not support Pluggable Type Checkers. You need a third-party tool such as the Checker Framework to perform pluggable type-checking.

    Can you point out the specific text that led you to this conclusion? Specifics would be helpful rather than just an assertion without support.

    to enable /* @Nullable */

    Support for annotations in comments was ended 20 months ago. Can you point out the text that led you to your question about annotations in comments?