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).setAttribute(t1, "x", "a");
InvokerHelper.getMetaClass(t2).setAttribute(t2, "x", "a");
}
}
produces:
Exception in thread "main" groovy.lang.MissingFieldException: No such field: x for class: Test$1
at groovy.lang.MetaClass.setAttribute(MetaClass.java:1138)
at Test.main(Test.java:35)