groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Schumacher (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-7379) listeners.each { UDPListener -> ... fails with exception runtime on List<UDPListener> when used in an inner class.
Date Sun, 05 Jul 2015 14:09:04 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-7379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Pascal Schumacher closed GROOVY-7379.
-------------------------------------
    Resolution: Cannot Reproduce

I'm closing this because of Pauls comments and because Tommy Svensson did not answer Pauls
question.

> listeners.each { UDPListener -> ... fails with exception runtime on List<UDPListener>
when used in an inner class.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7379
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7379
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, groovy-runtime
>    Affects Versions: 2.3.6, 2.3.11
>         Environment: Mac OS X 10.10.2, JDK 1.7.0_71
>            Reporter: Tommy Svensson
>
> Exception in thread "Thread-1" java.lang.VerifyError: (class: se/natusoft/osgi/aps/tcpipsvc/UDPReceiver$_ReceiverThread_run_closure1,
method: doCall signature: (Lse/natusoft/osgi/aps/api/net/tcpip/UDPListener;)Ljava/lang/Object;)
Incompatible object argument for function call
> 	at se.natusoft.osgi.aps.tcpipsvc.UDPReceiver$ReceiverThread.run(UDPReceiver.groovy:219)
> Caused by the following code:
> {noformat}
>                this.listeners.each { UDPListener listener ->
>                     try {
>                         listener.udpDataReceived(config.name, dp)
>                     }
>                     catch (Exception e) {
>                         getSafeLogger().error("Listener call failed for '" + config.name
+ "'! (" + listener + ")", e)
>                     }
>                 }
> {noformat}
> The above code block fails with the above exception when the class the code block is
part of is an inner class. When the whole inner class is moved up into its own top level class,
this works fine, and there is no exception. I've noticed this behavior before, there are several
Groovy features that simply fails when they are part of an inner class, but works fine in
a top level class. 
> I guess that the lesson here is to avoid inner classes in Groovy for now at least. 
> I really love Groovy as a language, it sovles a lot of the problem with Java. Unfortunately
the stability and quality of Java releases and Grovvy releases are on separate sides of the
universe. Due to this I don't dare reccomend to a customer to use Groovy until it has more
stable and backwards compatible releases. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message