[ https://issues.apache.org/jira/browse/GROOVY-11439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thodoris Sotiropoulos closed GROOVY-11439. ------------------------------------------ Resolution: Information Provided > closure is assignable to java.io.InputStream > -------------------------------------------- > > Key: GROOVY-11439 > URL: https://issues.apache.org/jira/browse/GROOVY-11439 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Thodoris Sotiropoulos > Priority: Minor > Labels: groovy > > I am not sure if this is an expected behavior or not, but a lambda expression > is assignable to java.io.InputStream > > {code:java} > class Test { > public static void main(String[] args) { > java.io.InputStream x = (int p, int p2) -> p; > System.out.println(x.read()); > } > } {code} > h3. Actual behavior > The code compiles, but I get the following exception at runtime > {code:java} > Exception in thread "main" groovy.lang.MissingMethodException: No signature > of method: Test$_main_closure1.doCall() is applicable for argument types: () > values: [] > Possible solutions: doCall(int, int), isCase(java.lang.Object), > isCase(java.lang.Object), findAll(), findAll(), findAll(groovy.lang.Closure) > at > org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:259) > at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1006) > at groovy.lang.Closure.call(Closure.java:452) > at InputStream1_groovyProxy.read(Unknown Source) > at Test.main(test.groovy:4) {code} > h3. Expected behavior > The code should have been rejected. -- This message was sent by Atlassian Jira (v8.20.10#820010)