]> source.dussan.org Git - aspectj.git/commitdiff
removing unused code
authoraclement <aclement>
Sun, 31 Aug 2008 20:26:57 +0000 (20:26 +0000)
committeraclement <aclement>
Sun, 31 Aug 2008 20:26:57 +0000 (20:26 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java

index 0e51ceecc2af742cd12c754e48f8f8f93b4df904..fb270f5b57b572ebd77535b17df6cb4407178616 100644 (file)
@@ -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);
index 1cc4d57d1ba261cca8d2b60f0e493f1356f78dad..c4617814d1270f8481c59e5be32775913888d5db 100644 (file)
@@ -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;
index 8365422357714254f56a86eb7b076502635f14fb..dcb9f39bf24776af7ef976680d7e494dbc3da2bc 100644 (file)
@@ -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);
                        }
+                       // }
                }
        }
 
index f1df1d0287e0f3374c01d6394b051076db99f5c0..853ab12130619d2a0d478b18d7f59b301378c538 100644 (file)
@@ -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());
index 18c0ce42e0db95718adc1c6ca5e2563d287eea24..581cdcd1f6b612f1ffc5c9ba35bd4fc201ce6d41 100644 (file)
@@ -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);