You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/03/15 19:48:35 UTC

(groovy) branch master updated: fix broken test

This is an automated email from the ASF dual-hosted git repository.

paulk 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 566c0de182 fix broken test
566c0de182 is described below

commit 566c0de182ea53307530f51b411fc6856e6542e9
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Mar 16 05:48:22 2026 +1000

    fix broken test
---
 src/test/groovy/groovy/ClassTest.groovy | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/test/groovy/groovy/ClassTest.groovy b/src/test/groovy/groovy/ClassTest.groovy
index fa6468d1ef..549154f5f9 100644
--- a/src/test/groovy/groovy/ClassTest.groovy
+++ b/src/test/groovy/groovy/ClassTest.groovy
@@ -20,7 +20,8 @@ package groovy
 
 import groovy.test.GroovyTestCase
 import org.junit.jupiter.api.Test
-
+import org.objectweb.asm.ClassReader
+import org.objectweb.asm.Opcodes
 
 class ClassTest {
 
@@ -41,7 +42,18 @@ class ClassTest {
 
     @Test
     void testClassesHaveSuperModiferSet() {
-        assert java.lang.reflect.Modifier.isSynchronized(this.class.modifiers)
+        // ACC_SUPER (0x0020) is written into the .class file by Groovy's AsmClassGenerator
+        // for every non-interface class. java.lang.reflect.Class.getModifiers() does NOT
+        // expose it — bit 0x0020 is reused as ACC_SYNCHRONIZED for method modifiers — so
+        // we inspect the raw bytecode access flags via ASM.
+        //
+        // ClassTest has Object as its implicit supertype;
+        // GroovyTestCase has junit.framework.TestCase as its supertype.
+        [ClassTest, GroovyTestCase].each { Class<?> clazz ->
+            def stream = clazz.getResourceAsStream("/${clazz.name.replace('.', '/')}.class")
+            assert (new ClassReader(stream).access & Opcodes.ACC_SUPER) != 0,
+                    "Expected ACC_SUPER to be set on ${clazz.name}"
+        }
     }
 
 }