Skip to content

Commit 035bfb9

Browse files
wolpertclaude
andcommitted
build: add -XDaddTypeAnnotationsToSymbol=true for Error Prone on JDK 21
Error Prone 2.27+ requires this javac flag on JDK 21 so type-use annotations (JSpecify's @nullable, etc.) remain visible on symbols at analysis time; without it Error Prone refuses to start with "-XDaddTypeAnnotationsToSymbol=true is required by Error Prone on JDK 21". Surfaced after Dependabot bumped Error Prone from 2.36.0 to 2.49.0. See google/error-prone#4011 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d4e127a commit 035bfb9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

build-logic/src/main/kotlin/pkauth.java-conventions.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ tasks.withType<JavaCompile>().configureEach {
2929
// settings, and adapter modules may need to fine-tune lints per-module. The brief calls for
3030
// -Xlint:all -Werror on production modules — that gets layered on in library-conventions where
3131
// we know it is safe.
32-
options.compilerArgs.addAll(listOf("-Xlint:all", "-parameters"))
32+
//
33+
// -XDaddTypeAnnotationsToSymbol=true is required by Error Prone 2.27+ on JDK 21 so that
34+
// type-use annotations (e.g. JSpecify's @Nullable) are visible on symbols at analysis time.
35+
// Without it Error Prone refuses to start. See
36+
// https://github.com/google/error-prone/issues/4011
37+
options.compilerArgs.addAll(
38+
listOf("-Xlint:all", "-parameters", "-XDaddTypeAnnotationsToSymbol=true"),
39+
)
3340
options.errorprone.disableWarningsInGeneratedCode = true
3441
// Default Error Prone check set, with one project-wide override:
3542
// pk-auth's wire contract is WebAuthn's, which is binary-heavy (challenge bytes, credential

0 commit comments

Comments
 (0)