@@ -57,7 +57,7 @@ public final class CoreASTProvider {
57
57
public static final String DEBUG_PREFIX = "ASTProvider > " ; //$NON-NLS-1$
58
58
59
59
private volatile ITypeRoot fReconcilingJavaElement ;
60
- private ITypeRoot fActiveJavaElement ;
60
+ private volatile ITypeRoot fActiveJavaElement ;
61
61
private CompilationUnit fAST ;
62
62
private Object fReconcileLock = new Object ();
63
63
private Object fWaitLock = new Object ();
@@ -167,26 +167,26 @@ public CompilationUnit getAST(final ITypeRoot input, WAIT_FLAG waitFlag, IProgre
167
167
168
168
if (isReconciling ) {
169
169
try {
170
- notifyReconciler ();
171
- // Wait for AST
172
- synchronized (fWaitLock ) {
173
- if (isReconciling (input )) {
174
- if (JavaManipulationPlugin .DEBUG_AST_PROVIDER )
175
- System .out .println (getThreadName () + " - " + DEBUG_PREFIX + "waiting for AST for: " + input .getElementName ()); //$NON-NLS-1$ //$NON-NLS-2$
176
- fWaitLock .wait (30000 ); // XXX: The 30 seconds timeout is an attempt to at least avoid a deadlock. See https://bugs.eclipse.org/366048#c21
170
+ do {
171
+ notifyReconciler ();
172
+ // Wait for AST
173
+ synchronized (fWaitLock ) {
174
+ if (isReconciling (input )) {
175
+ if (JavaManipulationPlugin .DEBUG_AST_PROVIDER )
176
+ System .out .println (getThreadName () + " - " + DEBUG_PREFIX + "waiting for AST for: " + input .getElementName ()); //$NON-NLS-1$ //$NON-NLS-2$
177
+ fWaitLock .wait (3000 ); // XXX: The 3 seconds timeout is an attempt to at least avoid a deadlock. See https://bugs.eclipse.org/366048#c21
178
+ }
177
179
}
178
- }
179
180
180
- // Check whether active element is still valid
181
- synchronized (this ) {
182
- if (activeElement == fActiveJavaElement && fAST != null ) {
183
- if (JavaManipulationPlugin .DEBUG_AST_PROVIDER )
184
- System .out .println (getThreadName () + " - " + DEBUG_PREFIX + "...got AST: " + toString (fAST ) + " for: " + input .getElementName ()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
185
-
186
- return fAST ;
181
+ // Check whether active element is still valid
182
+ synchronized (this ) {
183
+ if (activeElement == fActiveJavaElement && fAST != null ) {
184
+ if (JavaManipulationPlugin .DEBUG_AST_PROVIDER )
185
+ System .out .println (getThreadName () + " - " + DEBUG_PREFIX + "...got AST: " + toString (fAST ) + " for: " + input .getElementName ()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
186
+ return fAST ;
187
+ }
187
188
}
188
- }
189
- return getAST (input , waitFlag , progressMonitor );
189
+ } while (true ); // notify and wait again
190
190
} catch (InterruptedException e ) {
191
191
return null ; // thread has been interrupted don't compute AST
192
192
}
0 commit comments