You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Huss (JIRA)" <ji...@apache.org> on 2016/12/20 01:38:58 UTC

[jira] [Created] (GROOVY-8027) Unexpected ClassCastException in multi-catch including java.lang.Error

Daniel Huss created GROOVY-8027:
-----------------------------------

             Summary: Unexpected ClassCastException in multi-catch including java.lang.Error
                 Key: GROOVY-8027
                 URL: https://issues.apache.org/jira/browse/GROOVY-8027
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.7
         Environment: Java 1.8.0_66
            Reporter: Daniel Huss


{code}
import groovy.transform.CompileStatic

@CompileStatic
class Example {

    public static void main( String[] args ) {
        try {
            throw new RuntimeException( "ok" )
        } catch ( RuntimeException | Error e ) {
            println "${e.class.simpleName} : ${e.message}"
        }
    }

}
{code}

Expected output: {{RuntimeException : ok}}
Actual output: {{Exception in thread "main" java.lang.ClassCastException: java.lang.RuntimeException cannot be cast to java.lang.Error}}




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