Bug 118897 - ASTParser resolves bindings without request
Summary: ASTParser resolves bindings without request
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-01 13:46 EST by Markus Keller CLA
Modified: 2006-02-15 08:59 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.