groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gert Grossmann (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8238) multiple-catch statement behaves strangely
Date Tue, 27 Jun 2017 11:05:00 GMT
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)

Mime
View raw message