groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject [1/2] groovy git commit: GROOVY-8156: Compile error when ListenerList annotation exists (closes #524)
Date Thu, 20 Apr 2017 04:12:30 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 1ffe1a7d6 -> aa16cbf05


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/master
Commit: 3e80a4fcd185d0f99fa7b4125355ded66f28f7e6
Parents: 1ffe1a7
Author: John Wagenleitner <jwagenleitner@apache.org>
Authored: Fri Apr 14 13:33:59 2017 -0700
Committer: John Wagenleitner <jwagenleitner@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)
+        '''
+    }
 }


Mime
View raw message