Eric Milles created GROOVY-9609:
-----------------------------------
Summary: ScriptBytecodeAdapter.getPropertyOnSuper fails with
method missing for getProperty
Key: GROOVY-9609
URL: https://issues.apache.org/jira/browse/GROOVY-9609
Project: Groovy
Issue Type: Bug
Reporter: Eric Milles
{{ScriptBytecodeAdapter.getPropertyOnSuper}} calls
{{invokeSuperMethodN(SuperType,thisObject,"getProperty", new
Object[]\{"propertyName"\})}}, which calls
{{thisObject.getMetaClass().invokeMethod(SuperType,thisObject,"getProperty",
messageArguments, true, true)}}. {{MetaClassImpl}}'s invokeMethod is failing
to find public getProperty(String) method in class A.
{code:groovy}
class A {
def getX() { 'A' }
}
class B extends A {
def getX() { 'B' }
}
println new A().getProperty("x") // prints "A"
println new B().getProperty("x") // prints "B"
println ScriptBytecodeAdapter.getPropertyOnSuper(A, new B(), "x") //
MissingMethodException: No signature of method: B.getProperty() is applicable
for argument types: (String) values: [x]
{code}
Also, the message indicates that B is the type that was searched; it should
display A.
I found a similar result for {{ScriptBytecodeAdapter.getFieldOnSuper}} in
GROOVY-9608. I think there is something wrong with the cached super
information in MetaClassImpl.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)