From d75bd040745be26d5557c378be64696e97e680fa Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 6 Jul 2010 19:16:34 +0000 Subject: [PATCH] 318884: incremental: classes --- .../ajdt/internal/core/builder/AjState.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) 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 e2bb43a9e..ec69a49eb 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 @@ -64,8 +64,6 @@ import org.aspectj.weaver.bcel.UnwovenClassFile; */ public class AjState implements CompilerConfigurationChangeFlags { - // --- static state, no need to write out - // SECRETAPI configures whether we use state instead of lastModTime - see pr245566 public static boolean CHECK_STATE_FIRST = true; @@ -84,8 +82,7 @@ public class AjState implements CompilerConfigurationChangeFlags { private static final char[][] EMPTY_CHAR_ARRAY = new char[0][]; - // --- non static, but transient state - no need to write out, doesn't need reinitializing - + // now follows non static, but transient state - no need to write out, doesn't need reinitializing // State recreated for each build: /** @@ -108,45 +105,37 @@ public class AjState implements CompilerConfigurationChangeFlags { // For a particular build run, this set records the changes to classesFromName public final Set deltaAddedClasses = new HashSet(); - // --- non static, but transient state - no need to write out, DOES need reinitializing when read AjState instance reloaded + // now follows non static, but transient state - no need to write out, DOES need reinitializing when read AjState instance + // reloaded private final AjBuildManager buildManager; - private INameEnvironment nameEnvironment; - // --- normal state that must be written out + // now follows normal state that must be written out private boolean couldBeSubsequentIncrementalBuild = false; private boolean batchBuildRequiredThisTime = false; private AjBuildConfig buildConfig; - private long lastSuccessfulFullBuildTime = -1; private final Hashtable structuralChangesSinceLastFullBuild = new Hashtable(); - private long lastSuccessfulBuildTime = -1; private long currentBuildTime = -1; - private AsmManager structureModel; /** - * Keeps a list of (FQN,Filename) pairs (as ClassFile objects) for types that resulted from the compilation of the given File. - * Note :- the ClassFile objects contain no byte code, they are simply a Filename,typename pair. - * - * Populated in noteResult and used in addDependentsOf(File) + * For a given source file, records the ClassFiles (which contain a fully qualified name and a file name) that were created when + * the source file was compiled. Populated in noteResult and used in addDependentsOf(File) */ private final Map> fullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap>(); /** - * Source files defining aspects - * - * Populated in noteResult and used in processDeletedFiles + * Source files defining aspects Populated in noteResult and used in processDeletedFiles */ private final Set sourceFilesDefiningAspects = new HashSet(); /** * Populated in noteResult to record the set of types that should be recompiled if the given file is modified or deleted. - * - * Refered to during addAffectedSourceFiles when calculating incremental compilation set. + * Referred to during addAffectedSourceFiles when calculating incremental compilation set. */ private final Map references = new HashMap(); @@ -1378,12 +1367,17 @@ public class AjState implements CompilerConfigurationChangeFlags { UnwovenClassFile[] unwovenClassFiles) { List classFiles = this.fullyQualifiedTypeNamesResultingFromCompilationUnit.get(sourceFile); if (classFiles != null) { + for (int i = 0; i < unwovenClassFiles.length; i++) { // deleting also deletes types from the weaver... don't do this if they are // still present this time around... removeFromClassFilesIfPresent(unwovenClassFiles[i].getClassName(), classFiles); } for (ClassFile cf : classFiles) { + recordTypeChanged(cf.fullyQualifiedTypeName); + resolvedTypeStructuresFromLastBuild.remove(cf.fullyQualifiedTypeName); + // } + // for (ClassFile cf : classFiles) { deleteClassFile(cf); } } @@ -2048,6 +2042,12 @@ public class AjState implements CompilerConfigurationChangeFlags { this.locationOnDisk = location; } + public String toString() { + StringBuilder s = new StringBuilder(); + s.append("ClassFile(type=").append(fullyQualifiedTypeName).append(",location=").append(locationOnDisk).append(")"); + return s.toString(); + } + public void deleteFromFileSystem(AjBuildConfig buildConfig) { String namePrefix = locationOnDisk.getName(); namePrefix = namePrefix.substring(0, namePrefix.lastIndexOf('.')); -- 2.39.5