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/10/20 02:14:02 UTC

(groovy) 01/02: Revert "GROOVY-12427: Joint compilation stub declares a precompiled trait's static methods "static abstract" on implementing classes"

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

paulk-asert pushed a commit to branch GROOVY_5_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 007bee9e43f93c32e537cbab635a4ecbd81d1cca
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Oct 20 12:13:30 2026 +1000

    Revert "GROOVY-12427: Joint compilation stub declares a precompiled trait's static methods "static abstract" on implementing classes"
    
    This reverts commit ae3266609b09a86381c8eef23a9638b1c3f4c7a4.
---
 .../groovy/tools/javac/JavaStubGenerator.java      |  2 +-
 .../groovy/tools/stubgenerator/Groovy12427.groovy  | 56 ----------------------
 .../tools/stubgenerator/Groovy12427Support.groovy  | 31 ------------
 3 files changed, 1 insertion(+), 88 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java b/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java
index a7efbaccd5..71398d30a6 100644
--- a/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java
+++ b/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java
@@ -726,7 +726,7 @@ public class JavaStubGenerator {
         if (!isInterfaceOrTrait(classNode)) {
             int modifiers = methodNode.getModifiers();
             if (classNode.isEnum()) modifiers &= ~Opcodes.ACC_ABSTRACT;
-            else if (isDefaultTraitImpl(methodNode)) modifiers &= ~Opcodes.ACC_ABSTRACT; // GROOVY-12427: may be static
+            else if (isDefaultTraitImpl(methodNode)) modifiers ^= Opcodes.ACC_ABSTRACT;
             if (methodNode.isSyntheticPublic() && hasPackageScopeXform(methodNode, PackageScopeTarget.METHODS)) modifiers &= ~Opcodes.ACC_PUBLIC;
 
             printModifiers(out, modifiers);
diff --git a/src/test/groovy/org/codehaus/groovy/tools/stubgenerator/Groovy12427.groovy b/src/test/groovy/org/codehaus/groovy/tools/stubgenerator/Groovy12427.groovy
deleted file mode 100644
index ebe67bb700..0000000000
--- a/src/test/groovy/org/codehaus/groovy/tools/stubgenerator/Groovy12427.groovy
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.codehaus.groovy.tools.stubgenerator
-
-/**
- * GROOVY-12427: the stub for a class implementing a precompiled trait must not
- * declare the trait's static methods {@code static abstract}.
- */
-final class Groovy12427 extends StringSourcesStubTestCase {
-
-    @Override
-    Map<String, String> provideSources() {
-        [
-            'Person.groovy': """
-                import ${this.class.name}Support
-
-                class Person implements ${this.class.simpleName}Support { }
-            """,
-            'UsesPerson.java': '''
-                public class UsesPerson {
-                    Person person = new Person();
-                    public String described = Person.describe();
-                    public String greeted = person.greet();
-                }
-            '''
-        ]
-    }
-
-    @Override
-    void verifyStubs() {
-        String stub = stubJavaSourceFor('Person')
-        assert !stub.contains('abstract')
-        assert stub =~ /public static\s+java\.lang\.String describe\(\)/
-        assert stub =~ /public\s+java\.lang\.String greet\(\)/
-
-        def usesPerson = loader.loadClass('UsesPerson').getDeclaredConstructor().newInstance()
-        assert usesPerson.described == 'named'
-        assert usesPerson.greeted == 'hi'
-    }
-}
diff --git a/src/test/groovy/org/codehaus/groovy/tools/stubgenerator/Groovy12427Support.groovy b/src/test/groovy/org/codehaus/groovy/tools/stubgenerator/Groovy12427Support.groovy
deleted file mode 100644
index 35989adb36..0000000000
--- a/src/test/groovy/org/codehaus/groovy/tools/stubgenerator/Groovy12427Support.groovy
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.codehaus.groovy.tools.stubgenerator
-
-import groovy.transform.Virtual
-
-/**
- * Precompiled trait for {@link Groovy12427}: compiled with the test sources,
- * so it is seen as a decompiled class node during the joint compilation.
- */
-trait Groovy12427Support {
-    static String describe() { 'named' }
-    @Virtual static String kind() { 'virtual' }
-    String greet() { 'hi' }
-}