]> source.dussan.org Git - aspectj.git/commitdiff
268827: tell ajdt about class file removal
authoraclement <aclement>
Fri, 20 Mar 2009 17:37:24 +0000 (17:37 +0000)
committeraclement <aclement>
Fri, 20 Mar 2009 17:37:24 +0000 (17:37 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java

index a49e03f140be31ab7833773be6455535fd4270db..39f8aeaf8f1b59213f2282b57b3661c4bd66b6c8 100644 (file)
@@ -68,4 +68,11 @@ public interface CompilationResultDestinationManager {
         */
        void reportClassFileWrite(String outputfile);
 
+       /**
+        * Report that a class file is being deleted from the specified location.
+        * 
+        * @param outputfile the output file (including .class suffix)
+        */
+       void reportClassFileRemove(String outputfile);
+
 }
index 7ef71b36be55ce3b52a61c42140a3c0c80ee33a1..0bc693674f5f1b56bed90d1771c752b83fad1289 100644 (file)
@@ -1025,12 +1025,12 @@ public class AjState implements CompilerConfigurationChangeFlags {
                        List cfs = (List) iter.next();
                        for (Iterator iterator = cfs.iterator(); iterator.hasNext();) {
                                ClassFile cf = (ClassFile) iterator.next();
-                               cf.deleteFromFileSystem();
+                               cf.deleteFromFileSystem(buildConfig);
                        }
                }
                for (Iterator iterator = classesFromName.values().iterator(); iterator.hasNext();) {
                        File f = (File) iterator.next();
-                       new ClassFile("", f).deleteFromFileSystem();
+                       new ClassFile("", f).deleteFromFileSystem(buildConfig);
                }
                for (Iterator iter = resources.iterator(); iter.hasNext();) {
                        String resource = (String) iter.next();
@@ -1046,8 +1046,9 @@ public class AjState implements CompilerConfigurationChangeFlags {
        }
 
        private void deleteClassFiles() {
-               if (deletedFiles == null)
+               if (deletedFiles == null) {
                        return;
+               }
                for (Iterator i = deletedFiles.iterator(); i.hasNext();) {
                        File deletedFile = (File) i.next();
                        addDependentsOf(deletedFile);
@@ -1156,7 +1157,7 @@ public class AjState implements CompilerConfigurationChangeFlags {
        private void deleteClassFile(ClassFile cf) {
                classesFromName.remove(cf.fullyQualifiedTypeName);
                weaver.deleteClassFile(cf.fullyQualifiedTypeName);
-               cf.deleteFromFileSystem();
+               cf.deleteFromFileSystem(buildConfig);
        }
 
        private UnwovenClassFile createUnwovenClassFile(AjBuildConfig.BinarySourceFile bsf) {
@@ -1834,7 +1835,7 @@ public class AjState implements CompilerConfigurationChangeFlags {
                        this.locationOnDisk = location;
                }
 
-               public void deleteFromFileSystem() {
+               public void deleteFromFileSystem(AjBuildConfig buildConfig) {
                        String namePrefix = locationOnDisk.getName();
                        namePrefix = namePrefix.substring(0, namePrefix.lastIndexOf('.'));
                        final String targetPrefix = namePrefix + BcelWeaver.CLOSURE_CLASS_PREFIX;
@@ -1847,10 +1848,17 @@ public class AjState implements CompilerConfigurationChangeFlags {
                                });
                                if (weaverGenerated != null) {
                                        for (int i = 0; i < weaverGenerated.length; i++) {
+                                               if (buildConfig != null && buildConfig.getCompilationResultDestinationManager() != null) {
+                                                       buildConfig.getCompilationResultDestinationManager()
+                                                                       .reportClassFileRemove(weaverGenerated[i].getPath());
+                                               }
                                                weaverGenerated[i].delete();
                                        }
                                }
                        }
+                       if (buildConfig != null && buildConfig.getCompilationResultDestinationManager() != null) {
+                               buildConfig.getCompilationResultDestinationManager().reportClassFileRemove(locationOnDisk.getPath());
+                       }
                        locationOnDisk.delete();
                }
        }