Bug 114935 - ASTParser.createASTs parses more CUs then required
Summary: ASTParser.createASTs parses more CUs then required
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-03 11:16 EST by Benno Baumgartner CLA
Modified: 2005-12-12 13:06 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benno Baumgartner CLA 2005-11-03 11:16:28 EST
Version: 3.2.0
Build id: I20051102-1600

I'm using ASTParser.createASTs to generate asts (with resolve bindings) for an
array of 40 ICompilationUnits. 

When I get the callback to acceptAST from CompilationUnitResolver.resolve for
the last CU in the array and I look at the caller I see that 40 (i= 39) CUs have
been processed from about 200 (totalUnits= 193). The remaining units are
processed after the last call to acceptAST meaning that a lot of work is done
after I got all ASTs for my CUs. 

I don't know why this work is done. Is this work really required? Is this a bug
maybe related to bug 111822 ? Or do I have to set a specific parser setting to
prevent this behaviour (the code where I call createASTs is in
org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring#parse). 

This has a huge performance impact on the Clean Up source action.
Comment 1 Philipe Mulet CLA 2005-11-16 11:47:25 EST
I believe it is indeed a consequence of the fix for bug 111822. Now, you need
this in order to exploit DOM ASTs, if not you may see partial binding
information in presence of references to the downstream AST (if they wouldn't
have been fully resolved).

Offering a setting is something we could explore.
Comment 2 Dirk Baeumer CLA 2005-11-16 11:56:31 EST
Philippe, what we don't understand is that fact that when the extra CUs are
parsed when already processed ALL ASTs we requested.
Comment 3 Dirk Baeumer CLA 2005-11-16 11:58:52 EST
And I guess this behavior as a negative impact in "Infer Type Arguments" as well
(for which we don't have a performance test ;-)). 
Comment 4 Jerome Lanneluc CLA 2005-11-17 06:44:54 EST
Changed CompilationUnitResolver#resolve(ICompilationUnit[], String[],
ASTRequestor, ...) to stop processing units if all requested ASTs and all
requested binding keys have been returned.

Added regression test BatchASTCreationTests#test070().
Comment 5 David Audel CLA 2005-12-12 13:06:16 EST
Verified for 3.2 M4 using build I20051212-0010