From 070d087dbcc96360887fc6e97064c3cd2480881d Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 21 Sep 2021 11:30:30 +0200 Subject: [PATCH] Reinstate -Werror for Groovy compilation This commit partially reverts cf2429b0f0ce2a5278bdc2556663caf6cf0b0cae in order to reinstate -Werror for Groovy compilation in spring-beans. The `decorating` field in GroovyDynamicElementReader has been changed from boolean to Boolean in order to avoid the JDK 17 deprecation warning for use of `new Boolean(false)` which the Groovy compiler apparently uses behind the scenes when compiling Groovy source code. --- spring-beans/spring-beans.gradle | 3 +-- .../beans/factory/groovy/GroovyDynamicElementReader.groovy | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/spring-beans/spring-beans.gradle b/spring-beans/spring-beans.gradle index 9c4d0af79e..3c5d34179e 100644 --- a/spring-beans/spring-beans.gradle +++ b/spring-beans/spring-beans.gradle @@ -23,8 +23,7 @@ sourceSets { } compileGroovy { - // Groovy generates Java code with "new Boolean" usage which is deprecated on JDK 17 - // options.compilerArgs += "-Werror" + options.compilerArgs += "-Werror" } // This module also builds Kotlin code and the compileKotlin task naturally depends on diff --git a/spring-beans/src/main/groovy/org/springframework/beans/factory/groovy/GroovyDynamicElementReader.groovy b/spring-beans/src/main/groovy/org/springframework/beans/factory/groovy/GroovyDynamicElementReader.groovy index d017121694..8157450773 100644 --- a/spring-beans/src/main/groovy/org/springframework/beans/factory/groovy/GroovyDynamicElementReader.groovy +++ b/spring-beans/src/main/groovy/org/springframework/beans/factory/groovy/GroovyDynamicElementReader.groovy @@ -40,7 +40,7 @@ class GroovyDynamicElementReader extends GroovyObjectSupport { private final GroovyBeanDefinitionWrapper beanDefinition - protected final boolean decorating; + protected final Boolean decorating; private boolean callAfterInvocation = true