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

@ListenerList generated fireWhatever() method stops working

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.7, 2.4.8
    • 2.4.10
    • groovy-runtime
    • None

    Description

      As described in the question on SO
      http://stackoverflow.com/questions/42648766/groovy-listenerlist-generated-firexxx-method-stops-working
      and confirmed by @aalmiray the fireWhatever() method generated when
      using @ListenerList annotation stops working after some calls.

      @aalmiray s code as posted in his reply reproduces the problem with
      Groovy 2.4.7 and I confirmed it with 2.4.8 running it in groovyConsole. The difference between this code and the longer one in the SO question is that in the longer version the call works but if called periodically after some time it produces the same Exception.

      MessageProducer.groovy
      import groovy.beans.ListenerList
      
      interface MessageListener {
        void messageReceived(byte[] msg)
      }
      
      class MessageProducer {
        @ListenerList
        List<MessageListener> listeners
      
        void produce(String msg) {
          fireMessageReceived(msg.getBytes())
        }
      }
      
      producer = new MessageProducer()
      producer.addMessageListener({ println it } as MessageListener)
      producer.produce('Groovy')
      
      Stacktrace
      Exception thrown
      
      java.lang.NoSuchMethodError: MessageProducer.fireMessageReceived([B)V
              at MessageProducer$fireMessageReceived$0.callCurrent(Unknown
      Source) at MessageProducer.produce(ConsoleScript0:12)
              at MessageProducer$produce.call(Unknown Source)
              at ConsoleScript0.run(ConsoleScript0:18
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              frigo.work Frigo Pratser
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: