Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: in a plug-in which supplies an extension to the org.eclipse.core.resources.builders extension point, parse a Java compilation unit called "A.java", containing code like this: class A { int k; B b; } Note: there is no such class named B. in the plug-in, run some code like this: parser = ASTParser.newParser(AST.JLS3); // in the delta visitor of my IncrementalProjectBuilder ... visit(IResourceDelta d) { IResource r = d.getResource(); IJavaElement je = JavaCore.create(r); icu0 = je.getAdapter(ICompilationUnit.class); // icu0 != null icu = (ICompilationUnit)icu0; parser.setSource(icu); parser.setResolveBindings(true); compilationUnit = (CompilationUnit)parser.createAST(null) compilationUnit.accept(new ASTVisitor() { public boolean visit(TypeDeclaration typeDeclaration) { typeBinding = typeDeclaration.resolveBinding(); // typeBinding != null fields = typeBinding.getDeclaredFields(); // fields.length == 0 More information: There is no such class named "B". However, I expect that getDeclaredFields() should return information about field "k". This used to work in Eclipse 3.3; it seems to have changed in 3.4.
Reproduced.
Created attachment 109304 [details] Proposed fix
Philippe, This is a regression since 3.3.2 as in 3.3.2 we used to return the field 'k'. I would backport the fix to the 3.4 maintenance stream for inclusion in 3.4.1.
Created attachment 109307 [details] Regression test
Released for 3.5M1. Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0692. Philippe, +1 for 3.4.1?
Verified for 3.5M1 using I20080807-0100. We might reopen later for inclusion into 3.4.1.