You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2019/12/09 21:36:01 UTC

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

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

Paul King closed GROOVY-9173.
-----------------------------

> 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
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.0-rc-2
>
>         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
(v8.3.4#803005)