Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.3
-
None
-
JDK 1.8u45
Ubuntu 15.04 x86_64
Groovy 2.4.3
-
Important
Description
The following code
import groovy.lang.GroovyShell; import org.codehaus.groovy.control.CompilerConfiguration; public class InterfaceDefaultMethods { public static void main(String... args) throws Exception { final CompilerConfiguration cc = new CompilerConfiguration(); cc.setTargetBytecode(CompilerConfiguration.JDK8); final GroovyShell shell = new GroovyShell(cc); final X x = (X) shell.evaluate("[x : {-> 3}, z: {-> 19}] as " + X.class.getCanonicalName()); System.out.format("x = %d, y = %d, z = %d%n", x.x(), x.y(), x.z()); } public interface X { default int x() { return 1; } default int y() { return 2; } int z(); } }
produces
x = 1, y = 2, z = 19
but x must be 3.
Attachments
Issue Links
- duplicates
-
GROOVY-7330 Incorrect dynamic proxy creation from map when there are default methods
- Closed
- relates to
-
GROOVY-10717 Map to type coercion not working on abstract classes
- Closed