From 89eb98064b3c992f855337381fe7f0e3277cd6bf Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 4 Sep 2008 19:08:10 +0000 Subject: [PATCH] chewed by formatter --- asm/src/org/aspectj/asm/AsmManager.java | 63 +++++++--------- asm/src/org/aspectj/asm/IRelationship.java | 74 +++++++++---------- .../aspectj/asm/internal/CharOperation.java | 40 ++++------ asm/src/org/aspectj/asm/overview.html | 16 ---- 4 files changed, 74 insertions(+), 119 deletions(-) delete mode 100644 asm/src/org/aspectj/asm/overview.html diff --git a/asm/src/org/aspectj/asm/AsmManager.java b/asm/src/org/aspectj/asm/AsmManager.java index 5f47f958b..2d51f6358 100644 --- a/asm/src/org/aspectj/asm/AsmManager.java +++ b/asm/src/org/aspectj/asm/AsmManager.java @@ -50,24 +50,11 @@ import org.aspectj.bridge.ISourceLocation; */ public class AsmManager { - /** - * @deprecated use getDefault() method instead - */ - private static AsmManager INSTANCE = new AsmManager(); + private static AsmManager instance = new AsmManager(); private IElementHandleProvider handleProvider; private List structureListeners = new ArrayList(); - // private boolean shouldSaveModel = true; - - public void setRelationshipMap(IRelationshipMap irm) { - mapper = irm; - } - - public void setHierarchy(IHierarchy ih) { - hierarchy = ih; - } - // The model is 'manipulated' by the AjBuildManager.setupModel() code which trashes all the // fields when setting up a new model for a batch build. // Due to the requirements of incremental compilation we need to tie some of the info @@ -90,6 +77,9 @@ public class AsmManager { private static boolean reporting = false; private static boolean completingTypeBindings = false; + private CanonicalFilePathMap canonicalFilePathMap = new CanonicalFilePathMap(); + // Record the Set for which the model has been modified during the last incremental build + private Set lastBuildChanges = new HashSet(); // static { // setReporting("c:/model.nfo",true,true,true,true); @@ -113,7 +103,7 @@ public class AsmManager { } public static AsmManager getDefault() { - return INSTANCE; + return instance; } public IRelationshipMap getRelationshipMap() { @@ -207,9 +197,6 @@ public class AsmManager { this.handleProvider = handleProvider; } - /** - * Fails silently. - */ public void writeStructureModel(String configFilePath) { try { String filePath = genExternFilePath(configFilePath); @@ -228,7 +215,6 @@ public class AsmManager { } /** - * @todo add proper handling of bad paths/suffixes/etc * @param configFilePath path to an ".lst" file */ public void readStructureModel(String configFilePath) { @@ -272,29 +258,10 @@ public class AsmManager { return configFilePath + ".ajsym"; } - // public void setShouldSaveModel(boolean shouldSaveModel) { - // this.shouldSaveModel = shouldSaveModel; - // } - - // ==== implementation of canonical file path map and accessors ============== - - // a more sophisticated optimisation is left here commented out as the - // performance gains don't justify the disturbance this close to a release... - // can't call prepareForWeave until preparedForCompilation has completed... - // public synchronized void prepareForCompilation(List files) { - // canonicalFilePathMap.prepopulate(files); - // } - // - // public synchronized void prepareForWeave() { - // canonicalFilePathMap.handover(); - // } - public String getCanonicalFilePath(File f) { return canonicalFilePathMap.get(f); } - private CanonicalFilePathMap canonicalFilePathMap = new CanonicalFilePathMap(); - private static class CanonicalFilePathMap { private static final int MAX_SIZE = 4000; @@ -558,6 +525,7 @@ public class AsmManager { fw.write("Deleting " + progElem + " node for file " + fileForCompilation + "\n"); } removeNode(progElem); + lastBuildChanges.add(fileForCompilation); deletedNodes.add(getCanonicalFilePath(progElem.getSourceLocation().getSourceFile())); if (!model.removeFromFileMap(correctedPath)) throw new RuntimeException("Whilst repairing model, couldn't remove entry for file: " + correctedPath @@ -1169,4 +1137,23 @@ public class AsmManager { return completingTypeBindings; } + public void setRelationshipMap(IRelationshipMap irm) { + mapper = irm; + } + + public void setHierarchy(IHierarchy ih) { + hierarchy = ih; + } + + public void resetDeltaProcessing() { + lastBuildChanges.clear(); + } + + /** + * @return the Set of files for which the structure model was modified (they may have been removed or otherwise rebuilt) + */ + public Set getModelChangesOnLastBuild() { + return lastBuildChanges; + } + } diff --git a/asm/src/org/aspectj/asm/IRelationship.java b/asm/src/org/aspectj/asm/IRelationship.java index b8c06a567..d71a5f2b7 100644 --- a/asm/src/org/aspectj/asm/IRelationship.java +++ b/asm/src/org/aspectj/asm/IRelationship.java @@ -11,7 +11,8 @@ * ******************************************************************/ package org.aspectj.asm; -import java.io.*; +import java.io.ObjectStreamException; +import java.io.Serializable; import java.util.List; /** @@ -20,64 +21,61 @@ import java.util.List; public interface IRelationship extends Serializable { public String getName(); - - public List/*String*/ getTargets(); - + + public List/* String */getTargets(); + public String getSourceHandle(); - + public void addTarget(String handle); - + public Kind getKind(); - + public boolean hasRuntimeTest(); - + + public boolean isAffects(); + public static class Kind implements Serializable { // typesafe enum - + private static final long serialVersionUID = -2691351740214705220L; - - public static final Kind DECLARE_WARNING = new Kind("declare warning"); - public static final Kind DECLARE_ERROR = new Kind("declare error"); - public static final Kind ADVICE_AROUND = new Kind("around advice"); + + public static final Kind DECLARE_WARNING = new Kind("declare warning"); + public static final Kind DECLARE_ERROR = new Kind("declare error"); + public static final Kind ADVICE_AROUND = new Kind("around advice"); public static final Kind ADVICE_AFTERRETURNING = new Kind("after returning advice"); - public static final Kind ADVICE_AFTERTHROWING = new Kind("after throwing advice"); - public static final Kind ADVICE_AFTER = new Kind("after advice"); - public static final Kind ADVICE_BEFORE = new Kind("before advice"); - public static final Kind ADVICE = new Kind("advice"); - public static final Kind DECLARE = new Kind("declare"); - public static final Kind DECLARE_INTER_TYPE = new Kind("inter-type declaration"); - public static final Kind USES_POINTCUT = new Kind("uses pointcut"); - public static final Kind DECLARE_SOFT = new Kind("declare soft"); - - public static final Kind[] ALL = { - DECLARE_WARNING, DECLARE_ERROR, - ADVICE_AROUND,ADVICE_AFTERRETURNING,ADVICE_AFTERTHROWING,ADVICE_AFTER,ADVICE_BEFORE, - ADVICE, DECLARE, DECLARE_INTER_TYPE, USES_POINTCUT, DECLARE_SOFT }; - + public static final Kind ADVICE_AFTERTHROWING = new Kind("after throwing advice"); + public static final Kind ADVICE_AFTER = new Kind("after advice"); + public static final Kind ADVICE_BEFORE = new Kind("before advice"); + public static final Kind ADVICE = new Kind("advice"); + public static final Kind DECLARE = new Kind("declare"); + public static final Kind DECLARE_INTER_TYPE = new Kind("inter-type declaration"); + public static final Kind USES_POINTCUT = new Kind("uses pointcut"); + public static final Kind DECLARE_SOFT = new Kind("declare soft"); + + public static final Kind[] ALL = { DECLARE_WARNING, DECLARE_ERROR, ADVICE_AROUND, ADVICE_AFTERRETURNING, + ADVICE_AFTERTHROWING, ADVICE_AFTER, ADVICE_BEFORE, ADVICE, DECLARE, DECLARE_INTER_TYPE, USES_POINTCUT, DECLARE_SOFT }; + private final String name; - + public boolean isDeclareKind() { - return this == DECLARE_WARNING - || this == DECLARE_ERROR - || this == DECLARE - || this == DECLARE_INTER_TYPE - || this == DECLARE_SOFT; + return this == DECLARE_WARNING || this == DECLARE_ERROR || this == DECLARE || this == DECLARE_INTER_TYPE + || this == DECLARE_SOFT; } - + private Kind(String name) { - this.name = name; + this.name = name; } - + public String toString() { return name; - } + } // The 4 declarations below are necessary for serialization private static int nextOrdinal = 0; private final int ordinal = nextOrdinal++; + private Object readResolve() throws ObjectStreamException { return ALL[ordinal]; } } - public boolean isAffects(); } diff --git a/asm/src/org/aspectj/asm/internal/CharOperation.java b/asm/src/org/aspectj/asm/internal/CharOperation.java index 6432c3a88..71ae5cafe 100644 --- a/asm/src/org/aspectj/asm/internal/CharOperation.java +++ b/asm/src/org/aspectj/asm/internal/CharOperation.java @@ -10,16 +10,15 @@ *******************************************************************/ package org.aspectj.asm.internal; - /** * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation - * + * */ public class CharOperation { - + /** * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation - */ + */ public static final char[] subarray(char[] array, int start, int end) { if (end == -1) end = array.length; @@ -34,40 +33,30 @@ public class CharOperation { System.arraycopy(array, start, result, 0, end - start); return result; } - + /** * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation - */ + */ public static final int lastIndexOf(char toBeFound, char[] array) { for (int i = array.length; --i >= 0;) if (toBeFound == array[i]) return i; return -1; } - -// /** -// * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation -// */ -// public static final boolean contains(char character, char[] array) { -// for (int i = array.length; --i >= 0;) -// if (array[i] == character) -// return true; -// return false; -// } /** * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation - */ + */ public static final int indexOf(char toBeFound, char[] array) { for (int i = 0; i < array.length; i++) if (toBeFound == array[i]) return i; return -1; } - + /** * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation - */ + */ public static final char[] concat(char[] first, char[] second) { if (first == null) return second; @@ -81,10 +70,10 @@ public class CharOperation { System.arraycopy(second, 0, result, length1, length2); return result; } - + /** * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation - */ + */ public static final boolean equals(char[] first, char[] second) { if (first == second) return true; @@ -98,14 +87,11 @@ public class CharOperation { return false; return true; } - + /** * Taken from org.aspectj.org.eclipse.jdt.core.compiler.CharOperation - */ - public static final void replace( - char[] array, - char toBeReplaced, - char replacementChar) { + */ + public static final void replace(char[] array, char toBeReplaced, char replacementChar) { if (toBeReplaced != replacementChar) { for (int i = 0, max = array.length; i < max; i++) { if (array[i] == toBeReplaced) diff --git a/asm/src/org/aspectj/asm/overview.html b/asm/src/org/aspectj/asm/overview.html deleted file mode 100644 index 3c5f61411..000000000 --- a/asm/src/org/aspectj/asm/overview.html +++ /dev/null @@ -1,16 +0,0 @@ -

-

-

Notes on using the Abstract Structure Model (ASM)

- -- 2.39.5