You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Frigo Pratser (JIRA)" <ji...@apache.org> on 2017/03/08 11:32:38 UTC

[jira] [Created] (GROOVY-8110) @ListenerList generated fireWhatever() method stops working

Frigo Pratser created GROOVY-8110:
-------------------------------------

             Summary: @ListenerList generated fireWhatever() method stops working
                 Key: GROOVY-8110
                 URL: https://issues.apache.org/jira/browse/GROOVY-8110
             Project: Groovy
          Issue Type: Bug
          Components: groovy-runtime
    Affects Versions: 2.4.8, 2.4.7
            Reporter: Frigo Pratser
            Priority: Minor


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|http://stackoverflow.com/users/120745/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.

{code:title=MessageProducer.groovy|borderStyle=solid}
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')
{code}

{code:title=Stacktrace|borderStyle=solid}
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
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)