groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniil Ovchinnikov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8264) Setter accessed via import alias of a getter with setter name
Date Tue, 18 Jul 2017 19:22:00 GMT
Daniil Ovchinnikov created GROOVY-8264:
------------------------------------------

             Summary: Setter accessed via import alias of a getter with setter name
                 Key: GROOVY-8264
                 URL: https://issues.apache.org/jira/browse/GROOVY-8264
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 2.4.12
            Reporter: Daniil Ovchinnikov


{code:title=com/foo/Bar.java}package com.foo;

public class Bar {
    public static Object getSome() {
        System.out.println("getter");
        return 42;
    }
    public static void setSome(Object a) {
        System.out.println("setter " + a);
    }
}
{code}

{code:title=playground.groovy}
import static com.foo.Bar.getSome as setAbc
setAbc() // prints 'getter'
setAbc(2) // MME: No signature of method: static com.foo.Bar.getSome() is applicable
abc = 1 // prints 'setter 1', should throw MME
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message