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 2019/01/28 01:47:00 UTC
[jira] [Resolved] (GROOVY-8238) multiple-catch statement behaves
strangely
[ https://issues.apache.org/jira/browse/GROOVY-8238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-8238.
-------------------------------
Resolution: Fixed
Assignee: Paul King
Fix Version/s: 3.0.0-alpha-5
2.5.6
Turns out the old parser used the same code statements in both blocks when splitting a multi-catch into multi catch blocks.
> 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
> Assignee: Paul King
> Priority: Major
> Fix For: 2.5.6, 3.0.0-alpha-5
>
>
> {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)