File tree 1 file changed +6
-6
lines changed
conventions/src/main/kotlin
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
- import com.gradle.enterprise.gradleplugin.testretry.retry
2
1
import io.opentelemetry.instrumentation.gradle.OtelJavaExtension
3
2
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
4
3
import java.time.Duration
@@ -79,11 +78,6 @@ tasks.withType<JavaCompile>().configureEach {
79
78
" -Werror"
80
79
)
81
80
)
82
- val defaultJavaVersion = otelJava.maxJavaVersionSupported.getOrElse(DEFAULT_JAVA_VERSION ).majorVersion.toInt()
83
- if (Math .max(otelJava.minJavaVersionSupported.get().majorVersion.toInt(), defaultJavaVersion) >= 21 ) {
84
- // new warning in jdk21
85
- compilerArgs.add(" -Xlint:-this-escape" )
86
- }
87
81
}
88
82
89
83
encoding = " UTF-8"
@@ -119,6 +113,12 @@ afterEvaluate {
119
113
source = otelJava.minJavaVersionSupported.get().majorVersion
120
114
}
121
115
}
116
+ tasks.withType<JavaCompile >().configureEach {
117
+ if (javaCompiler.isPresent && javaCompiler.get().metadata.languageVersion.canCompileOrRun(21 )) {
118
+ // new warning in jdk21
119
+ options.compilerArgs.add(" -Xlint:-this-escape" )
120
+ }
121
+ }
122
122
}
123
123
124
124
evaluationDependsOn(" :dependencyManagement" )
You can’t perform that action at this time.
0 commit comments