Bug 118897

Summary: ASTParser resolves bindings without request
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: eclipsetalk2
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-12-01 13:46:37 EST
I20051130-1215

ASTParser resolves bindings without request when certain conditions hold, although setResolveBindings(true) has not been called.

The following extract from internalCreateAST(IProgressMonitor) looks suspicios:

    if (this.rawSource != null) {
        needToResolveBindings = this.unitName != null && this.project != null &&
                this.compilerOptions != null;
    ...

I would not expect to get bindings unless I explicitly requested them. This can be a serious performance hit for clients that only need lightweight ASTs.
Comment 1 Markus Keller CLA 2005-12-01 13:53:03 EST
I just found that jdt.ui relies on this behavior in a few places. So we might get errors if you fix it right now. I'll make a pass and correct our errors today.
Comment 2 Olivier Thomann CLA 2005-12-01 13:55:19 EST
Let me know when you are done.
Comment 3 Markus Keller CLA 2005-12-01 15:35:19 EST
I've released the required changes in jdt.ui and tests to HEAD. From what I saw, jdt.debug should already be clean.

Note: A reference search for setSource(char[]) showed that jdt.core also has a place where this assumption is taken. The javadoc of the deprecated AST.parseCompilationUnit(char[], String, IJavaProject) promises about what's currently implemented in ASTParser.
Comment 4 Olivier Thomann CLA 2005-12-16 20:15:59 EST
Fixed and released in HEAD.
Regression tests in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0625/0626
Comment 5 Maxime Daniel CLA 2006-02-15 08:59:50 EST
Verified for 3.2 M5 using build I20060215-0010.