Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-JSR-3
-
None
-
None
Description
public class Test {
public String x = "hello";
public static void main(String[] args) {
final Test t1 = new Test();
final Test t2 = new Test() {}; // subclass of Test
InvokerHelper.getMetaClass(t1).getAttribute(t1, "x");
InvokerHelper.getMetaClass(t2).getAttribute(t2, "x");
}
}
The first call of getAttribute works the sewcond fails with:
Exception in thread "main" groovy.lang.MissingFieldException: No such field: x for class: Test$1
at groovy.lang.MetaClass.getAttribute(MetaClass.java:1112)
at Test.main(Test.java:35)