[jira] [Updated] (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] [Updated] (GROOVY-9173) IllegalAccessError for class extending Java class that provides protected getProperty/setProperty

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/GROOVY-9173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-9173:
--------------------------------
    Description:
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.  See the attached (run {{gradlew test}})


  was:
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.



> 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
>            Priority: Major
>         Attachments: property-methods.zip
>
>
> 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.  See the attached (run {{gradlew test}})



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