1919
2020allprojects {
2121 plugins. withType(JavaPlugin ) {
22- sourceCompatibility = project. minJavaVersion
23- targetCompatibility = project. minJavaVersion
24-
25- // Use 'release' flag instead of 'source' and 'target'
26- tasks. withType(JavaCompile ) {
27- options. compilerArgs + = [" --release" , project. minJavaVersion. toString()]
28- }
29-
22+ // Use 'release' flag instead of 'source' and 'target'
23+ tasks. withType(JavaCompile ) {
24+ compileTestJava {
25+ sourceCompatibility = project. minJavaTestVersion
26+ targetCompatibility = project. minJavaTestVersion
27+ options. compilerArgs + = [" --release" , project. minJavaTestVersion. toString()]
28+ }
29+ compileJava {
30+ sourceCompatibility = project. minJavaVersion
31+ targetCompatibility = project. minJavaVersion
32+ options. compilerArgs + = [" --release" , project. minJavaVersion. toString()]
33+ }
34+ }
3035 // Configure warnings.
3136 tasks. withType(JavaCompile ) {
3237 options. encoding = " UTF-8"
@@ -51,22 +56,12 @@ allprojects {
5156 " -Xdoclint:all/protected" ,
5257 " -Xdoclint:-missing" ,
5358 " -Xdoclint:-accessibility" ,
59+ " -Xlint:synchronization" ,
60+ " -Xlint:text-blocks" ,
5461 " -proc:none" , // proc:none was added because of LOG4J2-1925 / JDK-8186647
62+ " -Xlint:removal"
5563 ]
5664
57- // enable some warnings only relevant to newer language features
58- if (rootProject. runtimeJavaVersion >= JavaVersion . VERSION_15 ) {
59- options. compilerArgs + = [
60- " -Xlint:text-blocks" ,
61- ]
62- }
63-
64- if (rootProject. runtimeJavaVersion >= JavaVersion . VERSION_16 ) {
65- options. compilerArgs + = [
66- " -Xlint:synchronization" ,
67- ]
68- }
69-
7065 if (propertyOrDefault(" javac.failOnWarnings" , true ). toBoolean()) {
7166 options. compilerArgs + = " -Werror"
7267 }
0 commit comments