You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Gert Grossmann (JIRA)" <ji...@apache.org> on 2017/06/27 11:05:00 UTC
[jira] [Created] (GROOVY-8238) multiple-catch statement behaves
strangely
Gert Grossmann created GROOVY-8238:
--------------------------------------
Summary: 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
try {
throw new AnyJavaException()
}
catch ( AnyJavaException1 | AnyJavaException2 e ) { println e.message }
This works as expected. But following does not:
import AnyGroovyException
try {
throw new AnyJavaException()
}
catch ( AnyJavaException | AnyGroovyException e ) { println e.message }
You get:
java.lang.ClassCastException: AnyJavaException cannot be cast to groovy.lang.GroovyObject
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)