Skip to content

Fail early with a JDK not compatible with the JSpecify mode #1310

@sdeleuze

Description

@sdeleuze

Discussed very quickly with @msridhar yesterday, so I create a related issue to provide more details.

I see more and more projects using NullAway with JSpecify mode enabled on JVM that does not support it:

  • Java 17 to 21.0.7
  • Java 21.0.8+ without the -XDaddTypeAnnotationsToSymbol=true flag

There is no clear breakage, builds are not always reproducible and users are confused and not aware this is not supported, even if this is specified in the wiki.

Would be nice to fail fast with a related error message when NullAway is running on an unsupported Java version when the JSpecify mode is enabled.

Ideally we would not hardcode the Java versions (since a Java 17 backport of the -XDaddTypeAnnotationsToSymbol=true flag may come), but detect if possible the broken annotation processor behavior. If not possible, detecting Java version would be better than what we have today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions