Skip to content

Commit

Permalink
Allow building with jdk17 (open-telemetry#11303)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored and hannahchan committed May 12, 2024
1 parent ff39e59 commit 5453eff
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit 5453eff

Please sign in to comment.