Eric Milles created GROOVY-9608:
-----------------------------------
Summary: 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.5.12, 3.0.4, 2.4.19
Reporter: Eric Milles
Assignee: Eric Milles
{{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)