[
https://issues.apache.org/jira/browse/GROOVY-9608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17147367#comment-17147367
]
Eric Milles edited comment on GROOVY-9608 at 6/28/20, 3:30 PM:
---------------------------------------------------------------
Fixed in master by:
https://github.com/apache/groovy/commit/ce825a7d23f590a73248c0aee1ccec5e78582fe6
Fixed in 3_0_X by:
https://github.com/apache/groovy/commit/4ca9a17a1bb5cdb4f4877409ecdf4a8713da5ee7
was (Author: emilles):
Fixed in master by:
https://github.com/apache/groovy/commit/ce825a7d23f590a73248c0aee1ccec5e78582fe6
> MetaClassImpl.getAttribute(Class,Object,String,boolean) drops super
> -------------------------------------------------------------------
>
> Key: GROOVY-9608
> URL: https://issues.apache.org/jira/browse/GROOVY-9608
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.4.19, 3.0.4, 2.5.12
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> {{ScriptBytecodeAdapter.getFieldOnSuper}} calls
> {{MetaClass.getAttribute(SuperType,thisObject,"fieldName",true)}}.
> {{MetaClassImpl}} delegates and drops the super flag in the process.
> {code:groovy}
> class A {
> protected x = 1
> }
> class B extends A {
> protected x = 1.0
> }
> def a = new A()
> println a.metaClass.getAttribute(A, a, 'x', false) // prints "1"
> def b = new B()
> println b.metaClass.getAttribute(B, b, 'x', false) // prints "1.0"
> println b.metaClass.getAttribute(A, b, 'x', true) // prints "1.0", but "1" is
> expected
> println ScriptBytecodeAdapter.getFieldOnSuper(A, b, 'x') // prints "1.0", but
> "1" is expected
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)