Community
Participate
Working Groups
I20051117 1. Have these 2 cus: A.java public class A extends B { } B.java public class B { public static final int CONST = 1 + 1; } 2. Use ASTParser#createASTs(...) to resolve just A.java 3. In the ASTRequestor#accept(...) walk the binding for A to B, then to the constant CONST 4. Asks for its constant value Observe: it returns null We should lazily resolve the constant value.
Calling FieldReference.getConstantFor(fieldBinding, null, false, null) should work.
I think it should call: FieldReference.getConstantFor(fieldBinding, null, true, null) to ensure actual constant is surfaced. I am also wondering if the FieldRef code shouldn't be made more lazy, by simply having the field binding itself be lazy. This would mean no change for DOM itself. Will attach corresponding patch, can you give it a try Jerome ?
Created attachment 30215 [details] Patch for having field binding lazily resolve their constants
Created attachment 30216 [details] Regression test
Created attachment 30221 [details] More aggressive patch
Jerome - pls add your test. *** This bug has been marked as a duplicate of 61946 ***
Test released in HEAD