]> source.dussan.org Git - aspectj.git/commitdiff
Minor improvements to structure model generation, clean up of test suite output,...
authormkersten <mkersten>
Tue, 12 Aug 2003 10:29:59 +0000 (10:29 +0000)
committermkersten <mkersten>
Tue, 12 Aug 2003 10:29:59 +0000 (10:29 +0000)
27 files changed:
ajde/src/org/aspectj/ajde/Ajde.java
ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java
ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java
ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java
ajde/testdata/examples/coverage/ModelCoverage.java
ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java
ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java
ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java
ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java
ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java
ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java
ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java
ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java
ajde/testsrc/org/aspectj/ajde/StructureModelTest.java
ajde/testsrc/org/aspectj/ajde/VersionTest.java
ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java
ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java
ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.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/EmacsStructureModelManager.java
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java
weaver/src/org/aspectj/weaver/AsmAdapter.java

index f75e3de8205dde3cbd32f89812702716bb5a568f..032ad6e59da0972b42bf3fde54ab5bc201964873 100644 (file)
@@ -20,7 +20,7 @@ import org.aspectj.ajde.ui.IdeUIAdapter;
 import org.aspectj.ajde.ui.StructureSearchManager;
 import org.aspectj.ajde.ui.StructureViewManager;
 import org.aspectj.ajde.ui.StructureViewNodeFactory;
-import org.aspectj.asm.StructureModelManager;
+import org.aspectj.asm.AsmManager;
 import org.aspectj.bridge.Version;
 import org.aspectj.util.LangUtil;
 import org.aspectj.util.Reflection;
