groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Wagenleitner (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-3008) Superclass can access field declared in subclass
Date Sat, 01 Oct 2016 22:40:20 GMT

     [ 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)

Mime
View raw message