From c4caaab16d00e459bbdb31157dfaf33cd135a11a Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 20 Mar 2009 17:37:24 +0000 Subject: [PATCH] 268827: tell ajdt about class file removal --- .../CompilationResultDestinationManager.java | 7 +++++++ .../ajdt/internal/core/builder/AjState.java | 18 +++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java index a49e03f14..39f8aeaf8 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java @@ -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); + } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java index 7ef71b36b..0bc693674 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -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(); } } -- 2.39.5