From: aclement Date: Sun, 31 Aug 2008 20:26:57 +0000 (+0000) Subject: removing unused code X-Git-Tag: V1_6_2~129 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd8aebb985420425a95e163b814cc03bd997f042;p=aspectj.git removing unused code --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java index 0e51ceecc..fb270f5b5 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java @@ -116,18 +116,18 @@ public class BuildArgParser extends Main { } /** - * Generate build configuration for the input args, passing to handler any error messages. + * Generate build configuration for the input arguments, passing to handler any error messages. * * @param args the String[] arguments for the build configuration * @param setClasspath determines if the classpath should be parsed and set on the build configuration * @param configFile can be null - * @return AjBuildConfig per args, which will be invalid unless there are no handler errors. + * @return AjBuildConfig per arguments, which will be invalid unless there are no handler errors. */ public AjBuildConfig populateBuildConfig(AjBuildConfig buildConfig, String[] args, boolean setClasspath, File configFile) { Dump.saveCommandLine(args); buildConfig.setConfigFile(configFile); try { - // sets filenames to be non-null in order to make sure that file paramters are ignored + // sets filenames to be non-null in order to make sure that file parameters are ignored super.filenames = new String[] { "" }; AjcConfigParser parser = new AjcConfigParser(buildConfig, handler); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java index 1cc4d57d1..c4617814d 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java @@ -200,9 +200,6 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { nonaspects.add(units[i]); } - if (units == null) - return; // what does this mean? - // ...and put them back together, aspects first int posn = 0; for (Iterator iter = aspects.iterator(); iter.hasNext();) { @@ -432,7 +429,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { } } ensureWeaverInitialized(); // by doing this only once, are we saying needToReweaveWorld can't change once the aspects have - // been stuffed into the weaver? + // been stuffed into the weaver? if (weaver.needToReweaveWorld() && !isBatchCompile) return true; weaver.weave(new WeaverAdapter(this, weaverMessageHandler, progressListener)); @@ -560,8 +557,8 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { for (int index = 0; index < declaration.annotations.length; index++) { TypeDeclaration .resolveAnnotations(declaration.staticInitializerScope, declaration.annotations, declaration.binding); // force - // annotation - // resolution + // annotation + // resolution Annotation a = declaration.annotations[index]; if (a.resolvedType == null) continue; // another problem is being reported, so don't crash here @@ -590,7 +587,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { return (String) pipelineOutput.get(key); } - private final boolean debugPipeline = false; + private final static boolean debugPipeline = false; public List getResultsPendingWeave() { return resultsPendingWeave; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java index 836542235..dcb9f39bf 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java @@ -63,9 +63,6 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { private AjCompilerOptions options; - /** if true, then global values override local when joining */ - private boolean override = true; - // incremental variants handled by the compiler client, but parsed here private boolean incrementalMode; private File incrementalFile; @@ -411,15 +408,21 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { } } + /** + * Join some global options into a local set of options - globals will override locals. + * + * @param local + * @param global + */ void join(Map local, Map global) { for (Iterator iter = global.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); - if (override || (null == local.get(key))) { // - Object value = global.get(key); - if (null != value) { - local.put(key, value); - } + // if (override || (null == local.get(key))) { // + Object value = global.get(key); + if (null != value) { + local.put(key, value); } + // } } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index f1df1d028..853ab1213 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -176,38 +176,42 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } public boolean batchBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler) throws IOException, AbortException { - return doBuild(buildConfig, baseHandler, true); + return performBuild(buildConfig, baseHandler, true); } public boolean incrementalBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler) throws IOException, AbortException { - return doBuild(buildConfig, baseHandler, false); + return performBuild(buildConfig, baseHandler, false); } - /** @throws AbortException if check for runtime fails */ - protected boolean doBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler, boolean batch) throws IOException, + /** + * Perform a build. + * + * @return true if the build was successful (ie. no errors) + */ + private boolean performBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler, boolean isFullBuild) throws IOException, AbortException { boolean ret = true; - batchCompile = batch; - wasFullBuild = batch; + batchCompile = isFullBuild; + wasFullBuild = isFullBuild; if (baseHandler instanceof ILifecycleAware) { - ((ILifecycleAware) baseHandler).buildStarting(!batch); + ((ILifecycleAware) baseHandler).buildStarting(!isFullBuild); } CompilationAndWeavingContext.reset(); - int phase = batch ? CompilationAndWeavingContext.BATCH_BUILD : CompilationAndWeavingContext.INCREMENTAL_BUILD; + int phase = isFullBuild ? CompilationAndWeavingContext.BATCH_BUILD : CompilationAndWeavingContext.INCREMENTAL_BUILD; ContextToken ct = CompilationAndWeavingContext.enteringPhase(phase, buildConfig); try { - if (batch) { + if (isFullBuild) { this.state = new AjState(this); } this.state.setCouldBeSubsequentIncrementalBuild(this.environmentSupportsIncrementalCompilation); boolean canIncremental = state.prepareForNextBuild(buildConfig); - if (!canIncremental && !batch) { // retry as batch? + if (!canIncremental && !isFullBuild) { // retry as batch? CompilationAndWeavingContext.leavingPhase(ct); if (state.listenerDefined()) state.getListener().recordDecision("Falling back to batch compilation"); - return doBuild(buildConfig, baseHandler, true); + return performBuild(buildConfig, baseHandler, true); } this.handler = CountingMessageHandler.makeCountingMessageHandler(baseHandler); @@ -229,14 +233,15 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour // if (batch) { setBuildConfig(buildConfig); // } - if (batch || !AsmManager.attemptIncrementalModelRepairs) { + if (isFullBuild || !AsmManager.attemptIncrementalModelRepairs) { // if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) { setupModel(buildConfig); // } } - if (batch) { + if (isFullBuild) { initBcelWorld(handler); } + if (handler.hasErrors()) { CompilationAndWeavingContext.leavingPhase(ct); return false; @@ -249,7 +254,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } } - if (batch) { + if (isFullBuild) { // System.err.println("XXXX batch: " + buildConfig.getFiles()); if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) { getWorld().setModel(AsmManager.getDefault().getHierarchy()); @@ -334,12 +339,12 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } // have to tell state we succeeded or next is not incremental - state.successfulCompile(buildConfig, batch); + state.successfulCompile(buildConfig, isFullBuild); // For a full compile, copy resources to the destination // - they should not get deleted on incremental and AJDT // will handle changes to them that require a recopying - if (batch) { + if (isFullBuild) { copyResourcesToDestination(); } @@ -358,7 +363,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } finally { if (baseHandler instanceof ILifecycleAware) { - ((ILifecycleAware) baseHandler).buildFinished(!batch); + ((ILifecycleAware) baseHandler).buildFinished(!isFullBuild); } if (zos != null) { closeOutputStream(buildConfig.getOutputJar()); 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 18c0ce42e..581cdcd1f 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 @@ -57,10 +57,6 @@ import org.aspectj.weaver.bcel.UnwovenClassFile; /** * Maintains state needed for incremental compilation - * - * tests: two ajdt projects, aspect is changed in dependent, does dependee do a full build? (could just do it if on aspect path but - * lets just do it for all now) - * */ public class AjState implements CompilerConfigurationChangeFlags { @@ -256,8 +252,9 @@ public class AjState implements CompilerConfigurationChangeFlags { // coming - otherwise a file that has been deleted from an inpath jar // since the last build will not be deleted from the output directory. removeAllResultsOfLastBuild(); - if (stateListener != null) + if (stateListener != null) { stateListener.pathChangeDetected(); + } structuralChangesSinceLastFullBuild.clear(); if (listenerDefined()) getListener() @@ -321,8 +318,9 @@ public class AjState implements CompilerConfigurationChangeFlags { File aDeletedFile = (File) iter.next(); if (this.sourceFilesDefiningAspects.contains(aDeletedFile)) { removeAllResultsOfLastBuild(); - if (stateListener != null) + if (stateListener != null) { stateListener.detectedAspectDeleted(aDeletedFile); + } return false; } List/* ClassFile */classes = (List) fullyQualifiedTypeNamesResultingFromCompilationUnit.get(aDeletedFile);