]> source.dussan.org Git - aspectj.git/commitdiff
Fix for Bugzilla Bug 70773
authoraclement <aclement>
Mon, 2 Aug 2004 10:14:39 +0000 (10:14 +0000)
committeraclement <aclement>
Mon, 2 Aug 2004 10:14:39 +0000 (10:14 +0000)
   AspectJ Error: ConncurrentModificationException thrown: null

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java

index ffc6333db0631916910bb38dabe4e6b0f1a93843..05465c469b7a4fcc3c7016e2b988e2a34e015350 100644 (file)
@@ -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;
                        }
                }               
        }