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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

JIRA jira@apache.org
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)