You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by fr...@gmail.com on 2017/03/08 09:49:59 UTC

@ListenerList generated fireWhatever() method stops working

Dear users@groovy.apache.org,

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.

@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

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')

The stacktrace is

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

Are we doing something wrong or is this a bug?

Thank you
Frigo Pratser

Re: @ListenerList generated fireWhatever() method stops working

Posted by "Frigyes Pr." <fr...@gmail.com>.
Not sure which components are affected, entered groovy-runtime .
https://issues.apache.org/jira/browse/GROOVY-8110

On Wed, Mar 8, 2017 at 11:50 AM, Paul King <pa...@asert.com.au> wrote:

> Looks like a bug, I haven't checked the code yet but experimentally,
> no array argument (primitive or otherwise) seems to be supported. The
> workaround would be to create a holder event class of some kind that
> had an array property. Filing a bug issue in Jira would be much
> appreciated.
>
> Cheers, Paul.
>
> On Wed, Mar 8, 2017 at 7:49 PM,  <fr...@gmail.com> wrote:
> > Dear users@groovy.apache.org,
> >
> > 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.
> >
> > @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
> >
> > 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')
> >
> > The stacktrace is
> >
> > 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
> >
> > Are we doing something wrong or is this a bug?
> >
> > Thank you
> > Frigo Pratser
>

Re: @ListenerList generated fireWhatever() method stops working

Posted by Paul King <pa...@asert.com.au>.
Looks like a bug, I haven't checked the code yet but experimentally,
no array argument (primitive or otherwise) seems to be supported. The
workaround would be to create a holder event class of some kind that
had an array property. Filing a bug issue in Jira would be much
appreciated.

Cheers, Paul.

On Wed, Mar 8, 2017 at 7:49 PM,  <fr...@gmail.com> wrote:
> Dear users@groovy.apache.org,
>
> 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.
>
> @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
>
> 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')
>
> The stacktrace is
>
> 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
>
> Are we doing something wrong or is this a bug?
>
> Thank you
> Frigo Pratser