From: aclement Date: Mon, 2 Aug 2004 10:14:39 +0000 (+0000) Subject: Fix for Bugzilla Bug 70773 X-Git-Tag: for_ajdt1_1_12~69 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9aed31d18e3848c72c6963dc3a6ee4661a79add9;p=aspectj.git Fix for Bugzilla Bug 70773 AspectJ Error: ConncurrentModificationException thrown: null --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index ffc6333db..05465c469 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -384,13 +384,16 @@ public class AjLookupEnvironment extends LookupEnvironment { private List pendingTypesToFinish = new ArrayList(); - boolean inBinaryTypeCreation = false; + boolean inBinaryTypeCreationAndWeaving = false; + boolean processingTheQueue = false; + public BinaryTypeBinding createBinaryTypeFrom( IBinaryType binaryType, PackageBinding packageBinding, boolean needFieldsAndMethods) { - if (inBinaryTypeCreation) { + + if (inBinaryTypeCreationAndWeaving) { BinaryTypeBinding ret = super.createBinaryTypeFrom( binaryType, packageBinding, @@ -399,23 +402,27 @@ public class AjLookupEnvironment extends LookupEnvironment { return ret; } - - inBinaryTypeCreation = true; + inBinaryTypeCreationAndWeaving = true; try { BinaryTypeBinding ret = super.createBinaryTypeFrom( binaryType, packageBinding, needFieldsAndMethods); - weaveInterTypeDeclarations(ret); - + weaveInterTypeDeclarations(ret); return ret; } finally { - inBinaryTypeCreation = false; - if (!pendingTypesToFinish.isEmpty()) { - for (Iterator i = pendingTypesToFinish.iterator(); i.hasNext(); ) { - weaveInterTypeDeclarations((BinaryTypeBinding)i.next()); + inBinaryTypeCreationAndWeaving = false; + + // Start processing the list... + if (pendingTypesToFinish.size()>0) { + processingTheQueue = true; + while (!pendingTypesToFinish.isEmpty()) { + BinaryTypeBinding nextVictim = (BinaryTypeBinding)pendingTypesToFinish.remove(0); + // During this call we may recurse into this method and add + // more entries to the pendingTypesToFinish list. + weaveInterTypeDeclarations(nextVictim); } - pendingTypesToFinish.clear(); + processingTheQueue = false; } } }