groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniil Ovchinnikov <daniil.ovchinni...@jetbrains.com>
Subject Synthetic GroovyObject methods
Date Tue, 06 Mar 2018 15:39:30 GMT
Is there any reason why implementations of GroovyObject methods which are injected into Groovy
classes are marked with ACC_SYNTHETIC? 

This causes all sorts of confusion:

class GroovyClass {}

class JavaClass extends GroovyClass {} // compiles ok

class JavaClass extends GroovyClass implements GroovyObject {} // error: JavaClass is not
abstract and does not override abstract method setMetaClass(MetaClass) in GroovyObject

class JavaClass extends GroovyClass { 
    @Override
    public Object getProperty(String propertyName) {
        return super.getProperty(propertyName); // error: cannot find symbol: method getProperty(String)
    }
}

class JavaClass {
    void usage() {
        new GroovyClass().getProperty("a”); // error: cannot find symbol: method getProperty(String)
    }
}

This happens because javac ignores ACC_SYNTHETIC members as if they don’t even exist.

—

Daniil Ovchinnikov
Software Developer
JetBrains
jetbrains.com
“Drive to develop”


Mime
View raw message