Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8156

Compile error when ListenerList annotation exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.4.10
    • 2.4.11
    • None
    • None
    • Linux x64 java8

    Description

      After upgrading groovy from 2.4.7 to 2.4.10 all classes using the `groovy.beans.ListenerList` annotation fail to compile.
      The error message is:

      Caught: BUG! exception in phase 'canonicalization' in source unit '/tmp/fsck/bug.groovy' ClassNode#getTypeClass for Event is called before the type class is set 
      BUG! exception in phase 'canonicalization' in source unit '/tmp/fsck/bug.groovy' ClassNode#getTypeClass for Event is called before the type class is set 
      

      Code to reproduce:

      class Event {
      }
      
      interface EventListener {
              void doSomething(Event e)
      }
      
      class EventHandler {
              @groovy.beans.ListenerList
              List<EventListener> listeners
      }
      
      def eh = new EventHandler()
      eh.addEventListener({ println it} as EventListener)
      eh.fireDoSomething(new Event())
      

      Complete steps:

      % sdk u groovy 2.4.7
      
      Using groovy version 2.4.7 in this shell.
      % cat bug.groovy 
      class Event {
      }
      
      interface EventListener {
              void doSomething(Event e)
      }
      
      class EventHandler {
              @groovy.beans.ListenerList
              List<EventListener> listeners
      }
      
      def eh = new EventHandler()
      eh.addEventListener({ println it} as EventListener)
      eh.fireDoSomething(new Event())
      % groovy -v
      Groovy Version: 2.4.7 JVM: 1.8.0_121 Vendor: Oracle Corporation OS: Linux
      % groovy bug.groovy # WORKS 
      Event@762ef0ea
      % sdk u groovy 2.4.10       
      
      Using groovy version 2.4.10 in this shell.
      % groovy -v                
      Groovy Version: 2.4.10 JVM: 1.8.0_121 Vendor: Oracle Corporation OS: Linux
      % groovy bug.groovy # FAILS
      Caught: BUG! exception in phase 'canonicalization' in source unit '/tmp/fsck/bug.groovy' ClassNode#getTypeClass for Event is called before the type class is set 
      BUG! exception in phase 'canonicalization' in source unit '/tmp/fsck/bug.groovy' ClassNode#getTypeClass for Event is called before the type class is set 
      

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              safri Sascha Frinken
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: