You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Leonard Brünings (Jira)" <ji...@apache.org> on 2022/04/28 14:27:00 UTC
[jira] [Created] (GROOVY-10606) Access to private static fields in inherited methods doesn't work in Groovy 4
Leonard Brünings created GROOVY-10606:
-----------------------------------------
Summary: Access to private static fields in inherited methods doesn't work in Groovy 4
Key: GROOVY-10606
URL: https://issues.apache.org/jira/browse/GROOVY-10606
Project: Groovy
Issue Type: Bug
Affects Versions: 4.0.2
Reporter: Leonard Brünings
{code:groovy}
class Reproducer {
private static final String PREFIX = 'prop.'
static void main(String... args) {
new Reproducer().doTheThing()
new Child().doTheThing()
}
void doTheThing() {
def map = [a: 'A', b:'B']
map.forEach( (key, value) -> {
println PREFIX + key + " $value"
})
}
}
class Child extends Reproducer {
}
{code}
([Groovy Web Console|https://gwc-experiment.appspot.com/?g=groovy_4_0&codez=eJxtkVFLwzAUhZ_trzgMISmb-QEDBR0b7E3mHgTxISa3a1iWljSrivS_m8XadbD7cAnc7-TcnCgrmwYbqn2lj4o8fjLEqr1pZSA0QQajUBgnLV6CN26H581ytX7FPVgU1YIlQaxsaL2qrYzGQRrH_5RCCEi_a_Le5MbR58ia50JX25K2ZWR5fkYWpbH62rQ7WyavMdB7nEpTEdeo48Zvcg72yGb4mLMn9j4QwyFioqj8UqqSg-_pe4ZW2iPluHsY3dhH5IJ1_3FMEenYJ7hNiskAdxfLdlmmUubpVaCvQE5f-YETOLb7BQlGcZw])
Works in Groovy 2.5.x and 3.x but fails with Groovy 4.0.2
{noformat}
groovy.lang.MissingPropertyException: No such property: PREFIX for class: Child
at Reproducer$_doTheThing_closure1.doCall(Script1.groovy:14)
at com.sun.proxy.$Proxy21.accept(Unknown Source)
at Reproducer.doTheThing(Script1.groovy:13)
at Reproducer.main(Script1.groovy:7)
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)