[ 
https://issues.apache.org/jira/browse/GROOVY-7412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles closed GROOVY-7412.
-------------------------------
    Fix Version/s: 2.5.3
       Resolution: Fixed

> Map-to-interface cast: map method definition does not override the default 
> method
> ---------------------------------------------------------------------------------
>
>                 Key: GROOVY-7412
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7412
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.3
>         Environment: JDK 1.8u45
> Ubuntu 15.04 x86_64
> Groovy 2.4.3
>            Reporter: Dmitry Ovchinnikov
>            Priority: Major
>             Fix For: 2.5.3
>
>
> The following code
> {code:java}
> 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();
>     }
> }
> {code}
> produces
> {noformat}
> x = 1, y = 2, z = 19
> {noformat}
> but x must be 3.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to