[ https://issues.apache.org/jira/browse/GROOVY-8238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16750912#comment-16750912 ]
Paul King commented on GROOVY-8238: ----------------------------------- The following example fails in Groovy 2.5.5 but passes in 3.0.0-alpha-4: {code:java} import groovy.cli.CliBuilderException try { throw new RuntimeException('not working') } catch ( RuntimeException | CliBuilderException e ) { println e.message } {code} I get the same result on the heads of the two respective branches and with and without {{@CompileStatic}}. I don't know yet whether the new parser is causing a different path to be traversed during compilation or whether there is a commit/fix we haven't back-ported to the 2_5_X branch as of yet. I'll keep looking. > multiple-catch statement behaves strangely > ------------------------------------------ > > Key: GROOVY-8238 > URL: https://issues.apache.org/jira/browse/GROOVY-8238 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime > Affects Versions: 2.4.6 > Environment: Windows 10 > Reporter: Gert Grossmann > Priority: Major > > {code:java} > try { > throw new AnyJavaException() > } catch ( AnyJavaException1 | AnyJavaException2 e ) { > println e.message > } > {code} > This works as expected. But following does not: > {code:java} > try { > throw new AnyJavaException() > } catch ( AnyJavaException | AnyGroovyException e ) { > println e.message > } > {code} > You get: > {noformat} > java.lang.ClassCastException: AnyJavaException cannot be cast to > groovy.lang.GroovyObject > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)