Skip to content

Pass -XDaddTypeAnnotationsToSymbol=true as a javac argument? #132

@msridhar

Description

@msridhar

See uber/NullAway#1245. This javac argument improves NullAway's ability to read type use annotations from bytecodes on JDK 21.0.8 (or later, presumably), which is particularly helpful in JSpecify mode. It may be useful for other built-in Error Prone checks to also be able to see these annotations, though I'm not sure; possibly @cpovirk or @cushon could comment? This flag may also be ported back to JDK 17 in the future.

The downside is that in some (rare?) cases this flag can cause build issues; see https://bugs.openjdk.org/browse/JDK-8359336. Given that, I'm not sure whether enabling this flag by default with the Error Prone plugin is the right approach. But it would be nice if it were at least exposed as an opt-in option of the Error Prone plugin, to give it more visibility.

Also, FWIW, I saw no negative consequences to passing this flag to javac versions other than 21.0.8; it seems to just be ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions