groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7330) Incorrect dynamic proxy creation from map when there are default methods
Date Fri, 17 Aug 2018 08:10:00 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-7330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16583568#comment-16583568
] 

ASF GitHub Bot commented on GROOVY-7330:
----------------------------------------

GitHub user paulk-asert opened a pull request:

    https://github.com/apache/groovy/pull/785

    GROOVY-7330: Incorrect dynamic proxy creation from map when there are…

    … default methods

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paulk-asert/groovy groovy7330

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/785.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #785
    
----
commit 2c526ef1d53f8e8a5ef00f660b885a20378fc5a8
Author: Paul King <paulk@...>
Date:   2018-08-17T07:49:50Z

    GROOVY-7330: Incorrect dynamic proxy creation from map when there are default methods

----


> 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
>            Priority: Critical
>              Labels: Java_8, default-methods
>
> {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)

Mime
View raw message