From: mkersten Date: Tue, 12 Aug 2003 10:29:59 +0000 (+0000) Subject: Minor improvements to structure model generation, clean up of test suite output,... X-Git-Tag: V1_1_1~97 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=11d7649fc3219af5a71d3bf0b9fe004c075c2b4f;p=aspectj.git Minor improvements to structure model generation, clean up of test suite output, and port of AJDT to new ASM APIs. --- diff --git a/ajde/src/org/aspectj/ajde/Ajde.java b/ajde/src/org/aspectj/ajde/Ajde.java index f75e3de82..032ad6e59 100644 --- a/ajde/src/org/aspectj/ajde/Ajde.java +++ b/ajde/src/org/aspectj/ajde/Ajde.java @@ -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 getStructureViewManager() * 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(); } } diff --git a/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java b/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java index fdd00fb76..c5fe1d5b9 100644 --- a/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java +++ b/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java @@ -14,14 +14,12 @@ 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; + } } diff --git a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java index 0e12d5f7c..ec0b44a9e 100644 --- a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java +++ b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java @@ -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; } diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java index 8acbbacba..7170001ba 100644 --- a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java +++ b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java @@ -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; } diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java index 1e41d6759..2cb822827 100644 --- a/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java +++ b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java @@ -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); diff --git a/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java index 06534507f..cdbd5a11d 100644 --- a/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java +++ b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java @@ -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 { diff --git a/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java b/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java index f119a452c..e5ed1b908 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java @@ -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); } diff --git a/ajde/testdata/examples/coverage/ModelCoverage.java b/ajde/testdata/examples/coverage/ModelCoverage.java index d2d639beb..cb7b8391b 100644 --- a/ajde/testdata/examples/coverage/ModelCoverage.java +++ b/ajde/testdata/examples/coverage/ModelCoverage.java @@ -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) { } } diff --git a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java index 9e99b7221..b0d854238 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java @@ -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(): "; @@ -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 { diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java index e50ee51cd..3714da143 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java @@ -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 { diff --git a/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java b/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java index d6c7f1013..b631642f8 100644 --- a/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java +++ b/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java @@ -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); diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java b/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java index 35a8e74d4..d2ccf2596 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java @@ -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); } } diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java b/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java index afd31cbeb..2a761ca47 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java @@ -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) { diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java index 17e4f4722..199a763c3 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java @@ -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); } } diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java index e31d021a7..5d344e754 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java @@ -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() { diff --git a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java index 8aa11f668..c7d23bf40 100644 --- a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java +++ b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java @@ -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); diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java index fa097c8dc..d7c1038aa 100644 --- a/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java +++ b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java @@ -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 diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java index 5777715cb..ba451fcfa 100644 --- a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java +++ b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java @@ -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; diff --git a/ajde/testsrc/org/aspectj/ajde/VersionTest.java b/ajde/testsrc/org/aspectj/ajde/VersionTest.java index 6e8617005..d6f42d420 100644 --- a/ajde/testsrc/org/aspectj/ajde/VersionTest.java +++ b/ajde/testsrc/org/aspectj/ajde/VersionTest.java @@ -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)); } diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java index 0a5b8c1a6..c68cb9d15 100644 --- a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java @@ -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()) { diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java index 3f41e5e52..9098c7a5f 100644 --- a/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java +++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java @@ -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); } diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java index a27630d55..70763dfd5 100644 --- a/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java @@ -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); } diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java index 680b0ffc9..dad5bf240 100644 --- a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java @@ -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); // } } 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 4fea43a00..37f50061c 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 @@ -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 = ""; - 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); } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java index 651231bc1..93e1bd5fe 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java @@ -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(") "); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java index c1d6840da..76e3671e0 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java @@ -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); diff --git a/weaver/src/org/aspectj/weaver/AsmAdapter.java b/weaver/src/org/aspectj/weaver/AsmAdapter.java index a0dc847ff..2c4188db6 100644 --- a/weaver/src/org/aspectj/weaver/AsmAdapter.java +++ b/weaver/src/org/aspectj/weaver/AsmAdapter.java @@ -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);