@@ -175,8 +175,8 @@ public class Ajde {
         * use should be avoided.  Used <CODE>getStructureViewManager()</CODE>
         * instead.
         */
-       public StructureModelManager getStructureModelManager() {
-               return StructureModelManager.getDefault();      
+       public AsmManager getStructureModelManager() {
+               return AsmManager.getDefault(); 
        }
        
        public void logEvent(String message) {
@@ -307,7 +307,7 @@ public class Ajde {
         public void compileFinished(String buildConfig, int buildTime, boolean succeeded, boolean warnings) { 
                String configFilePath = projectProperties.getDefaultBuildConfigFile();
                if (!succeeded) {
-                       StructureModelManager.getDefault().fireModelUpdated();  
+                       AsmManager.getDefault().fireModelUpdated();     
            }
         }
         
index fdd00fb762d089cf2ef4814f34228f9f06bd4153..c5fe1d5b9e37298a7ac99cd0f9fc97bee2dd7731 100644 (file)
 
 package org.aspectj.ajde.ui;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.aspectj.asm.StructureModel;
+import java.io.IOException;
+import java.util.*;
 
 /**
+ * TODO: we have schitzophrenia between BuildConfigNode(s) and IProgramElement(s), fix.
+ * 
  * @author Mik Kersten
  */
 public class BuildConfigModel {
@@ -104,6 +102,53 @@ public class BuildConfigModel {
        public void setRoot(BuildConfigNode node) {
                root = node;
        }
+       
+       public BuildConfigNode findNodeForSourceLine(String sourceFilePath, int lineNumber) {
+               BuildConfigNode node = findNodeForSourceLineHelper(root, sourceFilePath, lineNumber);
+               return node;    
+       }
+       
+       private BuildConfigNode findNodeForSourceLineHelper(BuildConfigNode node, String sourceFilePath, int lineNumber) {
+               if (matches(node, sourceFilePath, lineNumber) 
+                       && !hasMoreSpecificChild(node, sourceFilePath, lineNumber)) {
+                       return node;    
+               } 
+               
+               if (node != null && node.getChildren() != null) {
+                       for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+                               BuildConfigNode foundNode = findNodeForSourceLineHelper(
+                                       (BuildConfigNode)it.next(), 
+                                       sourceFilePath, 
+                                       lineNumber);            
+                               if (foundNode != null) return foundNode;
+                       }
+               }
+               return null;            
+       }
+
+       private boolean matches(BuildConfigNode node, String sourceFilePath, int lineNumber) {
+               try {                   
+                       return node != null 
+                               && node.getSourceLocation() != null
+                               && node.getSourceLocation().getSourceFile().getCanonicalPath().equals(sourceFilePath)
+                               && ((node.getSourceLocation().getLine() <= lineNumber
+                                       && node.getSourceLocation().getEndLine() >= lineNumber)
+                                       ||
+                                       (lineNumber <= 1
+                                        && node instanceof BuildConfigNode)    
+                               );
+               } catch (IOException ioe) { 
+                       return false;
+               } 
+       }
+       
+       private boolean hasMoreSpecificChild(BuildConfigNode node, String sourceFilePath, int lineNumber) {
+               for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+                       BuildConfigNode child = (BuildConfigNode)it.next();
+                       if (matches(child, sourceFilePath, lineNumber)) return true;
+               }
+               return false;
+       }
 
 }
 
index 0e12d5f7ce87cd9b947f684067e71513e2ff2617..ec0b44a9eb9a24a079b8bc88f5fb1c751236f6fd 100644 (file)
@@ -37,23 +37,23 @@ public class StructureModelUtil {
        public static Map getLinesToAspectMap(String sourceFilePath) {
 
                Map annotationsMap =
-                       StructureModelManager.getDefault().getInlineAnnotations(
+                       AsmManager.getDefault().getInlineAnnotations(
                                sourceFilePath,
                                true,
                                true);
 
                Map aspectMap = new HashMap();
                Set keys = annotationsMap.keySet();
-               for (Iterator it = keys.iterator(); it.hasNext();) {
-                       Object key = it.next();
-                       List annotations = (List) annotationsMap.get(key);
-                       for (Iterator it2 = annotations.iterator(); it2.hasNext();) {
-                               IProgramElement node = (IProgramElement) it2.next();
+//             for (Iterator it = keys.iterator(); it.hasNext();) {
+//                     Object key = it.next();
+//                     List annotations = (List) annotationsMap.get(key);
+//                     for (Iterator it2 = annotations.iterator(); it2.hasNext();) {
+//                             IProgramElement node = (IProgramElement) it2.next();
 
-                               List relations = node.getRelations();
-
-                               for (Iterator it3 = relations.iterator(); it3.hasNext();) {
-                                       IRelationship relationNode = (IRelationship) it3.next();
+//                             List relations = node.getRelations();
+//
+//                             for (Iterator it3 = relations.iterator(); it3.hasNext();) {
+//                                     IRelationship relationNode = (IRelationship) it3.next();
 
 //                                     if (relationNode.getKind().equals("Advice")) {
 //                                             List children = relationNode.getTargets();
@@ -83,10 +83,10 @@ public class StructureModelUtil {
 //                                                     aspectMap.put(key, aspects);
 //                                             }
 //                                     }
-
-                               }
-                       }
-               }
+//
+//                             }
+//                     }
+//             }
                return aspectMap;
        }
 
index 8acbbacbaa95666a4271ac3b16099123da640dce..7170001ba77dbccb173fb5cf1a34ee8a1e6590f2 100644 (file)
@@ -55,7 +55,7 @@ public class StructureViewManager {
        public StructureViewManager(StructureViewNodeFactory nodeFactory) {
                treeViewBuilder = new TreeStructureViewBuilder(nodeFactory);
                                
-               StructureModelManager.getDefault().addListener(VIEW_LISTENER);                  
+               AsmManager.getDefault().addListener(VIEW_LISTENER);                     
        }
        
        public void fireNavigateBackAction(StructureView view) {
@@ -127,7 +127,7 @@ public class StructureViewManager {
                        if (defaultFileView.getSourceFile() != null
                                && !defaultFileView.getSourceFile().equals(newFilePath)) {
                                defaultFileView.setSourceFile(newFilePath);
-                               treeViewBuilder.buildView(defaultFileView, StructureModelManager.getDefault().getModel());
+                               treeViewBuilder.buildView(defaultFileView, AsmManager.getDefault().getModel());
                        }
                }
                   
@@ -195,7 +195,7 @@ public class StructureViewManager {
                if (properties == null) properties = DEFAULT_VIEW_PROPERTIES;
                FileStructureView view = new FileStructureView(properties);
                view.setSourceFile(sourceFilePath);
-               treeViewBuilder.buildView(view, StructureModelManager.getDefault().getModel()); 
+               treeViewBuilder.buildView(view, AsmManager.getDefault().getModel()); 
                structureViews.add(view);
                return view; 
        }
index 1e41d675988e4b87a4b54b67cf55ca0581048988..2cb82282732791a516378c2aacd356951b18b187 100644 (file)
@@ -37,7 +37,7 @@ public abstract class StructureViewNodeFactory {
                AbstractIcon icon = iconRegistry.getStructureIcon(node.getKind(), node.getAccessibility());
 
                IStructureViewNode svNode = createDeclaration(node, icon, children);            
-               IRelationship rel = StructureModelManager.getDefault().getMapper().get(node);
+               IRelationship rel = AsmManager.getDefault().getMapper().get(node);
                if (rel != null && rel.getTargets().size() > 0) {
                        IStructureViewNode relNode = createRelationship(
                                rel, 
@@ -48,8 +48,8 @@ public abstract class StructureViewNodeFactory {
                        for (Iterator it = rel.getTargets().iterator(); it.hasNext(); ) {
                                IProgramElement link = (IProgramElement)it.next();
                                IStructureViewNode linkNode = createLink(
-                                       link, 
-                                       iconRegistry.getIcon(link.getKind())
+                                       link,   
+                                       iconRegistry.getStructureIcon(link.getKind(), link.getAccessibility())  
                                );      
                                relNode.add(linkNode);
                                        
index 06534507f18790339d6a5b712a94920037bfbf04..cdbd5a11d5c19a5188d715d17f4bbc4aea8f1574 100644 (file)
@@ -97,14 +97,14 @@ public class TreeStructureViewBuilder {
                if (node == null) return null;
                List children = new ArrayList();
 //             IProgramElement pNode = node;
-               if (node.getRelations() != null) {
-                       for (Iterator it = node.getRelations().iterator(); it.hasNext(); ) {
-                               IProgramElement IProgramElement = (IProgramElement)it.next();
-                               if (acceptNode(IProgramElement, properties)) {
-                                       children.add(createViewNode(IProgramElement, properties));
-                               }
-                       }       
-               }
+//             if (node.getRelations() != null) {
+//                     for (Iterator it = node.getRelations().iterator(); it.hasNext(); ) {
+//                             IProgramElement IProgramElement = (IProgramElement)it.next();
+//                             if (acceptNode(IProgramElement, properties)) {
+//                                     children.add(createViewNode(IProgramElement, properties));
+//                             }
+//                     }       
+//             }
                if (node.isRunnable() && node.getParent() != null) {
                        IProgramElement parent = node.getParent();
                        if (parent.getKind().equals(IProgramElement.Kind.CLASS)
@@ -166,7 +166,7 @@ public class TreeStructureViewBuilder {
                        IProgramElement pNode = (IProgramElement)node;
                        if (!acceptGranularity(pNode.getKind(), properties.getGranularity())) {
                                return false;
-                       } else if (pNode.isMemberKind()) {
+                       } else if (pNode.getKind().isMemberKind()) {
                                if (properties.getFilteredMemberAccessibility().contains(pNode.getAccessibility())) {
                                        return false;   
                                }
@@ -259,7 +259,7 @@ public class TreeStructureViewBuilder {
     private IStructureViewNode getInheritanceChildren(IProgramElement node, List associations) {
        IStructureViewNode treeNode = nodeFactory.createNode(node);
         //StructureViewNode treeNode = new StructureViewNodeAdapter(node);
-        List relations = ((IProgramElement)node).getRelations();
+//        List relations = ((IProgramElement)node).getRelations();
         throw new RuntimeException("unimplemented");
 //        if (relations != null) {
 //            for (Iterator it = relations.iterator(); it.hasNext(); ) {
@@ -282,8 +282,8 @@ public class TreeStructureViewBuilder {
 
     private IStructureViewNode getCrosscuttingChildren(IProgramElement node) {
         //StructureViewNodeAdapter treeNode = new StructureViewNodeAdapter(node);
-        IStructureViewNode treeNode = nodeFactory.createNode(node);
-        List relations = ((IProgramElement)node).getRelations();
+//        IStructureViewNode treeNode = nodeFactory.createNode(node);
+//        List relations = ((IProgramElement)node).getRelations();
         throw new RuntimeException("unimplemented");
 //        if (relations != null) {
 //            for (Iterator it = relations.iterator(); it.hasNext(); ) {
@@ -336,7 +336,7 @@ public class TreeStructureViewBuilder {
                     IProgramElement child = (IProgramElement)itt.next();
                     if (child instanceof IProgramElement) {
                         IProgramElement progNode = (IProgramElement)child;
-                        if (!progNode.isCode()) {
+                        if (progNode.getKind() != IProgramElement.Kind.CODE) {
                             childList.add(buildTree(child, associations));
                         }
                     } else {
index f119a452c9c3d9f8f3929f603f73cb5d8e6fce01..e5ed1b908083b1398477580dcc5d2758ced97f96 100644 (file)
@@ -112,7 +112,7 @@ public class IconRegistry extends AbstractIconRegistry {
                return convertToSwingIcon(getIcon(relation));   
     }
     
-       protected AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
+       public AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
                return getIcon(kind);   
        }
     
index d2d639beb0767a5555c8b2003fb960b7154cb107..cb7b8391bab741b4626498a2617376be3b64de5b 100644 (file)
@@ -13,7 +13,7 @@ class Point {
        public int getX() { return x;   }
        
        public void setX(int x) { this.x = x; }
-       
+        
        public int changeX(int x) { 
                this.x = x;
                return x;
@@ -94,6 +94,11 @@ abstract aspect AbstractAspect {
 }
   
 aspect InterTypeDecCoverage {
+    public int Point.xxx = 0;
+    public int Point.check(int i, Line l) { return 1 + i; }
+}
+
+aspect DeclareCoverage {
 
     pointcut illegalNewFigElt(): call(Point.new(..)) && !withincode(* *.doIt(..));
 
@@ -105,9 +110,6 @@ aspect InterTypeDecCoverage {
        declare parents: Point && Line implements java.util.Observable;
     declare soft: SizeException : call(* Point.getX());
        declare precedence: AdviceCoverage, InterTypeDecCoverage, *;
-
-       public int Point.xxx = 0;
-    public int Point.check(int i, Line l) { return 1 + i; }
 //     public Line.new(String s) {  }
 }
 
index 9e99b72217a7ec4c729b12292905ae310735621c..b0d854238a0ec7ab0f430d16cb31c0d4e4946ee7 100644 (file)
@@ -47,7 +47,7 @@ public class AsmDeclarationsTest extends AjdeTestCase {
                IProgramElement node = (IProgramElement)model.getRoot();
                assertNotNull(node);
        
-               IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage");
+               IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "DeclareCoverage");
                assertNotNull(aspect);
                
                String decErrMessage = "declare error: \"Illegal construct..\"";
@@ -90,7 +90,7 @@ public class AsmDeclarationsTest extends AjdeTestCase {
                IProgramElement node = (IProgramElement)model.getRoot();
                assertNotNull(node);
        
-               IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage");
+               IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage");
                assertNotNull(aspect);
                
                String fieldMsg = "Point.xxx";
@@ -114,7 +114,7 @@ public class AsmDeclarationsTest extends AjdeTestCase {
                IProgramElement node = (IProgramElement)model.getRoot();
                assertNotNull(node);
        
-               IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
+               IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
                assertNotNull(aspect);          
        
                String ptct = "named()";
@@ -134,7 +134,7 @@ public class AsmDeclarationsTest extends AjdeTestCase {
                IProgramElement node = (IProgramElement)model.getRoot();
                assertNotNull(node);
        
-               IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AbstractAspect");
+               IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AbstractAspect");
                assertNotNull(aspect);  
                
                String abst = "abPtct()";
@@ -147,7 +147,7 @@ public class AsmDeclarationsTest extends AjdeTestCase {
                IProgramElement node = (IProgramElement)model.getRoot();
                assertNotNull(node);
        
-               IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
+               IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
                assertNotNull(aspect);  
 
                String anon = "before(): <anonymous pointcut>";
@@ -189,7 +189,7 @@ public class AsmDeclarationsTest extends AjdeTestCase {
        protected void setUp() throws Exception {
                super.setUp("examples");
                assertTrue("build success", doSynchronousBuild(CONFIG_FILE_PATH));      
-               model = StructureModelManager.getDefault().getModel();
+               model = AsmManager.getDefault().getModel();
        }
 
        protected void tearDown() throws Exception {
index e50ee51cdda6be88b072995de7b9623f474ebb61..3714da143884b7a8f319ca54595e48a7fe993dc8 100644 (file)
@@ -14,29 +14,31 @@ package org.aspectj.ajde;
 import java.util.List;
 
 import org.aspectj.asm.*;
+import org.aspectj.asm.internal.ProgramElement;
 
 
 // TODO: check for return types
 public class AsmRelationshipsTest extends AjdeTestCase {
   
-       private StructureModelManager manager = null;
+       private AsmManager manager = null;
        private static final String CONFIG_FILE_PATH = "../examples/coverage/coverage.lst";
 
        public AsmRelationshipsTest(String name) {
                super(name);
        }
   
-       public void testAdvice() {
-               IProgramElement node = (IProgramElement)manager.getModel().getRoot();
-               assertNotNull(node);
-       
+//     public void testInterTypeDeclarations() {               
+//             checkMapping("InterTypeDecCoverage", "Point", "Point.xxx:", "xxx");     
+//     }
+
+       public void testAdvice() {      
                checkMapping("AdvisesRelationshipCoverage", "Point", "before(): methodExecutionP..", "setX(int)");
                checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): getP..", "field-get(int Point.x)");
                checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): setP..", "field-set(int Point.xxx)");     
        }
 
        private void checkUniDirectionalMapping(String fromType, String toType, String from, String to) {
-               IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, fromType);
+               IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType);
                assertNotNull(aspect);          
                String beforeExec = from;
                IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec);
@@ -46,7 +48,7 @@ public class AsmRelationshipsTest extends AjdeTestCase {
        }
 
        private void checkMapping(String fromType, String toType, String from, String to) {
-               IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, fromType);
+               IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType);
                assertNotNull(aspect);          
                String beforeExec = from;
                IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec);
@@ -54,7 +56,7 @@ public class AsmRelationshipsTest extends AjdeTestCase {
                IRelationship rel = manager.getMapper().get(beforeExecNode);
                assertEquals(((IProgramElement)rel.getTargets().get(0)).getName(), to);
 
-               IProgramElement clazz = StructureModelManager.getDefault().getModel().findNodeForType(null, toType);
+               IProgramElement clazz = AsmManager.getDefault().getModel().findNodeForType(null, toType);
                assertNotNull(clazz);
                String set = to;
                IProgramElement setNode = manager.getModel().findNode(clazz, IProgramElement.Kind.METHOD, set);
@@ -66,7 +68,7 @@ public class AsmRelationshipsTest extends AjdeTestCase {
        protected void setUp() throws Exception {
                super.setUp("examples");
                assertTrue("build success", doSynchronousBuild(CONFIG_FILE_PATH));      
-               manager =       StructureModelManager.getDefault();
+               manager = AsmManager.getDefault();
        }
 
        protected void tearDown() throws Exception {
index d6c7f10135fab45d48c5de8556d27e3d4f66abbb..b631642f85142930d0b88a5ff44429fdbeb8e3df 100644 (file)
@@ -479,8 +479,6 @@ public class BuildConfigurationTests extends AjdeTestCase {
                 null,
                 null,
                 null);  
-                
-            //Ajde.getDefault().enableLogging( System.out );
         } catch (Throwable t) {
             String s = "Unable to initialize AJDE "
                 + LangUtil.renderException(t);
index 35a8e74d46e4ed9f2d6cbc79db8781d2c6c01eb2..d2ccf2596a3e5f93b3b03e725fca035967699d1d 100644 (file)
@@ -15,15 +15,15 @@ package org.aspectj.ajde;
 public class NullIdeErrorHandler implements ErrorHandler {
 
        public void handleWarning(String message) {
-               System.out.println("NullIde warning: " + message);
+               System.out.println("NullIde> warning: " + message);
        }
 
        public void handleError(String message) {
-               System.out.println("NullIde error: " + message);
+               System.out.println("NullIde> error: " + message);
        }
 
        public void handleError(String message, Throwable t) {
-               System.out.println("NullIde error: " + message);
+               System.out.println("NullIde> error: " + message);
                t.printStackTrace(System.out);
        }
 }
index afd31cbebfb488c1e7eea7494cd78d8a20d3f0ad..2a761ca4740323b9d51519f1909a805b177eecf7 100644 (file)
@@ -15,7 +15,7 @@ package org.aspectj.ajde;
 public class NullIdeProgressMonitor implements BuildProgressMonitor {
 
        public void start(String configFile) {
-//             System.out.println("> compiling: " + configFile);
+               
        }
 
        public void setProgressText(String text) {
index 17e4f47227e40e8328c5524f7e6c82fa3ddc9b6b..199a763c33fb9f6e2b62730f02763db1238d5bbb 100644 (file)
@@ -45,11 +45,11 @@ public class NullIdeTaskListManager implements TaskListManager {
         }        
                /* Guard against null source locations e.g. JAR file messages */
                if (null != message.getSourceLocation()) {
-                       System.out.println("> added sourceline task: " + message + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath()
+                       System.out.println("NullIde> task: " + message.getMessage() + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath()
                                + ": " +  message.getSourceLocation().getLine());
                }
                else {
-                       System.out.println("> added sourceline task: " + message);
+                       System.out.println("NullIde> task: " + message);
                }
 
     }
index e31d021a7eb9525f7bdcee74811d656b1e857405..5d344e7540a7546718b81b8e047157e2425106e9 100644 (file)
@@ -18,7 +18,7 @@ import org.aspectj.ajde.ui.*;
 public class NullIdeUIAdapter implements IdeUIAdapter {
        
        public void displayStatusInformation(String message) {
-               System.out.println("NullIde> " + message);
+               System.out.println("NullIde>" + message);
        }
        
     public void resetGUI() {
index 8aa11f6686d15ec4d620a5d16fd334656ae5d21a..c7d23bf40ef1ae4f20b6864b95725c86b5bc7cfb 100644 (file)
@@ -141,7 +141,6 @@ public class ResourceCopyTestCase extends AjdeTestCase {
                                        /* Ensure we didn't copy any JAR manifests */
                                        if (fileName.toLowerCase().startsWith("meta-inf")) {
                                                byte[] outManifest = FileUtil.readAsByteArray(outjar);
-//                                             System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(outManifest) + "'");
                                                assertFalse("Manifest has been copied",Arrays.equals(inManifest,outManifest));
                                        }
                                        
@@ -206,7 +205,6 @@ public class ResourceCopyTestCase extends AjdeTestCase {
                                /* Ensure we didn't copy any JAR manifests */
                                if (fileName.toLowerCase().startsWith("meta-inf")) {
                                        byte[] outManifest = FileUtil.readAsByteArray(toResources[i]);
-//                                     System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(outManifest) + "'");
                                        assertFalse("Manifest has been copied",Arrays.equals(inManifest,outManifest));
                                }
                                boolean b = resources.remove(fileName);
@@ -244,7 +242,6 @@ public class ResourceCopyTestCase extends AjdeTestCase {
                                        /* JAR manifests shouldn't be copied */
                                        if (fileName.toLowerCase().startsWith("meta-inf")) {
                                                manifest = FileUtil.readAsByteArray(injar);
-//                                             System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(manifest) + "'");
                                        }
                                        else {
                                                resources.add(fileName);
index fa097c8dc9521fc2c0c740f13936f110fc52bbec..d7c1038aab2c1cd5e2c644d68aff318770b3acda 100644 (file)
@@ -46,13 +46,10 @@ public class StructureModelRegressionTest extends AjdeTestCase {
        public boolean verifyAgainstSavedModel(String lstFile) {
                File modelFile = new File(genStructureModelExternFilePath(lstFile));
                StructureModel model = getModelForFile(lstFile);
-               System.out.println(">> model: " + model.getRoot());     
                
                if (modelFile.exists()) {
                        Ajde.getDefault().getStructureModelManager().readStructureModel(lstFile);
                        StructureModel savedModel = Ajde.getDefault().getStructureModelManager().getModel();
-                       //System.err.println( savedModel.getRoot().getClass() + ", " +  savedModel.getRoot());
-                       
                        // AMC This test will not pass as written until IProgramElement defines
                        // equals. The equals loic is commented out in the IProgramElement
                        // class - adding it back in could have unforeseen system-wide
index 5777715cb701d369c9c7000e252d9c1f9ef0cd70..ba451fcfaaa8aedd192c38d4fc0ede4b26f7a843 100644 (file)
@@ -50,7 +50,6 @@ public class StructureModelTest extends AjdeTestCase {
 //             ProgramElementNode pNode = (ProgramElementNode)node;
 //             ProgramElementNode foundNode = null;
 //             final List list = pNode.getRelations();
-//             //System.err.println(">>>> " + pNode + ", " + list);
 //        assertNotNull("pNode.getRelations()", list);
 //             for (Iterator it = list.iterator(); it.hasNext(); ) {
 //                     RelationNode relation = (RelationNode)it.next();
@@ -88,10 +87,8 @@ public class StructureModelTest extends AjdeTestCase {
 
        public void testPointcutName() throws IOException {
                File testFile = openFile("figures-coverage/figures/Main.java"); 
-               //System.err.println("PointcutName, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists());
                IProgramElement node = Ajde.getDefault().getStructureModelManager().getModel().findRootNodeForSourceFile(
                        testFile.getCanonicalPath());
-               //System.err.println("   node: " + node);
                assertTrue("find result", node != null) ;       
                IProgramElement pNode = (IProgramElement)((IProgramElement)node).getChildren().get(1);
                IProgramElement pointcut = (IProgramElement)pNode.getChildren().get(0);
@@ -106,10 +103,8 @@ public class StructureModelTest extends AjdeTestCase {
 
        public void testFileNodeFind() throws IOException {
                File testFile = openFile("figures-coverage/figures/Main.java");
-               //System.err.println("NodeFind, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists());
                IProgramElement node = Ajde.getDefault().getStructureModelManager().getModel().findNodeForSourceLine(
                        testFile.getCanonicalPath(), 1);
-               //System.err.println("   node: " + node);
                assertTrue("find result", node != null) ;       
                assertEquals("find result has children", 2, node.getChildren().size()) ;        
                IProgramElement pNode = (IProgramElement)node;
index 6e861700538f884499d9785355c4e435985295ce..d6f42d420a7515db7ed6a1fb1e6e4bc1a715ec4a 100644 (file)
@@ -35,7 +35,6 @@ public class VersionTest extends AjdeTestCase {
        public void testVersionMatch() {
                String ajdeVersion = Ajde.getDefault().getVersion();
                String compilerVersion = Version.text;
-               System.out.println("> ajde version: " + ajdeVersion + " <-> compiler version: " + compilerVersion);
                assertTrue("version check", ajdeVersion.equals(compilerVersion));
        }
        
index 0a5b8c1a6e35a78d27d3dace5dd1a96075ecaabf..c68cb9d1558b636a7f0edb7e84110ac3bbcafbab 100644 (file)
@@ -96,9 +96,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
                Iterator it = list.iterator();
                while (st.hasMoreElements()) {
                        String s1 = (String)st.nextElement();
-                       System.out.print("comparing: " + s1 + " <-> ");
                        String s2 = (String)it.next();
-                       System.out.println(s2);
                        if (!s1.equals(s2)) return false;
                }
                if (it.hasNext()) {
index 3f41e5e520fe4e91f65d0cca8a1b886d8f45dca3..9098c7a5f7e49d6fe77033cea52da939e6d4a17a 100644 (file)
@@ -45,27 +45,22 @@ public class StructureModelUtilTest extends AjdeTestCase {
                List packages = StructureModelUtil.getPackagesInModel(); 
                assertTrue("packages list not null", packages != null);
         assertTrue("packages list not empty", !packages.isEmpty());
-               // System.err.println("> packages: " + packages);
        
                IProgramElement packageNode = (IProgramElement)((Object[])packages.get(0))[0];
                assertTrue("package node not null", packageNode != null);
-               // System.err.println("> package node: " + packageNode);
                
                List files = StructureModelUtil.getFilesInPackage(packageNode);
                assertTrue("fle list not null", files != null);
-               // System.err.println("> file list: " + files);
                
                // TODO: re-enable
 //             Map lineAdviceMap = StructureModelUtil.getLinesToAspectMap(
 //                     ((IProgramElement)files.get(0)).getSourceLocation().getSourceFile().getAbsolutePath()
 //             );
 //             
-//             assertTrue("line->advice map not null", lineAdviceMap != null);
-//             // System.err.println("> line->advice map: " + lineAdviceMap);                  
+//             assertTrue("line->advice map not null", lineAdviceMap != null);                 
 //             
 //             Set aspects = StructureModelUtil.getAspectsAffectingPackage(packageNode);
-//             assertTrue("aspect list not null", aspects != null);
-//             // System.err.println("> aspects affecting package: " + aspects);                       
+//             assertTrue("aspect list not null", aspects != null);                    
        }
 
   
index a27630d55c53a3d0c6ec4547dc4f4567fe481e39..70763dfd54fbd0e62ff2004a628e3760fed0c7a2 100644 (file)
@@ -47,7 +47,6 @@ public class StructureSearchManagerTest extends AjdeTestCase {
                        "Point",
                        null
                );
-               System.err.println(matches);
                assertTrue("non existent node", true);
        }
 
@@ -56,7 +55,6 @@ public class StructureSearchManagerTest extends AjdeTestCase {
                        "Point",
                        IProgramElement.Kind.CONSTRUCTOR
                );
-               System.err.println(matches);
                assertTrue("non existent node", true);
        }
 
index 680b0ffc915140560994f01acefd73db1583faec..dad5bf24073a0947dd88251b91864cd23df776d2 100644 (file)
@@ -77,12 +77,10 @@ public class StructureViewManagerTest extends AjdeTestCase {
                renderer.setHasBeenNotified(false);
                String modelPath = genStructureModelExternFilePath(CONFIG_FILE_PATH);
                openFile(modelPath).delete();
-               //System.err.println("> path: " + modelPath);
                
                Ajde.getDefault().getStructureModelManager().readStructureModel(CONFIG_FILE_PATH);
                
                assertTrue("notified", renderer.getHasBeenNotified());  
-               //System.err.println(">>>>>> " + currentView.getRootNode().getIProgramElement());
                // AMC should this be currentView, or should we recreate the root... do the latter      
                //IProgramElement n = currentView.getRootNode().getIProgramElement();
                IProgramElement n = Ajde.getDefault().getStructureModelManager().getModel().getRoot();
@@ -146,7 +144,6 @@ public class StructureViewManagerTest extends AjdeTestCase {
        }
        
 //     public void testViewListenerRegistrations() {
-//             System.err.println("> starting...");
 //             Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst");
 //             while(!testerBuildListener.getBuildFinished()) {
 //                     try {
@@ -154,7 +151,6 @@ public class StructureViewManagerTest extends AjdeTestCase {
 //                     } catch (InterruptedException ie) { } 
 //             }
 //             List renderers = Ajde.getDefault().getStructureViewManager().getDefaultFileStructureView().getRenderers();
-//             System.err.println("> renderers (1): " + renderers);
 //             
 //             testerBuildListener.reset();
 //             Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst");
@@ -163,7 +159,6 @@ public class StructureViewManagerTest extends AjdeTestCase {
 //                             Thread.sleep(300);
 //                     } catch (InterruptedException ie) { } 
 //             }  
-//             System.err.println("> renderers (2): " + renderers);
 //             assertTrue("checking renderers", true);
 //     } 
 }
index 4fea43a00b3697051e1c846f1f7ecbc381955c42..37f50061c76a639eba8dc4b59cb3ff384bd74faa 100644 (file)
@@ -118,7 +118,7 @@ public class AjBuildManager {
             if (batch) {
                 // System.err.println("XXXX batch: " + buildConfig.getFiles());
                 if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {  
-                    bcelWorld.setModel(StructureModelManager.getDefault().getModel());
+                    bcelWorld.setModel(AsmManager.getDefault().getModel());
                     // in incremental build, only get updated model?
                 }
                 performCompilation(buildConfig.getFiles());
@@ -157,7 +157,7 @@ public class AjBuildManager {
             // but always returns true
             // XXX weaved not in Mik's incremental
             if (buildConfig.isGenerateModelMode()) {
-                StructureModelManager.getDefault().fireModelUpdated();  
+                AsmManager.getDefault().fireModelUpdated();  
             }
             return !handler.hasErrors();
         } finally {
@@ -167,7 +167,7 @@ public class AjBuildManager {
      
     private void setupModel() {
         String rootLabel = "<root>";
-        StructureModel model = StructureModelManager.getDefault().getModel();
+        StructureModel model = AsmManager.getDefault().getModel();
         IProgramElement.Kind kind = IProgramElement.Kind.FILE_JAVA;
         if (buildConfig.getConfigFile() != null) {
             rootLabel = buildConfig.getConfigFile().getName();
@@ -178,7 +178,6 @@ public class AjBuildManager {
         }
         model.setRoot(new ProgramElement(rootLabel, kind, new ArrayList()));
                 
-        HashMap modelFileMap = new HashMap();
         model.setFileMap(new HashMap());
         setStructureModel(model);            
     }
index 651231bc1d7a10c1b1e24378b809c822d5e306f2..93e1bd5fed8cc9027750da58cdf4501df4a74278 100644 (file)
@@ -32,11 +32,11 @@ public class EmacsStructureModelManager {
     }
 
     public void externalizeModel() {
-       if (!StructureModelManager.getDefault().getModel().isValid()) return;
+       if (!AsmManager.getDefault().getModel().isValid()) return;
         
         try {
             //Set fileSet = StructureModelManager.INSTANCE.getStructureModel().getFileMap().entrySet(); 
-                       Set fileSet = StructureModelManager.getDefault().getModel().getFileMapEntrySet(); 
+                       Set fileSet = AsmManager.getDefault().getModel().getFileMapEntrySet(); 
             for (Iterator it = fileSet.iterator(); it.hasNext(); ) {
                 IProgramElement peNode = (IProgramElement)((Map.Entry)it.next()).getValue();
                 dumpStructureToFile(peNode);
@@ -142,7 +142,7 @@ public class EmacsStructureModelManager {
             } else {
                 print("nil");
             }
-            if (node.getSignature() != null) {
+            if (node.getName() != null) {
                 print("\"" + node.getDeclaringType() + "\" ");         //5
             } else {
                 print("nil");
@@ -154,18 +154,18 @@ public class EmacsStructureModelManager {
                 print("nil");
             } else {
                 print("(");
-                if (node instanceof IProgramElement) {
-                    java.util.List relations = ((IProgramElement)node).getRelations();
-                    if (relations != null) {
-                        for (Iterator it = relations.iterator(); it.hasNext(); ) {
-                                                       IRelationship relNode = (IRelationship)it.next();
-                            if (relNode.getKind() == IRelationship.Kind.ADVICE ||
-                                                               relNode.getKind() == IRelationship.Kind.DECLARE) {
-                                printDecls(relNode);                                   // 6
-                            }
-                        }
-                    }
-                }
+//                if (node instanceof IProgramElement) {
+//                    java.util.List relations = ((IProgramElement)node).getRelations();
+//                    if (relations != null) {
+//                        for (Iterator it = relations.iterator(); it.hasNext(); ) {
+//                                                     IRelationship relNode = (IRelationship)it.next();
+//                            if (relNode.getKind() == IRelationship.Kind.ADVICE ||
+//                                                             relNode.getKind() == IRelationship.Kind.DECLARE) {
+//                                printDecls(relNode);                                   // 6
+//                            }
+//                        }
+//                    }
+//                }
                 print(") ");
                 print("(");
                 print(") ");
index c1d6840dae7859da033ebbe70029769d7cdde2a9..76e3671e09f1d9123ef51d1445442e0f010e4591 100644 (file)
@@ -20,7 +20,7 @@ import java.io.PrintWriter;
 import junit.framework.TestCase;
 
 import org.aspectj.ajdt.ajc.BuildArgParser;
-import org.aspectj.asm.StructureModelManager;
+import org.aspectj.asm.AsmManager;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.MessageHandler;
 import org.aspectj.bridge.MessageWriter;
@@ -73,7 +73,7 @@ public class AjBuildManagerTest extends TestCase {
                                 }, messageWriter);
         String err = parser.getOtherMessages(true);            
         assertTrue(err, null == err);
-        manager.setStructureModel(StructureModelManager.getDefault().getModel());
+        manager.setStructureModel(AsmManager.getDefault().getModel());
                MessageHandler handler = new MessageHandler();
         manager.batchBuild(buildConfig, handler);
         assertCompileMessagesValid(handler);   
index a0dc847ff9bcb64b0d488b3f398aa40e8ba82ddd..2c4188db6ab5963661b7b6e2ea255eb961a2c810 100644 (file)
@@ -37,7 +37,7 @@ public class AsmAdapter {
                                // TODO: might want to show these in the future
                                return;
                        }
-                       IRelationshipMapper mapper = StructureModelManager.getDefault().getMapper();
+                       IRelationshipMapper mapper = AsmManager.getDefault().getMapper();
 
                        IProgramElement targetNode = getNode(model, shadow);
                        IProgramElement adviceNode = getNode(model, a);