Community
Participate
Working Groups
N20060407 1. Check out org.eclipse.jdt.tests.compiler 2. Open GenericTypeTest 3. Position cursor just before the last closing curly braket 4. Start CPU profiling 5. In GenericTypeTest.java, type 'a', wait 1s, type another 'a', wait 1s, etc. (do this for 15s) 6. Stop profiling Observe: It appears that 2 threads are creating ASTs (the reconciler thread and a SelectionListenerWithASTManager thread)
Created attachment 37983 [details] Profiling trace
To reproduce: 1. starting N20060307 on Sun's JRE 1.4.2 on new workspace 2. import org.eclipse.jdt.core and org.eclipse.jdt.ui plug-ins as source 3. Debug new Eclipse Application 4. In runtime workspace, create a new Java project (accept all defaults) 5. New class X in default package 6. add breakpoint in ASTProvider.createAST 7. add breapoint in CompilationUnit.reconcile 8. type 1 character in X.java 9. bp in reconcile is hit 10. type another character in X.java 11. resume reconcile threa 12. bp in ASTProvider is hit
After activating the Debug/ASTProvider trace: - I cleared the console after step 7. - I got the following trace on step 9: main - ASTProvider > returning cached AST:X for: X.java main - ASTProvider > about to reconcile: X.java main - ASTProvider > caching AST: null for: X.java main - ASTProvider > disposing AST: X for: X.java - I cleared the console again - I got the following trace on step 12 main - ASTProvider > returning null (WAIT_NO) for: X.java org.eclipse.jdt.internal.ui.text.JavaReconciler - ASTProvider > reconciled: X.java, AST: null org.eclipse.jdt.internal.ui.text.JavaReconciler - ASTProvider > caching AST: null for: X.java Worker-7 - ASTProvider > about to reconcile: X.java Worker-7 - ASTProvider > caching AST: null for: X.java
Further debugging shows that resuming the reconcile thread (step 11) causes it to notify a null AST since the reconcile operation is cancelled since a character is typed.
Can reproduce.
Fix is ready but needs further testing.
I've released the fix to HEAD. Available in builds > N20060409-0010. Jerome can you also verify that it works? Thanks.
Verified that no extra AST is created using N20060410. Thanks Dani.
Verifying...
Verified that only the reconciler creates ASTs in the scenario given in comment 2.