]> source.dussan.org Git - aspectj.git/commitdiff
removed unnecessary code and unused casts
authoraclement <aclement>
Tue, 26 Aug 2008 22:37:55 +0000 (22:37 +0000)
committeraclement <aclement>
Tue, 26 Aug 2008 22:37:55 +0000 (22:37 +0000)
asm/src/org/aspectj/asm/AsmManager.java
asm/src/org/aspectj/asm/internal/ProgramElement.java

index 122f8cc6ca5de27a37d4fcd92d4f00ddd2a40110..f32e9c1bbb57936f85f472119514c1e6ed7aa8ac 100644 (file)
@@ -140,7 +140,7 @@ public class AsmManager {
         if (node == IHierarchy.NO_STRUCTURE) {
             return null;
         } else {
-            IProgramElement fileNode = (IProgramElement)node;
+            IProgramElement fileNode = node;
             ArrayList peNodes = new ArrayList();
             getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType);
             for (Iterator it = peNodes.iterator(); it.hasNext(); ) {
@@ -174,7 +174,7 @@ public class AsmManager {
                && rels.size() > 0) {
                 result.add(next);
             }
-            getAllStructureChildren((IProgramElement)next, result, showSubMember, showMemberAndType);
+            getAllStructureChildren(next, result, showSubMember, showMemberAndType);
         }
     }
 
@@ -561,7 +561,7 @@ public class AsmManager {
                                removeNode(progElem);
                                deletedNodes.add(getCanonicalFilePath(progElem.getSourceLocation().getSourceFile()));
                                if (!model.removeFromFileMap(correctedPath)) 
-                                               throw new RuntimeException("Whilst repairing model, couldn't remove entry for file: "+correctedPath.toString()+" from the filemap");
+                                               throw new RuntimeException("Whilst repairing model, couldn't remove entry for file: "+correctedPath+" from the filemap");
                                modelModified = true;
                        } 
                }
@@ -569,11 +569,6 @@ public class AsmManager {
                return modelModified;
        }
        
-       private void flushModelCache() {
-               IHierarchy model = AsmManager.getDefault().getHierarchy();
-               model.flushTypeMap();           
-       }
-       
        // This code is *SLOW* but it isnt worth fixing until we address the
        // bugs in binary weaving.
        public void fixupStructureModel(Writer fw,List filesToBeCompiled,Set files_added,Set files_deleted) throws IOException {
@@ -603,7 +598,7 @@ public class AsmManager {
                                removeNode(progElem);
                                deletedNodes.add(getCanonicalFilePath(progElem.getSourceLocation().getSourceFile()));
                                if (!model.removeFromFileMap(correctedPath)) 
-                                               throw new RuntimeException("Whilst repairing model, couldn't remove entry for file: "+correctedPath.toString()+" from the filemap");
+                                               throw new RuntimeException("Whilst repairing model, couldn't remove entry for file: "+correctedPath+" from the filemap");
                                modelModified = true;
                        } 
                }
@@ -631,22 +626,16 @@ public class AsmManager {
                        
                        long stime = System.currentTimeMillis();
                        
-                       boolean modificationOccurred = false;
-                       
                        //fixupStructureModel(fw,filesToBeCompiled,files_added,files_deleted);
                        // Let's remove all the files that are deleted on this compile
-                       modificationOccurred = 
-                               removeStructureModelForFiles(fw,files_deleted) | 
-                               modificationOccurred;
+                       removeStructureModelForFiles(fw,files_deleted);
                        long etime1 = System.currentTimeMillis(); // etime1-stime = time to fix up the model
                
                        repairRelationships(fw);        
                        long etime2 = System.currentTimeMillis(); // etime2-stime = time to repair the relationship map
                        
-                       modificationOccurred = 
-                               removeStructureModelForFiles(fw,files_tobecompiled) | 
-                               modificationOccurred;
-                       
+                       removeStructureModelForFiles(fw,files_tobecompiled);
+
                        if (dumpDeltaProcessing) {
                                fw.write("===== Delta Processing timing ==========\n");
                                fw.write("Hierarchy="+(etime1-stime)+"ms   Relationshipmap="+(etime2-etime1)+"ms\n");
index c3b25056443f0d491bbce24b47e49cf8e4e31d03..d926dfc5e8b0427334f849158b76b629d5e39979 100644 (file)
@@ -17,7 +17,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -37,19 +36,19 @@ public class ProgramElement implements IProgramElement {
        public static boolean shortITDNames = true;
        
        private final static String UNDEFINED = "<undefined>";
-       private static int AccPublic = 0x0001;
-       private static int AccPrivate = 0x0002;
-       private static int AccProtected = 0x0004;
-       private static int AccPrivileged = 0x0006;  // XXX is this right?
-       private static int AccStatic = 0x0008;
-       private static int AccFinal = 0x0010;
-       private static int AccSynchronized = 0x0020;
-       private static int AccVolatile = 0x0040;
-       private static int AccTransient = 0x0080;
-       private static int AccNative = 0x0100;
-       private static int AccInterface = 0x0200;
-       private static int AccAbstract = 0x0400;
-       private static int AccStrictfp = 0x0800;
+       private final static int AccPublic = 0x0001;
+       private final static int AccPrivate = 0x0002;
+       private final static int AccProtected = 0x0004;
+       private final static int AccPrivileged = 0x0006;  // XXX is this right?
+       private final static int AccStatic = 0x0008;
+       private final static int AccFinal = 0x0010;
+       private final static int AccSynchronized = 0x0020;
+       private final static int AccVolatile = 0x0040;
+       private final static int AccTransient = 0x0080;
+       private final static int AccNative = 0x0100;
+       private final static int AccInterface = 0x0200;
+       private final static int AccAbstract = 0x0400;
+       private final static int AccStrictfp = 0x0800;
        
        protected String name;
        private Kind kind;
@@ -137,7 +136,7 @@ public class ProgramElement implements IProgramElement {
                if (getParent() == null) {
                        return "";
                }
-               return ((IProgramElement)getParent()).getPackageName();
+               return getParent().getPackageName();
        }
 
        public Kind getKind() {
@@ -559,17 +558,6 @@ public class ProgramElement implements IProgramElement {
                }
        }
        
-       /** AMC added to speed up findByHandle lookups in AspectJElementHierarchy */
-       private void cacheByHandle() {
-               String handle = getHandleIdentifier();
-               if (handle != null) {
-                       AspectJElementHierarchy hierarchy = (AspectJElementHierarchy) 
-                               AsmManager.getDefault().getHierarchy();
-                       hierarchy.cache(handle,this);
-                       //System.err.println("Cache size now "+hierarchy.handleMap.size());
-               }
-       }
-
        public void setExtraInfo(ExtraInformation info) { 
                if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap();
                kvpairs.put("ExtraInformation",info);