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

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

    [ https://issues.apache.org/jira/browse/GROOVY-8110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15901168#comment-15901168 ] 

Paul King commented on GROOVY-8110:
-----------------------------------

Just some additional info/examples. Using String[] as the type instead of byte[] yields:
{noformat}
java.lang.ClassFormatError: Method "fireMessageReceived" in class MessageProducer has illegal signature "(L[Ljava/lang/String;;)V"
{noformat}
With similar results for other object types.

Adding @CompileStatic to the produce method yields:
{noformat}
java.lang.VerifyError: (class: MessageProducer, method: produce signature: (Ljava/lang/String;)V) Incompatible argument to function
{noformat}


> @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.7, 2.4.8
>            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)