You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/04/22 01:19:19 UTC

[12/40] groovy git commit: GROOVY-8156: Compile error when ListenerList annotation exists (closes #524)

GROOVY-8156: Compile error when ListenerList annotation exists (closes #524)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/3e80a4fc
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/3e80a4fc
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/3e80a4fc

Branch: refs/heads/parrot
Commit: 3e80a4fcd185d0f99fa7b4125355ded66f28f7e6
Parents: 1ffe1a7
Author: John Wagenleitner <jw...@apache.org>
Authored: Fri Apr 14 13:33:59 2017 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Wed Apr 19 21:10:06 2017 -0700

----------------------------------------------------------------------
 .../beans/ListenerListASTTransformation.groovy  |  3 +--
 .../groovy/beans/ListenerListASTTest.groovy     | 27 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/3e80a4fc/src/main/groovy/beans/ListenerListASTTransformation.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/beans/ListenerListASTTransformation.groovy b/src/main/groovy/beans/ListenerListASTTransformation.groovy
index 4591346..2e8b664 100644
--- a/src/main/groovy/beans/ListenerListASTTransformation.groovy
+++ b/src/main/groovy/beans/ListenerListASTTransformation.groovy
@@ -18,7 +18,6 @@
  */
 package groovy.beans
 
-import org.codehaus.groovy.ast.tools.GenericsUtils
 import org.codehaus.groovy.control.CompilePhase
 import org.codehaus.groovy.control.SourceUnit
 import org.codehaus.groovy.control.messages.SyntaxErrorMessage
@@ -353,7 +352,7 @@ class ListenerListASTTransformation implements ASTTransformation, Opcodes {
 
         def params = method.parameters.collect {
             def paramType = ClassHelper.getWrapper(it.type)
-            def cn = GenericsUtils.makeClassSafe(paramType.typeClass)
+            def cn = paramType.plainNodeReference
             cn.setRedirect(paramType)
             new Parameter(cn, it.name)
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/3e80a4fc/src/test/groovy/beans/ListenerListASTTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/beans/ListenerListASTTest.groovy b/src/test/groovy/beans/ListenerListASTTest.groovy
index 3952231..dae62aa 100644
--- a/src/test/groovy/beans/ListenerListASTTest.groovy
+++ b/src/test/groovy/beans/ListenerListASTTest.groovy
@@ -384,4 +384,31 @@ class ListenerListASTTest extends GroovyTestCase {
                 assert C.class.getMethod('getObjects')
             """)
         }
+
+    // GROOVY-8156
+    void testListenerListWithEventClassInSameCompilationUnit() {
+        assertScript '''
+            class Event {}
+
+            class EventListener {
+                Event event
+                void doSomething(Event e) {
+                    event = e
+                }
+            }
+
+            class EventHandler {
+                @groovy.beans.ListenerList
+                List<EventListener> listeners
+            }
+
+            def listener = new EventListener()
+            def eh = new EventHandler()
+            eh.addEventListener(listener)
+            def testEvent = new Event()
+            eh.fireDoSomething(testEvent)
+
+            assert listener.event.is(testEvent)
+        '''
+    }
 }