[ https://issues.apache.org/jira/browse/GROOVY-11410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-11410: --------------------------------- Language: groovy > type mismatch when the expected type is java.lang.Class > ------------------------------------------------------- > > Key: GROOVY-11410 > URL: https://issues.apache.org/jira/browse/GROOVY-11410 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Thodoris Sotiropoulos > Priority: Minor > > I have the following program > {code:java} > class Test { > public static void main(String [] args) { > java.lang.Class<String> lapse = 1; > } > } {code} > h3. Actual behavior > The code compiles, but I get the following runtime error: > {code:java} > Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot > cast object '1' with class 'java.lang.Integer' to class 'java.lang.Class' due > to: java.lang.ClassNotFoundException: 1 > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '1' with class 'java.lang.Integer' to class 'java.lang.Class' due to: > java.lang.ClassNotFoundException: 1 > at Test.main(test.groovy:3){code} > h3. Expected behavior > The code should have been rejected > Tested against master (commit: e6b9133726af9cdea2bc6db7b55523cd88f7190e) -- This message was sent by Atlassian Jira (v8.20.10#820010)