[ https://issues.apache.org/jira/browse/GROOVY-7330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7330. ----------------------------- > Incorrect dynamic proxy creation from map when there are default methods > ------------------------------------------------------------------------ > > Key: GROOVY-7330 > URL: https://issues.apache.org/jira/browse/GROOVY-7330 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime > Affects Versions: 2.4.1 > Reporter: Dmitry Ovchinnikov > Assignee: Paul King > Priority: Critical > Labels: Java_8, default-methods > Fix For: 3.0.0-alpha-4, 2.5.3 > > > {code:java} > package org.dimitrovchi.groovybugs; > import groovy.lang.GroovyShell; > import org.codehaus.groovy.control.CompilerConfiguration; > import org.codehaus.groovy.runtime.DefaultGroovyMethods; > import org.junit.Assert; > import org.junit.Test; > import java.util.Map; > /** > * @author Dmitry Ovchinnikov > */ > public class MapToProxyTest { > private final GroovyShell shell; > public MapToProxyTest() { > final CompilerConfiguration cc = new CompilerConfiguration(); > cc.setTargetBytecode(CompilerConfiguration.JDK8); > shell = new GroovyShell(cc); > } > @Test > public void testMapToProxy() { > final Map map = (Map) shell.evaluate("[x: {10}, y: {20}]"); > final SomeInterface si = DefaultGroovyMethods.asType(map, > SomeInterface.class); > Assert.assertEquals(20, si.y()); > Assert.assertEquals(10, si.x()); // assertion error: si.x() == 1 > } > public interface SomeInterface { > default int x() { > return 1; > } > int y(); > } > } > {code} > JDK 1.8u31 -- This message was sent by Atlassian JIRA (v7.6.3#76005)