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 2020/04/22 02:33:13 UTC

[groovy] branch master updated (f16561d -> 2d441b5)

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

paulk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git.


    from f16561d  GROOVY-9515: avoid fallback repeatedly
     new f33fc06  GROOVY-9405: Junit 5 IncompatibleClassChangeError (inner classes not being written in package-info classes)
     new 2d441b5  fix typo

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../groovy/classgen/AsmClassGenerator.java         | 49 ++++++++++------------
 .../{Groovy8774Bug.groovy => Groovy9405.groovy}    | 20 +++++----
 .../main/java/org/codehaus/groovy/ant/Groovyc.java |  2 +-
 3 files changed, 37 insertions(+), 34 deletions(-)
 copy src/test/org/codehaus/groovy/tools/stubgenerator/{Groovy8774Bug.groovy => Groovy9405.groovy} (66%)


[groovy] 02/02: fix typo

Posted by pa...@apache.org.
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

commit 2d441b59b0b04fe185c04fa0906d46547182d94b
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Apr 22 11:09:24 2020 +1000

    fix typo
---
 .../groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
index de46112..bb29191 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
@@ -83,7 +83,7 @@ import java.util.StringTokenizer;
  *   &lt;/taskdef&gt;
  *
  *   &lt;target name="compile" description="compile groovy sources"&gt;
- *     &lt;groovyc srcdir="src" destdir="bin" fork="true" listfiles="true" includeantruntime="false"/&gt;
+ *     &lt;groovyc srcdir="src" destdir="bin" fork="true" listfiles="true" includeantruntime="false"&gt;
  *       &lt;classpath&gt;
  *         &lt;fileset dir="${groovy.home}/lib" includes="groovy-*${groovy.version}.jar" excludes="groovy-ant-${groovy.version}.jar"/&gt;
  *       &lt;/classpath&gt;


[groovy] 01/02: GROOVY-9405: Junit 5 IncompatibleClassChangeError (inner classes not being written in package-info classes)

Posted by pa...@apache.org.
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

commit f33fc06bbea013841ca736997354ecb0c46bae65
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Apr 21 22:14:13 2020 +1000

    GROOVY-9405: Junit 5 IncompatibleClassChangeError (inner classes not being written in package-info classes)
---
 .../groovy/classgen/AsmClassGenerator.java         | 49 ++++++++++----------
 .../groovy/tools/stubgenerator/Groovy9405.groovy   | 52 ++++++++++++++++++++++
 2 files changed, 75 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
index f8ca958..3524267 100644
--- a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -241,35 +241,32 @@ public class AsmClassGenerator extends ClassGenerator {
                     // pull them out of package node but treat them like they were on class node
                     visitAnnotations(classNode, packageNode, classVisitor);
                 }
-                classVisitor.visitEnd();
-                return;
             } else {
                 visitAnnotations(classNode, classVisitor);
-            }
-
-            if (classNode.isInterface()) {
-                ClassNode owner = classNode;
-                if (owner instanceof InnerClassNode) {
-                    owner = owner.getOuterClass();
-                }
-                String outerClassName = classNode.getName();
-                String name = outerClassName + "$" + context.getNextInnerClassIdx();
-                controller.setInterfaceClassLoadingClass(
-                        new InterfaceHelperClassNode (
-                                owner, name, ACC_SUPER | ACC_SYNTHETIC | ACC_STATIC, ClassHelper.OBJECT_TYPE,
-                                controller.getCallSiteWriter().getCallSites()));
-                super.visitClass(classNode);
-                createInterfaceSyntheticStaticFields();
-            } else {
-                super.visitClass(classNode);
-                MopWriter.Factory mopWriterFactory = classNode.getNodeMetaData(MopWriter.Factory.class);
-                if (mopWriterFactory == null) {
-                    mopWriterFactory = MopWriter.FACTORY;
+                if (classNode.isInterface()) {
+                    ClassNode owner = classNode;
+                    if (owner instanceof InnerClassNode) {
+                        owner = owner.getOuterClass();
+                    }
+                    String outerClassName = classNode.getName();
+                    String name = outerClassName + "$" + context.getNextInnerClassIdx();
+                    controller.setInterfaceClassLoadingClass(
+                            new InterfaceHelperClassNode (
+                                    owner, name, ACC_SUPER | ACC_SYNTHETIC | ACC_STATIC, ClassHelper.OBJECT_TYPE,
+                                    controller.getCallSiteWriter().getCallSites()));
+                    super.visitClass(classNode);
+                    createInterfaceSyntheticStaticFields();
+                } else {
+                    super.visitClass(classNode);
+                    MopWriter.Factory mopWriterFactory = classNode.getNodeMetaData(MopWriter.Factory.class);
+                    if (mopWriterFactory == null) {
+                        mopWriterFactory = MopWriter.FACTORY;
+                    }
+                    MopWriter mopWriter = mopWriterFactory.create(controller);
+                    mopWriter.createMopMethods();
+                    controller.getCallSiteWriter().generateCallSiteArray();
+                    createSyntheticStaticFields();
                 }
-                MopWriter mopWriter = mopWriterFactory.create(controller);
-                mopWriter.createMopMethods();
-                controller.getCallSiteWriter().generateCallSiteArray();
-                createSyntheticStaticFields();
             }
 
             // GROOVY-6750 and GROOVY-6808
diff --git a/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy9405.groovy b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy9405.groovy
new file mode 100644
index 0000000..73db7f0
--- /dev/null
+++ b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy9405.groovy
@@ -0,0 +1,52 @@
+/*
+ *  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
+
+class Groovy9405 extends StringSourcesStubTestCase {
+
+    Map<String, String> provideSources() {
+        [
+                'test/Requires.java': '''
+                    package test;
+                    import java.lang.annotation.*;
+                    @Retention(RetentionPolicy.RUNTIME)
+                    @Target({ElementType.PACKAGE})
+                    public @interface Requires {
+                        Class<? extends groovy.lang.Closure> condition();
+                    }
+                ''',
+                'test/package-info.groovy': '''
+                    @test.Requires(condition = { -> true })
+                    package test
+                '''
+        ]
+    }
+
+//    protected void init() {
+//        debug = true
+//        delete = false
+//    }
+
+    void verifyStubs() {
+        def piClass = loader.loadClass('test.package-info')
+        def inners = piClass.classes
+        assert inners.length > 0
+        assert inners*.name.contains('test.package-info$_closure1')
+    }
+}