Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gradle config to always compile Java code using JDK 17 #971

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ subprojects { project ->
}
project.tasks.withType(JavaCompile) {
dependsOn(installGitHooks)
// Always compile using JDK 17, independent of the JDK version used to run Gradle.
// We can't compile on JDK 21 since some internal javac APIs changed between 17
// and 21, and for now NullAway compiles against the JDK 17 APIs and uses reflection
// on JDK 21+. This configuration means compilation will succeed even if Gradle
// is running on JDK 21+.
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}
options.compilerArgs += [
"-Xlint:deprecation",
"-Xlint:rawtypes",
Expand Down