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

Allow building with jdk17 #11303

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions conventions/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.gradle.enterprise.gradleplugin.testretry.retry
import io.opentelemetry.instrumentation.gradle.OtelJavaExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import java.time.Duration
Expand Down Expand Up @@ -79,11 +78,6 @@ tasks.withType<JavaCompile>().configureEach {
"-Werror"
)
)
val defaultJavaVersion = otelJava.maxJavaVersionSupported.getOrElse(DEFAULT_JAVA_VERSION).majorVersion.toInt()
if (Math.max(otelJava.minJavaVersionSupported.get().majorVersion.toInt(), defaultJavaVersion) >= 21) {
// new warning in jdk21
compilerArgs.add("-Xlint:-this-escape")
}
}

encoding = "UTF-8"
Expand Down Expand Up @@ -119,6 +113,12 @@ afterEvaluate {
source = otelJava.minJavaVersionSupported.get().majorVersion
}
}
tasks.withType<JavaCompile>().configureEach {
if (javaCompiler.isPresent && javaCompiler.get().metadata.languageVersion.canCompileOrRun(21)) {
// new warning in jdk21
options.compilerArgs.add("-Xlint:-this-escape")
}
}
}

evaluationDependsOn(":dependencyManagement")
Expand Down