build: Suppress obsolete Java 8 option warning under JDK 21+#5664
Draft
runningcode wants to merge 1 commit into
Draft
build: Suppress obsolete Java 8 option warning under JDK 21+#5664runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
The root build compiles Java with -Xlint:all -Werror. On JDK 21+, javac flags -source/-target 8 as obsolete, and -Werror promotes that warning to an error, failing :sentry:compileJava. CI pins JDK 17, where the warning does not exist, so this only breaks local builds and tooling on newer JDKs (e.g. the Kotlin LSP's bundled JDK 25, whose Gradle project import aborts and loses cross-module resolution). Add -Xlint:-options, the suppression javac itself recommends when intentionally targeting an older release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📲 Install BuildsAndroid
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
The root build compiles Java with
-Xlint:all -Werror. This PR adds-Xlint:-optionsto the sharedJavaCompileargs inbuild.gradle.kts.💡 Motivation and Context
The
sentrymodule targets Java 8 (sourceCompatibility/targetCompatibility = 1.8). On JDK 21+,javacflags-source/-target 8as obsolete:Because the build uses
-Werror, that warning becomes a hard error and:sentry:compileJavafails. CI pins Temurin JDK 17 (where the warning does not yet exist), so it never surfaces there — but it breaks any local build or tooling running on a newer JDK. In particular, the Kotlin LSP bundles JDK 25, so its Gradle project import aborts and cross-module / external-library resolution silently stops working.-Xlint:-optionsis the exact suppressionjavacitself recommends when intentionally targeting an older release. It only silences the[options]lint category (obsolete source/target, unset bootstrap classpath) and leaves-Werrorin force for everything else.💚 How did you test it?
Reproduced the failure and confirmed the fix with JDK 25's
javac:javac -source 8 -target 8 -Xlint:all -Werror ...→ fails (exit 1)-Xlint:-optionsadded → passes (exit 0)./gradlew spotlessApplyis clean.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Longer term, the
[options]warning points at the cleaner fix of switching from-source/-target 8to--release 8(which also sets the bootstrap classpath), but that is a broader change deferred to a follow-up.#skip-changelog