This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 4baefde7ae minor items
4baefde7ae is described below
commit 4baefde7aeea5157a250eeb8311e901b597d8cc9
Author: Eric Milles <[email protected]>
AuthorDate: Sat Mar 15 20:57:14 2025 -0500
minor items
---
.../codehaus/groovy/runtime/DefaultGroovyMethods.java | 2 +-
.../asm/sc/StaticCompilationTestSupport.groovy | 19 ++++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git
a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index f7ed8afc61..298eca81d1 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -685,7 +685,7 @@ public class DefaultGroovyMethods extends
DefaultGroovyMethodsSupport {
* @since 1.7.0
*/
public static boolean asBoolean(Boolean bool) {
- return bool != null && bool;
+ return Boolean.TRUE.equals(bool);
}
/**
diff --git
a/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTestSupport.groovy
b/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTestSupport.groovy
index b5de1c6022..48772cd2b7 100644
---
a/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTestSupport.groovy
+++
b/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTestSupport.groovy
@@ -18,6 +18,9 @@
*/
package org.codehaus.groovy.classgen.asm.sc
+import groovy.transform.AutoFinal
+import groovy.transform.SelfType
+import groovy.transform.stc.StaticTypeCheckingTestCase
import org.codehaus.groovy.ast.ClassNode
import org.codehaus.groovy.classgen.GeneratorContext
import org.codehaus.groovy.control.CompilationUnit
@@ -40,7 +43,9 @@ import java.security.CodeSource
* available to the developer for additional checks. This property provides the
* AST and the result of the ASM check class adapter (bytecode) for each class.
*/
+@AutoFinal @SelfType(StaticTypeCheckingTestCase)
trait StaticCompilationTestSupport {
+
Map<String, Tuple2<ClassNode, String>> astTrees
CompilationUnit compilationUnit
@@ -76,7 +81,7 @@ trait StaticCompilationTestSupport {
super.tearDown()
}
- void assertAndDump(final String script) {
+ void assertAndDump(String script) {
try {
assertScript(script)
} finally {
@@ -88,15 +93,15 @@ trait StaticCompilationTestSupport {
StaticCompilationTestSupport testCase
CompilationUnitAwareGroovyClassLoader(
- final ClassLoader loader,
- final CompilerConfiguration config,
- final StaticCompilationTestSupport testCase) {
+ ClassLoader loader,
+ CompilerConfiguration config,
+ StaticCompilationTestSupport testCase) {
super(loader, config)
this.testCase = testCase
}
@Override
- protected CompilationUnit createCompilationUnit(final
CompilerConfiguration config, final CodeSource source) {
+ protected CompilationUnit createCompilationUnit(CompilerConfiguration
config, CodeSource source) {
testCase.compilationUnit = new CompilationUnit(config, source,
this)
}
}
@@ -104,13 +109,13 @@ trait StaticCompilationTestSupport {
static class ASTTreeCollector extends CompilationCustomizer {
StaticCompilationTestSupport testCase
- ASTTreeCollector(final StaticCompilationTestSupport testCase) {
+ ASTTreeCollector(StaticCompilationTestSupport testCase) {
super(CompilePhase.CLASS_GENERATION)
this.testCase = testCase
}
@Override
- void call(final SourceUnit source, final GeneratorContext context,
final ClassNode classNode) {
+ void call(SourceUnit source, GeneratorContext context, ClassNode
classNode) {
def unit = testCase.compilationUnit
if (unit) {
def groovyClass = unit.classes.find { it.name ==
classNode.name }