You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "John Wagenleitner (JIRA)" <ji...@apache.org> on 2016/10/01 22:40:20 UTC
[jira] [Closed] (GROOVY-3008) Superclass can access field declared
in subclass
[ https://issues.apache.org/jira/browse/GROOVY-3008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Wagenleitner closed GROOVY-3008.
-------------------------------------
Resolution: Fixed
Fix Version/s: 2.3.11
Starting from 2.3 on this fails with {{groovy.lang.MissingPropertyException: No such property: subClassField for class: Sub}} so am marking as fixed.
> Superclass can access field declared in subclass
> ------------------------------------------------
>
> Key: GROOVY-3008
> URL: https://issues.apache.org/jira/browse/GROOVY-3008
> Project: Groovy
> Issue Type: Sub-task
> Components: class generator
> Affects Versions: 1.5.6
> Environment: Windows XP
> Reporter: Torsten Feig
> Fix For: 2.3.11
>
>
> Why does something like that work?
> {code:Java}
> class Base {
> String test() {
> return subClassField // subClassField is unknown in class Base!!
> }
> }
> class Sub extends Base {
>
> private subClassField = "foo"
>
> static main(args) {
> println new Sub().test() // -> "foo"
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)