You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2019/06/12 17:31:00 UTC

[jira] [Created] (GROOVY-9173) IllegalAccessError for class extending Java class that provides protected getProperty/setProperty

Eric Milles created GROOVY-9173:
-----------------------------------

             Summary: IllegalAccessError for class extending Java class that provides protected getProperty/setProperty
                 Key: GROOVY-9173
                 URL: https://issues.apache.org/jira/browse/GROOVY-9173
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.5.7
            Reporter: Eric Milles


Consider the following:
PropertyBased.java
{code:java}
public class PropertyBased {
  protected final Object getProperty(String name) {
    return null;
  }
  protected final void setProperty(String name, Object value) {
  }
}
{code}

Whatever.groovy
{code:groovy}
@groovy.transform.CompileStatic
class Whatever extends PropertyBased {
  def getSomething() {
    'some thing'
  }
}
{code}

No compiler errors are produced for Whatever having protected "implementations" of GroovyObject methods.  In this case, our legacy Java base class has {{getProperty}} for non-Groovy reasons.  However, when accessing {{Whatever}} from dynamic groovy code, {{IllegalAccessError}} is thrown.




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)