[ 
https://issues.apache.org/jira/browse/GROOVY-10037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17324373#comment-17324373
 ] 

Eric Holley commented on GROOVY-10037:
--------------------------------------

I just ran the example code on 4.0.0-alpha-3 and it works for me as well. I'll 
wait for 3.0.8 to make it to Maven Central since my project is build using 
Gradle and I don't want to fight with a local Groovy compiler dependency. I 
discovered the problem while running test cases against an AST transform that I 
wrote (hence the set$xyz() and get$xyz() style getters/setters. I have since 
discovered that the problem is not actually with the setter not being found, 
but with the getter/setter Groovy syntactic sugar ($xyz = 5.) If you call the 
setter directly, set$xzy(5), it works. Thanks for the help. I'm also seeing 
some other related issues with getters/setters in my transform related to one 
class with my transform extending another that I have not, so far been able to 
display in a simple (not-transform) example. Once 3.0.8 comes out, I see if 
these issues clear up as well. 

> Private setter method in class that is extended by another class cannot be 
> found.
> ---------------------------------------------------------------------------------
>
>                 Key: GROOVY-10037
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10037
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.7
>         Environment: groovy 3.0.7
> javac 13.0.2
> Windows/10
>            Reporter: Eric Holley
>            Assignee: Eric Milles
>            Priority: Major
>         Attachments: StaticSetterBug.groovy, StaticSetterBug.groovy
>
>
> If you have a class that is extended by another class and there is a private 
> setter in the class that is extended, that setter cannot be found at runtime. 
> Example script attached. At runtime, the following exception trace is shown:
> {code:java}
> groovy.lang.MissingPropertyException: No such property: $priv for class: 
> com.my_example.ExtendedBugClass
> Possible solutions: $pub
> at com.my_example.BugClass.test(StaticSetterBug.groovy:27)
> at com.my_example.ExtendedBugClass.run(StaticSetterBug.groovy:37)
> at com.my_example.ExtendedBugClass$run.call(Unknown Source)
> at com.my_example.StaticSetterBug.run(StaticSetterBug.groovy:42)
> at jdk.internal.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> {code}
>  Note: Problem occurs regardless of whether classes are dynamic or static 
> compiled. The '$' in the names has no effect, a letter in its place has same 
> problem. The extending class does not have this problem. A stand alone class 
> also does not have this problem. If the setter is public or protected, the 
> problem goes away. Private getters do not display the problem.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to