Issue 396 in groovypptest: No SAM conversion in interfaces

2 views
Skip to first unread message

groovy...@googlecode.com

unread,
Aug 14, 2011, 11:13:21 AM8/14/11
to groovyp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 396 by gromop...@gmail.com: No SAM conversion in interfaces
http://code.google.com/p/groovypptest/issues/detail?id=396

interface Foo {
Function1<String, String> x = { it.substring(1) }
}

class Bar {
static Function1<String, String> x = { it.substring(1) }

public static void main(String[] args) {
println x('abc')
println Foo.x('abc')
}
}

----------

fails at runtime:


bc
Exception in thread "main" java.lang.ExceptionInInitializerError
at Bar.main(test.gpp:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException:
Cannot cast object 'Foo$__clinit__closure2@26914f6a' with
class 'Foo$__clinit__closure2' to class 'groovy.lang.Function1'
at
org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:331)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
at Foo.<clinit>(test.gpp)
... 6 more


groovy...@googlecode.com

unread,
Aug 24, 2011, 4:03:08 AM8/24/11
to groovyp...@googlegroups.com
Updates:
Status: Fixed

Comment #1 on issue 396 by alex.tka...@gmail.com: No SAM conversion in
interfaces
http://code.google.com/p/groovypptest/issues/detail?id=396

(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages