aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
Diffstat (limited to 'asm')
-rw-r--r--asm/src/org/aspectj/asm/AdviceAssociation.java191
-rw-r--r--asm/src/org/aspectj/asm/Association.java30
-rw-r--r--asm/src/org/aspectj/asm/HierarchyWalker.java (renamed from asm/src/org/aspectj/asm/ModelWalker.java)12
-rw-r--r--asm/src/org/aspectj/asm/IProgramElement.java218
-rw-r--r--asm/src/org/aspectj/asm/IRelationship.java60
-rw-r--r--asm/src/org/aspectj/asm/IStructureModelListener.java (renamed from asm/src/org/aspectj/asm/StructureModelListener.java)2
-rw-r--r--asm/src/org/aspectj/asm/InheritanceAssociation.java102
-rw-r--r--asm/src/org/aspectj/asm/IntroductionAssociation.java67
-rw-r--r--asm/src/org/aspectj/asm/LinkNode.java67
-rw-r--r--asm/src/org/aspectj/asm/ProgramElementNode.java413
-rw-r--r--asm/src/org/aspectj/asm/ReferenceAssociation.java153
-rw-r--r--asm/src/org/aspectj/asm/Relation.java89
-rw-r--r--asm/src/org/aspectj/asm/RelationNode.java39
-rw-r--r--asm/src/org/aspectj/asm/StructureModel.java63
-rw-r--r--asm/src/org/aspectj/asm/StructureModelManager.java102
-rw-r--r--asm/src/org/aspectj/asm/StructureNode.java265
-rw-r--r--asm/src/org/aspectj/asm/StructureNodeFactory.java299
-rw-r--r--asm/src/org/aspectj/asm/internal/ProgramElement.java364
-rw-r--r--asm/src/org/aspectj/asm/internal/Relationship.java53
19 files changed, 785 insertions, 1804 deletions
diff --git a/asm/src/org/aspectj/asm/AdviceAssociation.java b/asm/src/org/aspectj/asm/AdviceAssociation.java
deleted file mode 100644
index 0ff166783..000000000
--- a/asm/src/org/aspectj/asm/AdviceAssociation.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Mik Kersten
- */
-public class AdviceAssociation implements Association {
-
- public static final String NAME = "Advice";
- public static final Relation METHOD_RELATION = new Relation("advises methods", "method advised by", NAME, true, false);
- public static final Relation METHOD_CALL_SITE_RELATION = new Relation("advises method call sites", "method call site advised by", NAME, true, false);
- public static final Relation CONSTRUCTOR_RELATION = new Relation("advises constructors", "constructors advised by", NAME, true, false);
- public static final Relation CONSTRUCTOR_CALL_SITE_RELATION = new Relation("advises constructions", "construction advised by", NAME, true, false);
- public static final Relation HANDLER_RELATION = new Relation("advises exception handlers", "exception handler advised by", NAME, true, false);
- public static final Relation INITIALIZER_RELATION = new Relation("advises initializers", "initializers advised by", NAME, true, false);
- public static final Relation FIELD_ACCESS_RELATION = new Relation("advises field access", "field access advised by", NAME, true, false);
- public static final Relation INTRODUCTION_RELATION = new Relation("advises introduction", "introduction advised by", NAME, true, false);
-
- private List relations = new ArrayList();
-
- public AdviceAssociation() {
- relations.add(METHOD_RELATION);
- relations.add(METHOD_CALL_SITE_RELATION);
- relations.add(CONSTRUCTOR_RELATION);
- relations.add(CONSTRUCTOR_CALL_SITE_RELATION);
- relations.add(HANDLER_RELATION);
- relations.add(INITIALIZER_RELATION);
- relations.add(FIELD_ACCESS_RELATION);
- relations.add(INTRODUCTION_RELATION);
- }
-
- public List getRelations() {
- return relations;
- }
-
- public List getRelationNodes() {
- List relations = new ArrayList();
- List methods = new ArrayList();
- List methodCallSites = new ArrayList();
- List constructors = new ArrayList();
- List constructorCallSites = new ArrayList();
- List handlers = new ArrayList();
- List initializers = new ArrayList();
- List fieldAccesses = new ArrayList();
- List introductions = new ArrayList();
-// Set forwardCorrs = StructureModelManager.correspondences.getAffects(astObject);
-// Set backCorrs = StructureModelManager.correspondences.getAffectedBy(astObject);
-//
-// if (astObject instanceof AdviceDec) {
-// for (Iterator it = forwardCorrs.iterator(); it.hasNext(); ) {
-// ASTObject node = (ASTObject)it.next();
-// LinkNode link = StructureNodeFactory.makeLink(node, false);
-// if (node instanceof MethodDec) {
-// if (((MethodDec)node).isSynthetic()) {
-// ASTObject resolvedNode = resolveSyntheticMethodToIntroduction((MethodDec)node);
-// introductions.add(StructureNodeFactory.makeLink(resolvedNode, false));
-// } else {
-// methods.add(link);
-// }
-// } else if (node instanceof CallExpr) {
-// methodCallSites.add(link);
-// } else if (node instanceof ConstructorDec) {
-// constructors.add(link);
-// } else if (node instanceof NewInstanceExpr) {
-// constructorCallSites.add(link);
-// } else if (node instanceof CatchClause) {
-// handlers.add(link);
-// } else if (node instanceof InitializerDec) {
-// initializers.add(link);
-// } else if (node instanceof FieldDec) {
-// fieldAccesses.add(link);
-// } else if (node instanceof BasicAssignExpr || node instanceof FieldAccessExpr) {
-// fieldAccesses.add(link);
-// }
-// }
-// if (!methods.isEmpty()) relations.add(new RelationNode(METHOD_RELATION, METHOD_RELATION.getForwardNavigationName(), methods));
-// if (!methodCallSites.isEmpty()) relations.add(new RelationNode(METHOD_RELATION, METHOD_CALL_SITE_RELATION.getForwardNavigationName(), methodCallSites));
-// if (!constructors.isEmpty()) relations.add(new RelationNode(CONSTRUCTOR_RELATION, CONSTRUCTOR_RELATION.getForwardNavigationName(), constructors));
-// if (!constructorCallSites.isEmpty()) relations.add(new RelationNode(CONSTRUCTOR_CALL_SITE_RELATION, CONSTRUCTOR_CALL_SITE_RELATION.getForwardNavigationName(), constructorCallSites));
-// if (!handlers.isEmpty()) relations.add(new RelationNode(HANDLER_RELATION, HANDLER_RELATION.getForwardNavigationName(), handlers));
-// if (!initializers.isEmpty()) relations.add(new RelationNode(INITIALIZER_RELATION, INITIALIZER_RELATION.getForwardNavigationName(), initializers));
-// if (!fieldAccesses.isEmpty()) relations.add(new RelationNode(FIELD_ACCESS_RELATION, FIELD_ACCESS_RELATION.getForwardNavigationName(), fieldAccesses));
-// if (!introductions.isEmpty()) relations.add(new RelationNode(INTRODUCTION_RELATION, INTRODUCTION_RELATION.getForwardNavigationName(), introductions));
-// } else {
-// if (astObject instanceof IntroducedDec) {
-// Set adviceDecs = resolveAdviceAffectingIntroduction((IntroducedDec)astObject);
-// if (adviceDecs != null) {
-// for (Iterator adIt = adviceDecs.iterator(); adIt.hasNext(); ) {
-// introductions.add(StructureNodeFactory.makeLink((ASTObject)adIt.next(), false));
-// }
-// }
-// }
-//
-// for (Iterator it = backCorrs.iterator(); it.hasNext(); ) {
-// ASTObject node = (ASTObject)it.next();
-// if (node instanceof AdviceDec) {
-// if (astObject instanceof MethodDec) {
-// methods.add(StructureNodeFactory.makeLink(node, false));
-// } else if (astObject instanceof CallExpr) {
-// methodCallSites.add(StructureNodeFactory.makeLink(node, false));
-// } else if (astObject instanceof ConstructorDec) {
-// constructors.add(StructureNodeFactory.makeLink(node, false));
-// } else if (astObject instanceof NewInstanceExpr) {
-// constructorCallSites.add(StructureNodeFactory.makeLink(node, false));
-// } else if (astObject instanceof CatchClause) {
-// handlers.add(StructureNodeFactory.makeLink(node, false));
-// } else if (astObject instanceof InitializerDec) {
-// initializers.add(StructureNodeFactory.makeLink(node, false));
-// } else if (astObject instanceof FieldDec) {
-// fieldAccesses.add(StructureNodeFactory.makeLink(node, false));
-// } else if (astObject instanceof BasicAssignExpr
-// || astObject instanceof FieldAccessExpr) {
-// fieldAccesses.add(StructureNodeFactory.makeLink(node, false));
-// }
-// }
-// }
-// if (!methods.isEmpty()) relations.add(new RelationNode(METHOD_RELATION, METHOD_RELATION.getBackNavigationName(), methods));
-// if (!methodCallSites.isEmpty()) relations.add(new RelationNode(METHOD_CALL_SITE_RELATION, METHOD_CALL_SITE_RELATION.getBackNavigationName(), methodCallSites));
-// if (!constructors.isEmpty()) relations.add(new RelationNode(CONSTRUCTOR_RELATION, CONSTRUCTOR_RELATION.getBackNavigationName(), constructors));
-// if (!constructorCallSites.isEmpty()) relations.add(new RelationNode(CONSTRUCTOR_CALL_SITE_RELATION, CONSTRUCTOR_CALL_SITE_RELATION.getBackNavigationName(), constructorCallSites));
-// if (!handlers.isEmpty()) relations.add(new RelationNode(HANDLER_RELATION, HANDLER_RELATION.getBackNavigationName(), handlers));
-// if (!initializers.isEmpty()) relations.add(new RelationNode(INITIALIZER_RELATION, INITIALIZER_RELATION.getBackNavigationName(), initializers));
-// if (!fieldAccesses.isEmpty()) relations.add(new RelationNode(FIELD_ACCESS_RELATION, FIELD_ACCESS_RELATION.getBackNavigationName(), fieldAccesses));
-// if (!introductions.isEmpty()) relations.add(new RelationNode(INTRODUCTION_RELATION, INTRODUCTION_RELATION.getBackNavigationName(), introductions));
-// }
- return relations;
- }
-
- public String getName() {
- return NAME;
- }
-
-// /**
-// * @todo HACK: this search and hacked name-match should be replace by a fix to the correspondeces db
-// */
-// private ASTObject resolveSyntheticMethodToIntroduction(MethodDec node) {
-// Set backCorrs = StructureModelManager.correspondences.getAffectedBy(node.getDeclaringType().getTypeDec());
-// Method method = node.getMethod();
-// String name = method.getDeclaringType().getName() + '.' + method.getName();
-// for (Iterator it = backCorrs.iterator(); it.hasNext(); ) {
-// Object next = it.next();
-// if (next instanceof IntroducedDec) {
-// IntroducedDec introducedDec = (IntroducedDec)next;
-// if (name.equals(introducedDec.toShortString())) return introducedDec;
-// }
-// }
-// return node;
-// }
-
-// /**
-// * @todo HACK: this search and hacked name-match should be replace by a fix to the correspondeces db
-// */
-// private Set resolveAdviceAffectingIntroduction(IntroducedDec node) {
-// Set forwardCorrs = StructureModelManager.correspondences.getAffects(node);
-// String name = node.getId();
-// for (Iterator it = forwardCorrs.iterator(); it.hasNext(); ) {
-// Object next = it.next();
-// if (next instanceof TypeDec) {
-// TypeDec typeDec = (TypeDec)next;
-// List decs = typeDec.getBody().getList();
-// for (Iterator it2 = decs.iterator(); it2.hasNext(); ) {
-// Dec bodyDec = (Dec)it2.next();
-// if (bodyDec != null && !(bodyDec instanceof InitializerDec)) {
-// if (bodyDec instanceof MethodDec && bodyDec.isSynthetic() && name.equals(bodyDec.getName())) {
-// MethodDec methodDec = (MethodDec)bodyDec;
-// return StructureModelManager.correspondences.getAffectedBy(methodDec);
-// }
-// }
-// }
-// }
-// }
-// return null;
-// }
-}
-
diff --git a/asm/src/org/aspectj/asm/Association.java b/asm/src/org/aspectj/asm/Association.java
deleted file mode 100644
index c0431d694..000000000
--- a/asm/src/org/aspectj/asm/Association.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.List;
-
-/**
- * @author Mik Kersten
- */
-public interface Association {
-
- public List getRelations();
-
- // XXX used ASTObject parameter
- public List getRelationNodes();
-
- public String getName();
-}
diff --git a/asm/src/org/aspectj/asm/ModelWalker.java b/asm/src/org/aspectj/asm/HierarchyWalker.java
index e5e19deee..b1d9e6100 100644
--- a/asm/src/org/aspectj/asm/ModelWalker.java
+++ b/asm/src/org/aspectj/asm/HierarchyWalker.java
@@ -17,23 +17,23 @@ package org.aspectj.asm;
/**
* @author Mik Kersten
*/
-public class ModelWalker {
+public class HierarchyWalker {
private StructureModel model;
- public ModelWalker() {
+ public HierarchyWalker() {
super();
}
- public ModelWalker(StructureModel model) {
+ public HierarchyWalker(StructureModel model) {
this.model = model;
}
- protected void preProcess(StructureNode node) { }
+ protected void preProcess(IProgramElement node) { }
- protected void postProcess(StructureNode node) { }
+ protected void postProcess(IProgramElement node) { }
- public StructureNode process(StructureNode node) {
+ public IProgramElement process(IProgramElement node) {
preProcess(node);
node.walk(this);
postProcess(node);
diff --git a/asm/src/org/aspectj/asm/IProgramElement.java b/asm/src/org/aspectj/asm/IProgramElement.java
new file mode 100644
index 000000000..24132f55d
--- /dev/null
+++ b/asm/src/org/aspectj/asm/IProgramElement.java
@@ -0,0 +1,218 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * ******************************************************************/
+
+package org.aspectj.asm;
+
+import java.io.*;
+import java.util.*;
+
+import org.aspectj.bridge.*;
+
+/**
+ * Represents program elements in the AspectJ containment hierarchy.
+ *
+ * @author Mik Kersten
+ */
+public interface IProgramElement extends Serializable {
+
+ public List/*IProgramElement*/ getChildren();
+ public void addChild(IProgramElement child);
+ public Kind getKind();
+ public List getModifiers();
+ public Accessibility getAccessibility();
+ public String getDeclaringType();
+ public String getPackageName();
+ public String getSignature();
+ public String getName();
+ public boolean isCode();
+ public boolean isMemberKind();
+ public void setRunnable(boolean value);
+ public boolean isRunnable();
+ public boolean isImplementor();
+ public void setImplementor(boolean value);
+ public boolean isOverrider();
+ public void setOverrider(boolean value);
+ public List getRelations();
+ public void setRelations(List relations);
+ public String getFormalComment();
+ public String toString();
+ public String getBytecodeName();
+ public String getBytecodeSignature();
+ public void setBytecodeName(String bytecodeName);
+ public void setBytecodeSignature(String bytecodeSignature);
+ public String getFullSignature();
+ public void setFullSignature(String string);
+ public void setKind(Kind kind);
+ public void setReturnType(String returnType);
+ public String getReturnType();
+ public ISourceLocation getSourceLocation();
+ public void setSourceLocation(ISourceLocation sourceLocation);
+ public IMessage getMessage();
+ public void setMessage(IMessage message);
+ public IProgramElement getParent();
+ public void setParent(IProgramElement parent);
+ public IProgramElement walk(HierarchyWalker walker);
+ public void setName(String name);
+ public void setChildren(List children);
+
+ /**
+ * Uses "typesafe enum" pattern.
+ */
+ public static class Modifiers implements Serializable {
+
+ public static final Modifiers STATIC = new Modifiers("static");
+ public static final Modifiers FINAL = new Modifiers("final");
+ public static final Modifiers ABSTRACT = new Modifiers("abstract");
+ public static final Modifiers SYNCHRONIZED = new Modifiers("synchronized");
+ public static final Modifiers VOLATILE = new Modifiers("volatile");
+ public static final Modifiers STRICTFP = new Modifiers("strictfp");
+ public static final Modifiers TRANSIENT = new Modifiers("transient");
+ public static final Modifiers NATIVE = new Modifiers("native");
+ public static final Modifiers[] ALL = { STATIC, FINAL, ABSTRACT, SYNCHRONIZED, TRANSIENT, VOLATILE, STRICTFP, NATIVE };
+ private final String name;
+
+ private Modifiers(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+
+ /**
+ * Uses "typesafe enum" pattern.
+ */
+ public static class Accessibility implements Serializable {
+
+ public static final Accessibility PUBLIC = new Accessibility("public");
+ public static final Accessibility PACKAGE = new Accessibility("package");
+ public static final Accessibility PROTECTED = new Accessibility("protected");
+ public static final Accessibility PRIVATE = new Accessibility("private");
+ public static final Accessibility PRIVILEGED = new Accessibility("privileged");
+ public static final Accessibility[] ALL = { PUBLIC, PACKAGE, PROTECTED, PRIVATE, PRIVILEGED };
+ private final String name;
+
+ private Accessibility(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+
+ /**
+ * Uses "typesafe enum" pattern.
+ */
+ public static class Kind implements Serializable {
+
+ public static final Kind PROJECT = new Kind("project");
+ public static final Kind PACKAGE = new Kind("package");
+ public static final Kind FILE = new Kind("file");
+ public static final Kind FILE_JAVA = new Kind("java source file");
+ public static final Kind FILE_ASPECTJ = new Kind("aspect source file");
+ public static final Kind FILE_LST = new Kind("build configuration file");
+ public static final Kind CLASS = new Kind("class");
+ public static final Kind INTERFACE = new Kind("interface");
+ public static final Kind ASPECT = new Kind("aspect");
+ public static final Kind INITIALIZER = new Kind("initializer");
+ public static final Kind INTER_TYPE_FIELD = new Kind("inter-type field");
+ public static final Kind INTER_TYPE_METHOD = new Kind("inter-type method");
+ public static final Kind INTER_TYPE_CONSTRUCTOR = new Kind("inter-type constructor");
+ public static final Kind CONSTRUCTOR = new Kind("constructor");
+ public static final Kind METHOD = new Kind("method");
+ public static final Kind FIELD = new Kind("field");
+ public static final Kind POINTCUT = new Kind("pointcut");
+ public static final Kind ADVICE = new Kind("advice");
+ public static final Kind DECLARE_PARENTS = new Kind("declare parents");
+ public static final Kind DECLARE_WARNING = new Kind("declare warning");
+ public static final Kind DECLARE_ERROR = new Kind("declare error");
+ public static final Kind DECLARE_SOFT = new Kind("declare soft");
+ public static final Kind DECLARE_PRECEDENCE= new Kind("declare precedence");
+ public static final Kind CODE = new Kind("decBodyElement");
+ public static final Kind ERROR = new Kind("error");
+
+ public static final Kind[] ALL = { PROJECT, PACKAGE, FILE, FILE_JAVA,
+ FILE_ASPECTJ, FILE_LST, CLASS, INTERFACE, ASPECT,
+ INITIALIZER, INTER_TYPE_FIELD, INTER_TYPE_METHOD, INTER_TYPE_CONSTRUCTOR,
+ CONSTRUCTOR, METHOD, FIELD, POINTCUT, ADVICE, DECLARE_PARENTS,
+ DECLARE_WARNING, DECLARE_ERROR, DECLARE_SOFT, CODE, ERROR };
+
+ public static Kind getKindForString(String kindString) {
+ for (int i = 0; i < ALL.length; i++) {
+ if (ALL[i].toString().equals(kindString)) return ALL[i];
+ }
+ return ERROR;
+ }
+
+ private final String name;
+
+ private Kind(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public static List getNonAJMemberKinds() {
+ List list = new ArrayList();
+ list.add(METHOD);
+ list.add(FIELD);
+ list.add(CONSTRUCTOR);
+ return list;
+ }
+
+ public boolean isMemberKind() {
+ return this == FIELD
+ || this == METHOD
+ || this == CONSTRUCTOR
+ || this == POINTCUT
+ || this == ADVICE;
+ }
+
+ public boolean isTypeKind() {
+ return this == CLASS
+ || this == INTERFACE
+ || this == ASPECT;
+ }
+
+ public boolean isSourceFileKind() {
+ return this == FILE_ASPECTJ
+ || this == FILE_JAVA;
+ }
+
+ public boolean isDeclareKind() {
+ return name.startsWith("declare");
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+} \ No newline at end of file
diff --git a/asm/src/org/aspectj/asm/IRelationship.java b/asm/src/org/aspectj/asm/IRelationship.java
new file mode 100644
index 000000000..ab8d9bf09
--- /dev/null
+++ b/asm/src/org/aspectj/asm/IRelationship.java
@@ -0,0 +1,60 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.asm;
+
+import java.io.*;
+import java.util.List;
+
+/**
+ * @author Mik Kersten
+ */
+public interface IRelationship extends Serializable {
+
+ public String getName();
+
+ public Kind getKind();
+
+ public IProgramElement getSource();
+
+ public List/*IProgramElement*/ getTargets();
+
+ /**
+ * Uses "typesafe enum" pattern.
+ */
+ public static class Kind implements Serializable {
+
+ public static final Kind ADVICE = new Kind("static");
+ public static final Kind INHERITANCE = new Kind("final");
+ public static final Kind REFERENCE = new Kind("abstract");
+ public static final Kind DECLARE = new Kind("volatile");
+ public static final Kind[] ALL = { ADVICE, INHERITANCE, REFERENCE, DECLARE };
+ private final String name;
+
+ private Kind(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+}
diff --git a/asm/src/org/aspectj/asm/StructureModelListener.java b/asm/src/org/aspectj/asm/IStructureModelListener.java
index eab786b64..9512045ac 100644
--- a/asm/src/org/aspectj/asm/StructureModelListener.java
+++ b/asm/src/org/aspectj/asm/IStructureModelListener.java
@@ -21,7 +21,7 @@ import java.util.EventListener;
*
* @author Mik Kersten
*/
-public interface StructureModelListener extends EventListener {
+public interface IStructureModelListener extends EventListener {
public void modelUpdated(StructureModel rootNode);
}
diff --git a/asm/src/org/aspectj/asm/InheritanceAssociation.java b/asm/src/org/aspectj/asm/InheritanceAssociation.java
deleted file mode 100644
index dea4bd689..000000000
--- a/asm/src/org/aspectj/asm/InheritanceAssociation.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Mik Kersten
- */
-public class InheritanceAssociation implements Association {
- public static final String NAME = "Inheritance";
- public static final Relation INHERITS_RELATION = new Relation("inherits", "is inherited by", NAME, true, true);
- public static final Relation IMPLEMENTS_RELATION = new Relation("implements", "is implemented by", NAME, true, true);
- public static final Relation INHERITS_MEMBERS_RELATION = new Relation("inherits members", NAME, false);
- private List relations = new ArrayList();
-
- public InheritanceAssociation() {
- relations.add(INHERITS_RELATION);
- relations.add(IMPLEMENTS_RELATION);
- relations.add(INHERITS_MEMBERS_RELATION);
- }
-
- public List getRelations() {
- return relations;
- }
-
- public List getRelationNodes() {
- List relations = new ArrayList();
-// if (astObject instanceof TypeDec) {
-// TypeDec typeDec = (TypeDec)astObject;
-// boolean isInterface = (astObject instanceof InterfaceDec);
-// List superTypes = getTypeLinks(typeDec.getType().getDirectSuperTypes(), true, isInterface);
-// List subTypes = getTypeLinks(typeDec.getType().getDirectSubTypes(), true, isInterface);
-// if (!superTypes.isEmpty()) relations.add(new RelationNode(INHERITS_RELATION, INHERITS_RELATION.getForwardNavigationName(), superTypes));
-// if (!subTypes.isEmpty()) relations.add(new RelationNode(INHERITS_RELATION, INHERITS_RELATION.getBackNavigationName(), subTypes));
-//
-// List implementedInterfaces = getTypeLinks(typeDec.getType().getDirectSuperTypes(), false, isInterface);
-// List implementors = getTypeLinks(typeDec.getType().getDirectSubTypes(), false, isInterface);
-// if (!implementedInterfaces.isEmpty()) relations.add(new RelationNode(IMPLEMENTS_RELATION, IMPLEMENTS_RELATION.getForwardNavigationName(), implementedInterfaces));
-// if (!implementors.isEmpty()) relations.add(new RelationNode(IMPLEMENTS_RELATION, IMPLEMENTS_RELATION.getBackNavigationName(), implementors));
-//
-// List inheritedMembers = new ArrayList(getMemberLinks(typeDec.getType().getInheritedMethods()));
-// if (!inheritedMembers.isEmpty()) relations.add(new RelationNode(INHERITS_MEMBERS_RELATION, INHERITS_MEMBERS_RELATION.getForwardNavigationName(), inheritedMembers));
-// }
- return relations;
- }
-
-// private List getTypeLinks(Collection types, boolean isInheritance, boolean isInterface) {
-// List links = new ArrayList();
-// if (types != null) {
-// for (Iterator it = types.iterator(); it.hasNext(); ) {
-// NameType nameType = (NameType)it.next();
-// if (!nameType.getId().equals("Object")) {
-// if (isInheritance && ((isInterface && nameType.isInterface()) || (!isInterface && !nameType.isInterface()))
-// || !isInheritance && (!isInterface && nameType.isInterface())) {
-// Dec dec = nameType.getCorrespondingDec();
-// links.add(StructureNodeFactory.makeLink(dec, false));
-// }
-// }
-// }
-// }
-// return links;
-// }
-
-// private List getMemberLinks(Collection members) {
-// List links = new ArrayList();
-// if (members != null) {
-// for (Iterator it = members.iterator(); it.hasNext(); ) {
-// Object object = it.next();
-// if (object instanceof Method) {
-// Method method = (Method)object;
-// if (!method.getDeclaringType().getId().equals("Object")) {
-// links.add(StructureNodeFactory.makeLink(method.getCorrespondingDec(), false));
-// }
-// } else if (object instanceof Field) {
-// Field field = (Field)object;
-// if (!field.getDeclaringType().getId().equals("Object")) {
-// links.add(StructureNodeFactory.makeLink(field.getCorrespondingDec(), false));
-// }
-// }
-// }
-// }
-// return links;
-// }
-
- public String getName() {
- return NAME;
- }
-}
diff --git a/asm/src/org/aspectj/asm/IntroductionAssociation.java b/asm/src/org/aspectj/asm/IntroductionAssociation.java
deleted file mode 100644
index 867baa61c..000000000
--- a/asm/src/org/aspectj/asm/IntroductionAssociation.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Mik Kersten
- */
-public class IntroductionAssociation implements Association {
- public static final String NAME = "Introduction";
- public static final Relation INTRODUCES_RELATION = new Relation("declares member on", "inter-type declared members", NAME, true, false);
- private List relations = new ArrayList();
-
- public IntroductionAssociation() {
- relations.add(INTRODUCES_RELATION);
- }
-
- public List getRelations() {
- return relations;
- }
-
- public List getRelationNodes() {
- List relations = new ArrayList();
- List introduces = new ArrayList();
-// Set forwardCorrs = StructureModelManager.correspondences.getAffects(astObject);
-// Set backCorrs = StructureModelManager.correspondences.getAffectedBy(astObject);
-// if (astObject instanceof IntroducedDec) {
-// for (Iterator it = forwardCorrs.iterator(); it.hasNext(); ) {
-// ASTObject node = (ASTObject)it.next();
-// LinkNode link = StructureNodeFactory.makeLink(node, false);
-// if (node instanceof TypeDec) {
-// introduces.add(link);
-// }
-// }
-// if (!introduces.isEmpty()) relations.add(new RelationNode(INTRODUCES_RELATION, INTRODUCES_RELATION.getForwardNavigationName(), introduces));
-// } else {
-// for (Iterator it = backCorrs.iterator(); it.hasNext(); ) {
-// ASTObject node = (ASTObject)it.next();
-// if (astObject instanceof TypeDec) {
-// if (node instanceof IntroducedDec) {
-// introduces.add(StructureNodeFactory.makeLink(node, false));
-// }
-// }
-// }
-// if (!introduces.isEmpty()) relations.add(new RelationNode(INTRODUCES_RELATION, INTRODUCES_RELATION.getBackNavigationName(), introduces));
-// }
- return relations;
- }
-
- public String getName() {
- return NAME;
- }
-}
diff --git a/asm/src/org/aspectj/asm/LinkNode.java b/asm/src/org/aspectj/asm/LinkNode.java
deleted file mode 100644
index 9db0dd2bb..000000000
--- a/asm/src/org/aspectj/asm/LinkNode.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-
-/**
- * @author Mik Kersten
- */
-public class LinkNode extends StructureNode {
-
- private ProgramElementNode programElementNode = null;
-
- /**
- * Used during de-serialization.
- */
- public LinkNode() { }
-
- /**
- * @param node can not be null
- */
- public LinkNode(ProgramElementNode node) {
- super(node.getSignature().toString(), "internal", null);
- this.programElementNode = node;
- }
-
- public ProgramElementNode getProgramElementNode() {
- return programElementNode;
- }
-
- public String toString() {
- String name = "";
- if (programElementNode.getProgramElementKind().equals(ProgramElementNode.Kind.ADVICE) ||
- programElementNode.getProgramElementKind().equals(ProgramElementNode.Kind.INTER_TYPE_FIELD) ||
- programElementNode.getProgramElementKind().equals(ProgramElementNode.Kind.INTER_TYPE_METHOD) ||
- programElementNode.getProgramElementKind().equals(ProgramElementNode.Kind.INTER_TYPE_CONSTRUCTOR) ||
- programElementNode.getProgramElementKind().equals(ProgramElementNode.Kind.CODE)) {
- name = programElementNode.parent.toString() + ": " + programElementNode.getName();
- StructureNode grandparent = programElementNode.parent.parent;
- if ( grandparent instanceof ProgramElementNode ) {
- ProgramElementNode pe_grandparent = (ProgramElementNode)grandparent;
- if ( pe_grandparent.getProgramElementKind().equals(ProgramElementNode.Kind.CLASS) ||
- pe_grandparent.getProgramElementKind().equals(ProgramElementNode.Kind.INTERFACE)
- ) {
- name = pe_grandparent.toString() + "." + name;
- }
- }
-
- } else if (programElementNode.isMemberKind()) {
- name = programElementNode.parent.toString() + '.' + programElementNode.getName();
- } else {
- name = programElementNode.toString();
- }
- return name;
- }
-}
diff --git a/asm/src/org/aspectj/asm/ProgramElementNode.java b/asm/src/org/aspectj/asm/ProgramElementNode.java
deleted file mode 100644
index 37861a48f..000000000
--- a/asm/src/org/aspectj/asm/ProgramElementNode.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.*;
-import java.io.*;
-
-import org.aspectj.bridge.ISourceLocation;
-
-
-/**
- * @author Mik Kersten
- */
-public class ProgramElementNode extends StructureNode {
-
- private List modifiers = new ArrayList();
- private List relations = new ArrayList();
-
- private Kind kind;
- private Accessibility accessibility;
- private String declaringType = "";
- private String formalComment = "";
- private String packageName = null;
- private boolean runnable = false;
- private boolean implementor = false;
- private boolean overrider = false;
-
- private String bytecodeName;
- private String bytecodeSignature;
- private String fullSignature;
- private String returnType;
-
- /**
- * Used during de-externalization.
- */
- public ProgramElementNode() { }
-
- /**
- * Use to create program element nodes that do not correspond to source locations.
- */
- public ProgramElementNode(
- String signature,
- Kind kind,
- List children) {
- super(signature, kind.toString(), children);
- this.kind = kind;
- }
-
- public ProgramElementNode(
- String signature,
- ProgramElementNode.Kind kind,
- ISourceLocation sourceLocation,
- int modifiers,
- String formalComment,
- List children)
- {
- super(signature, kind.toString(), children);
- super.sourceLocation = sourceLocation;
- this.kind = kind;
- this.formalComment = formalComment;
- this.modifiers = genModifiers(modifiers);
- this.accessibility = genAccessibility(modifiers);
- }
-
- /**
- * Use to create program element nodes that correspond to source locations.
- */
- public ProgramElementNode(
- String signature,
- Kind kind,
- List modifiers,
- Accessibility accessibility,
- String declaringType,
- String packageName,
- String formalComment,
- ISourceLocation sourceLocation,
- List relations,
- List children,
- boolean member) {
-
- super(signature, kind.toString(), children);
- super.sourceLocation = sourceLocation;
- this.kind = kind;
- this.modifiers = modifiers;
- this.accessibility = accessibility;
- this.declaringType = declaringType;
- this.packageName = packageName;
- this.formalComment = formalComment;
- this.relations = relations;
- }
-
- public Kind getProgramElementKind() {
- return kind;
- }
-
- public List getModifiers() {
- return modifiers;
- }
-
- public Accessibility getAccessibility() {
- return accessibility;
- }
-
- public String getDeclaringType() {
- return declaringType;
- }
-
- public String getPackageName() {
- if (kind == Kind.PACKAGE) return getSignature();
- if (getParent() == null || !(getParent() instanceof ProgramElementNode)) {
- return "";
- }
- return ((ProgramElementNode)getParent()).getPackageName();
- }
-
- public String getKind() {
- return super.kind;
- }
-
- public String getSignature() {
- return super.name;
- }
-
- public boolean isCode() {
- return kind.equals(Kind.CODE);
- }
-
- public boolean isMemberKind() {
- return kind.isMemberKind();
- }
-
- public void setRunnable(boolean value) {
- this.runnable = value;
- }
-
- public boolean isRunnable() {
- return runnable;
- }
-
- public boolean isImplementor() {
- return implementor;
- }
-
- public void setImplementor(boolean value) {
- this.implementor = value;
- }
-
- public boolean isOverrider() {
- return overrider;
- }
-
- public void setOverrider(boolean value) {
- this.overrider = value;
- }
-
- public List getRelations() {
- return relations;
- }
-
- public void setRelations(List relations) {
- if (relations.size() > 0) {
- this.relations = relations;
- }
- }
-
- public String getFormalComment() {
- return formalComment;
- }
-
- public String toString() {
- return super.name;
- }
-
- public static List genModifiers(int modifiers) {
- List modifiersList = new ArrayList();
- if ((modifiers & AccStatic) != 0) modifiersList.add(ProgramElementNode.Modifiers.STATIC);
- if ((modifiers & AccFinal) != 0) modifiersList.add(ProgramElementNode.Modifiers.STATIC);
- if ((modifiers & AccSynchronized) != 0) modifiersList.add(ProgramElementNode.Modifiers.STATIC);
- if ((modifiers & AccVolatile) != 0) modifiersList.add(ProgramElementNode.Modifiers.STATIC);
- if ((modifiers & AccTransient) != 0) modifiersList.add(ProgramElementNode.Modifiers.STATIC);
- if ((modifiers & AccNative) != 0) modifiersList.add(ProgramElementNode.Modifiers.STATIC);
- if ((modifiers & AccAbstract) != 0) modifiersList.add(ProgramElementNode.Modifiers.STATIC);
- return modifiersList;
- }
-
- public static ProgramElementNode.Accessibility genAccessibility(int modifiers) {
- if ((modifiers & AccPublic) != 0) return ProgramElementNode.Accessibility.PUBLIC;
- if ((modifiers & AccPrivate) != 0) return ProgramElementNode.Accessibility.PRIVATE;
- if ((modifiers & AccProtected) != 0) return ProgramElementNode.Accessibility.PROTECTED;
- if ((modifiers & AccPrivileged) != 0) return ProgramElementNode.Accessibility.PRIVILEGED;
- else return ProgramElementNode.Accessibility.PACKAGE;
- }
-
- /**
- * Uses "typesafe enum" pattern.
- */
- public static class Modifiers implements Serializable {
-
- public static final Modifiers STATIC = new Modifiers("static");
- public static final Modifiers FINAL = new Modifiers("final");
- public static final Modifiers ABSTRACT = new Modifiers("abstract");
- public static final Modifiers SYNCHRONIZED = new Modifiers("synchronized");
- public static final Modifiers VOLATILE = new Modifiers("volatile");
- public static final Modifiers STRICTFP = new Modifiers("strictfp");
- public static final Modifiers TRANSIENT = new Modifiers("transient");
- public static final Modifiers NATIVE = new Modifiers("native");
- public static final Modifiers[] ALL = { STATIC, FINAL, ABSTRACT, SYNCHRONIZED, TRANSIENT, VOLATILE, STRICTFP, NATIVE };
- private final String name;
-
- private Modifiers(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- // The 4 declarations below are necessary for serialization
- private static int nextOrdinal = 0;
- private final int ordinal = nextOrdinal++;
- private Object readResolve() throws ObjectStreamException {
- return ALL[ordinal];
- }
- }
-
- /**
- * Uses "typesafe enum" pattern.
- */
- public static class Accessibility implements Serializable {
-
- public static final Accessibility PUBLIC = new Accessibility("public");
- public static final Accessibility PACKAGE = new Accessibility("package");
- public static final Accessibility PROTECTED = new Accessibility("protected");
- public static final Accessibility PRIVATE = new Accessibility("private");
- public static final Accessibility PRIVILEGED = new Accessibility("privileged");
- public static final Accessibility[] ALL = { PUBLIC, PACKAGE, PROTECTED, PRIVATE, PRIVILEGED };
- private final String name;
-
- private Accessibility(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- // The 4 declarations below are necessary for serialization
- private static int nextOrdinal = 0;
- private final int ordinal = nextOrdinal++;
- private Object readResolve() throws ObjectStreamException {
- return ALL[ordinal];
- }
- }
-
- /**
- * Uses "typesafe enum" pattern.
- */
- public static class Kind implements Serializable {
-
- public static final Kind PROJECT = new Kind("project");
- public static final Kind PACKAGE = new Kind("package");
- public static final Kind FILE = new Kind("file");
- public static final Kind FILE_JAVA = new Kind("java source file");
- public static final Kind FILE_ASPECTJ = new Kind("aspect source file");
- public static final Kind FILE_LST = new Kind("build configuration file");
- public static final Kind CLASS = new Kind("class");
- public static final Kind INTERFACE = new Kind("interface");
- public static final Kind ASPECT = new Kind("aspect");
- public static final Kind INITIALIZER = new Kind("initializer");
- public static final Kind INTER_TYPE_FIELD = new Kind("inter-type field");
- public static final Kind INTER_TYPE_METHOD = new Kind("inter-type method");
- public static final Kind INTER_TYPE_CONSTRUCTOR = new Kind("inter-type constructor");
- public static final Kind CONSTRUCTOR = new Kind("constructor");
- public static final Kind METHOD = new Kind("method");
- public static final Kind FIELD = new Kind("field");
- public static final Kind POINTCUT = new Kind("pointcut");
- public static final Kind ADVICE = new Kind("advice");
- public static final Kind DECLARE_PARENTS = new Kind("declare parents");
- public static final Kind DECLARE_WARNING = new Kind("declare warning");
- public static final Kind DECLARE_ERROR = new Kind("declare error");
- public static final Kind DECLARE_SOFT = new Kind("declare soft");
- public static final Kind DECLARE_PRECEDENCE= new Kind("declare precedence");
- public static final Kind CODE = new Kind("decBodyElement");
- public static final Kind ERROR = new Kind("error");
-
- public static final Kind[] ALL = { PROJECT, PACKAGE, FILE, FILE_JAVA,
- FILE_ASPECTJ, FILE_LST, CLASS, INTERFACE, ASPECT,
- INITIALIZER, INTER_TYPE_FIELD, INTER_TYPE_METHOD, INTER_TYPE_CONSTRUCTOR,
- CONSTRUCTOR, METHOD, FIELD, POINTCUT, ADVICE, DECLARE_PARENTS,
- DECLARE_WARNING, DECLARE_ERROR, DECLARE_SOFT, CODE, ERROR };
-
- public static Kind getKindForString(String kindString) {
- for (int i = 0; i < ALL.length; i++) {
- if (ALL[i].toString().equals(kindString)) return ALL[i];
- }
- return ERROR;
- }
-
- private final String name;
-
- private Kind(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- public static List getNonAJMemberKinds() {
- List list = new ArrayList();
- list.add(METHOD);
- list.add(FIELD);
- list.add(CONSTRUCTOR);
- return list;
- }
-
- public boolean isMemberKind() {
- return this == FIELD
- || this == METHOD
- || this == CONSTRUCTOR
- || this == POINTCUT
- || this == ADVICE;
- }
-
- public boolean isTypeKind() {
- return this == CLASS
- || this == INTERFACE
- || this == ASPECT;
- }
-
- public boolean isSourceFileKind() {
- return this == FILE_ASPECTJ
- || this == FILE_JAVA;
- }
-
- public boolean isDeclareKind() {
- return name.startsWith("declare");
- }
-
- // The 4 declarations below are necessary for serialization
- private static int nextOrdinal = 0;
- private final int ordinal = nextOrdinal++;
- private Object readResolve() throws ObjectStreamException {
- return ALL[ordinal];
- }
- }
-
- // XXX these names and values are from org.eclipse.jdt.internal.compiler.env.IConstants
- 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;
-
-
- public String getBytecodeName() {
- return bytecodeName;
- }
-
- public String getBytecodeSignature() {
- return bytecodeSignature;
- }
-
- public void setBytecodeName(String bytecodeName) {
- this.bytecodeName = bytecodeName;
- }
-
- public void setBytecodeSignature(String bytecodeSignature) {
- this.bytecodeSignature = bytecodeSignature;
- }
-
- public String getFullSignature() {
- return fullSignature;
- }
-
- public void setFullSignature(String string) {
- fullSignature = string;
- }
-
- public void setKind(Kind kind) {
- this.kind = kind;
- }
-
- public void setReturnType(String returnType) {
- this.returnType = returnType;
- }
-
- public String getReturnType() {
- return returnType;
- }
-
-}
-
diff --git a/asm/src/org/aspectj/asm/ReferenceAssociation.java b/asm/src/org/aspectj/asm/ReferenceAssociation.java
deleted file mode 100644
index abe53ace4..000000000
--- a/asm/src/org/aspectj/asm/ReferenceAssociation.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Mik Kersten
- */
-public class ReferenceAssociation implements Association {
- public static final String NAME = "Reference";
- public static final Relation USES_POINTCUT_RELATION = new Relation("uses pointcut", "pointcut used by", NAME, true, true);
- public static final Relation IMPORTS_RELATION = new Relation("imports", NAME, false);
- //public static final Relation THROWS_RELATION = new Relation("throws", NAME, false);
- //public static final Relation USES_TYPE_RELATION = new Relation("uses type", NAME, false);
-
- private List relations = new ArrayList();
-
- public ReferenceAssociation() {
- relations.add(USES_POINTCUT_RELATION);
- relations.add(IMPORTS_RELATION);
- //relations.add(THROWS_RELATION);
- //relations.add(USES_TYPE_RELATION);
- }
-
- public List getRelations() {
- return relations;
- }
-
- public List getRelationNodes() {
- List relations = new ArrayList();
- List pointcutsUsed = new ArrayList();
- List pointcutUsedBy = new ArrayList();
- List throwsTypes = new ArrayList();
- List imports = new ArrayList();
- List usesType = new ArrayList();
-// Set forwardCorrs = StructureModelManager.correspondences.getAffects(astObject);
-// Set backCorrs = StructureModelManager.correspondences.getAffectedBy(astObject);
-//
-// if (astObject instanceof AdviceDec) {
-// for (Iterator it = forwardCorrs.iterator(); it.hasNext(); ) {
-// ASTObject node = (ASTObject)it.next();
-// if (node instanceof PointcutDec) {
-// pointcutsUsed.add(StructureNodeFactory.makeLink(node, false));
-// }
-// }
-// } else if (astObject instanceof PointcutDec) {
-// for (Iterator it = backCorrs.iterator(); it.hasNext(); ) {
-// ASTObject node = (ASTObject)it.next();
-// if (node instanceof PointcutDec || node instanceof AdviceDec) {
-// pointcutUsedBy.add(StructureNodeFactory.makeLink(node, false));
-// }
-// }
-// for (Iterator it = forwardCorrs.iterator(); it.hasNext(); ) {
-// ASTObject node = (ASTObject)it.next();
-// if (node instanceof PointcutDec) {
-// pointcutsUsed.add(StructureNodeFactory.makeLink(node, false));
-// }
-// }
-// } else if (astObject instanceof MethodDec) {
-// Method method = ((MethodDec)astObject).getMethod();
-// TypeDs throwsDs = method.getThrows();
-// if (throwsDs != null) {
-// for (Iterator it = throwsDs.iterator(); it.hasNext(); ) {
-// Object o = it.next();
-// if (o instanceof ResolvedTypeD) {
-// ResolvedTypeD resolved = (ResolvedTypeD)o;
-// if (resolved.getType().getCorrespondingDec() != null) {
-// throwsTypes.add(StructureNodeFactory.makeLink(resolved.getType().getCorrespondingDec(), false));
-// }
-// }
-// }
-// }
-// if (!(method.getReturnType() instanceof PrimitiveType) && method.getReturnType().getCorrespondingDec() != null) {
-// usesType.add(StructureNodeFactory.makeLink(method.getReturnType().getCorrespondingDec(), false));
-// }
-// } else if (astObject instanceof FieldDec) {
-// Field field = ((FieldDec)astObject).getField();
-// if (!(field.getFieldType() instanceof PrimitiveType) && field.getFieldType().getCorrespondingDec() != null) {
-// usesType.add(StructureNodeFactory.makeLink(field.getFieldType().getCorrespondingDec(), false));
-// }
-// }
-// else if (astObject instanceof CompilationUnit) {
-// CompilationUnit cu = (CompilationUnit)astObject;
-// org.aspectj.compiler.base.ast.Imports cuImports = cu.getImports();
-// for (int i = 0; cuImports != null && i < cuImports.getChildCount(); i++) {
-// Import imp = cuImports.get(i);
-// if (!imp.getStar() && imp != null && imp.getType() != null) {
-// Type type = imp.getType();
-// Dec dec = type.getCorrespondingDec();
-// if (dec != null) imports.add(StructureNodeFactory.makeLink(dec, true));
-// }
-// }
-// }
-//
-// if (!pointcutsUsed.isEmpty()) relations.add(new RelationNode(USES_POINTCUT_RELATION, USES_POINTCUT_RELATION.getForwardNavigationName(), pointcutsUsed));
-// if (!pointcutUsedBy.isEmpty()) relations.add(new RelationNode(USES_POINTCUT_RELATION, USES_POINTCUT_RELATION.getBackNavigationName(), pointcutUsedBy));
-// if (!imports.isEmpty()) relations.add(new RelationNode(IMPORTS_RELATION, IMPORTS_RELATION.getForwardNavigationName(), imports));
- return relations;
- }
-
- public String getName() {
- return NAME;
- }
-}
-
-
-//public class JavadocSeeAlso {
-//
-// private static final String DOC =
-// "<b>Relates:</b> a declaration to another by the @seeAlso tag<br>" +
-// "<b>Symmetric: </b> yes";
-//
-// public List makeLinks(ASTObject astObject, boolean forwardNavigation) {
-// List linkList = new Vector();
-// org.aspectj.compiler.base.ast.Comment comment = astObject.getComment();
-// try {
-// Object[] os = (Object[])comment.getClass().getMethod("seeTags", new Class[]{}).invoke(comment, new Object[]{});
-// for (int i = 0; i < os.length; i++) {
-// Object o = os[i];
-// Dec docDec = null;
-// TypeDec typeDec = (TypeDec)o.getClass().getMethod("referencedClass", new Class[]{}).invoke(o, new Object[]{});
-// Dec memberDec = (Dec)o.getClass().getMethod("referencedMember", new Class[]{}).invoke(o, new Object[]{});
-// if (memberDec != null) {
-// docDec = memberDec;
-// } else if (typeDec != null) {
-// docDec = typeDec;
-// }
-// if (docDec != null) {
-// linkList.add(StructureNodeFactory.makeLink(docDec, false));
-//
-// }
-// }
-// } catch (Throwable t) {
-// // ingore
-// }
-// return linkList;
-// }
-
-
diff --git a/asm/src/org/aspectj/asm/Relation.java b/asm/src/org/aspectj/asm/Relation.java
deleted file mode 100644
index 31bfdc42f..000000000
--- a/asm/src/org/aspectj/asm/Relation.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-
-package org.aspectj.asm;
-
-import java.io.Serializable;
-
-/**
- * @author Mik Kersten
- */
-public class Relation implements Serializable {
-
- private String forwardNavigationName;
- private String backNavigationName;
- private String associationName;
- private boolean symmetrical;
- private boolean transitive;
-
- public Relation(String forwardNavigationName,
- String backNavigationName,
- String associationName,
- boolean symmetrical,
- boolean transitive) {
- this.forwardNavigationName = forwardNavigationName;
- this.backNavigationName = backNavigationName;
- this.associationName = associationName;
- this.symmetrical = symmetrical;
- this.transitive = transitive;
- }
-
- /**
- * Constructor for asymetrical relations.
- */
- public Relation(String forwardNavigationName,
- String associationName,
- boolean transitive) {
- this(forwardNavigationName, "<no back navigation name>", associationName, false, transitive);
- }
-
- public String getForwardNavigationName() {
- return forwardNavigationName;
- }
-
- public String getBackNavigationName() {
- return backNavigationName;
- }
-
- public String getAssociationName() {
- return associationName;
- }
-
- public boolean isSymmetrical() {
- return symmetrical;
- }
-
- public boolean isTransitive() {
- return transitive;
- }
-
- public boolean equals(Object o) {
- if (!(o instanceof Relation)) return false;
- Relation r = (Relation)o;
- return forwardNavigationName.equals(r.getForwardNavigationName())
- && backNavigationName.equals(r.getBackNavigationName())
- && associationName.equals(r.getAssociationName())
- && (symmetrical == r.isSymmetrical())
- && (transitive == r.isTransitive());
- }
-
- public String toString() {
- if (symmetrical) {
- return forwardNavigationName + " / " + backNavigationName;
- } else {
- return forwardNavigationName;
- }
- }
-}
diff --git a/asm/src/org/aspectj/asm/RelationNode.java b/asm/src/org/aspectj/asm/RelationNode.java
deleted file mode 100644
index ec4c51357..000000000
--- a/asm/src/org/aspectj/asm/RelationNode.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.List;
-
-/**
- * @author Mik Kersten
- */
-public class RelationNode extends StructureNode {
-
- private Relation relation;
-
- /**
- * Used during de-externalization.
- */
- public RelationNode() { }
-
- public RelationNode(Relation relation, String name, List children) {
- super(name, relation.getAssociationName(), children);
- this.relation = relation;
- }
-
- public Relation getRelation() {
- return relation;
- }
-}
diff --git a/asm/src/org/aspectj/asm/StructureModel.java b/asm/src/org/aspectj/asm/StructureModel.java
index 3998c41bb..65b596d05 100644
--- a/asm/src/org/aspectj/asm/StructureModel.java
+++ b/asm/src/org/aspectj/asm/StructureModel.java
@@ -14,11 +14,10 @@
package org.aspectj.asm;
-import java.io.File;
-import java.io.IOException;
-import java.io.Serializable;
+import java.io.*;
import java.util.*;
+import org.aspectj.asm.internal.ProgramElement;
import org.aspectj.bridge.SourceLocation;
/**
@@ -26,16 +25,16 @@ import org.aspectj.bridge.SourceLocation;
*/
public class StructureModel implements Serializable {
- protected StructureNode root = null;
+ protected IProgramElement root = null;
protected String configFile = null;
private Map fileMap = null;
- public static final ProgramElementNode NO_STRUCTURE = new ProgramElementNode("<build to view structure>", ProgramElementNode.Kind.ERROR, null);
+ public static final IProgramElement NO_STRUCTURE = new ProgramElement("<build to view structure>", IProgramElement.Kind.ERROR, null);
- public StructureNode getRoot() {
+ public IProgramElement getRoot() {
return root;
}
- public void setRoot(StructureNode root) {
+ public void setRoot(IProgramElement root) {
this.root = root;
}
@@ -71,14 +70,14 @@ public class StructureModel implements Serializable {
* @param decErrLabel
* @return null if not found
*/
- public ProgramElementNode findNode(ProgramElementNode parent, ProgramElementNode.Kind kind, String name) {
+ public IProgramElement findNode(IProgramElement parent, IProgramElement.Kind kind, String name) {
for (Iterator it = parent.getChildren().iterator(); it.hasNext(); ) {
- ProgramElementNode node = (ProgramElementNode)it.next();
- if (node.getProgramElementKind().equals(kind)
+ IProgramElement node = (IProgramElement)it.next();
+ if (node.getKind().equals(kind)
&& name.equals(node.getName())) {
return node;
} else {
- ProgramElementNode childSearch = findNode(node, kind, name);
+ IProgramElement childSearch = findNode(node, kind, name);
if (childSearch != null) return childSearch;
}
}
@@ -89,13 +88,13 @@ public class StructureModel implements Serializable {
* @param packageName if null default package is searched
* @param className can't be null
*/
- public ProgramElementNode findNodeForClass(String packageName, String className) {
- StructureNode packageNode = null;
+ public IProgramElement findNodeForClass(String packageName, String className) {
+ IProgramElement packageNode = null;
if (packageName == null) {
packageNode = root;
} else {
for (Iterator it = root.getChildren().iterator(); it.hasNext(); ) {
- StructureNode node = (StructureNode)it.next();
+ IProgramElement node = (IProgramElement)it.next();
if (packageName.equals(node.getName())) {
packageNode = node;
}
@@ -105,15 +104,15 @@ public class StructureModel implements Serializable {
// this searches each file for a class
for (Iterator it = packageNode.getChildren().iterator(); it.hasNext(); ) {
- ProgramElementNode fileNode = (ProgramElementNode)it.next();
- ProgramElementNode ret = findClassInNodes(fileNode.getChildren(), className);
+ IProgramElement fileNode = (IProgramElement)it.next();
+ IProgramElement ret = findClassInNodes(fileNode.getChildren(), className);
if (ret != null) return ret;
}
return null;
}
- private ProgramElementNode findClassInNodes(Collection nodes, String name) {
+ private IProgramElement findClassInNodes(Collection nodes, String name) {
String baseName;
String innerName;
int dollar = name.indexOf('$');
@@ -127,7 +126,7 @@ public class StructureModel implements Serializable {
for (Iterator j = nodes.iterator(); j.hasNext(); ) {
- ProgramElementNode classNode = (ProgramElementNode)j.next();
+ IProgramElement classNode = (IProgramElement)j.next();
// System.err.println("checking: " + classNode + " for " + baseName);
// System.err.println("children: " + classNode.getChildren());
if (baseName.equals(classNode.getName())) {
@@ -145,14 +144,14 @@ public class StructureModel implements Serializable {
* @param sourceFilePath modified to '/' delimited path for consistency
* @return a new structure node for the file if it was not found in the model
*/
- public StructureNode findRootNodeForSourceFile(String sourceFile) {
+ public IProgramElement findRootNodeForSourceFile(String sourceFile) {
try {
if (!isValid() || sourceFile == null) {
return StructureModel.NO_STRUCTURE;
} else {
String correctedPath = new File(sourceFile).getCanonicalPath();//.replace('\\', '/');
//StructureNode node = (StructureNode)getFileMap().get(correctedPath);//findFileNode(filePath, model);
- StructureNode node = (StructureNode)findInFileMap(correctedPath);//findFileNode(filePath, model);
+ IProgramElement node = (IProgramElement)findInFileMap(correctedPath);//findFileNode(filePath, model);
if (node != null) {
return node;
} else {
@@ -171,9 +170,9 @@ public class StructureModel implements Serializable {
* @param lineNumber if 0 or 1 the corresponding file node will be returned
* @return a new structure node for the file if it was not found in the model
*/
- public StructureNode findNodeForSourceLine(String sourceFilePath, int lineNumber) {
+ public IProgramElement findNodeForSourceLine(String sourceFilePath, int lineNumber) {
String correctedPath = sourceFilePath;//.replace('\\', '/');
- StructureNode node = findNodeForSourceLineHelper(root, correctedPath, lineNumber);
+ IProgramElement node = findNodeForSourceLineHelper(root, correctedPath, lineNumber);
if (node != null) {
return node;
} else {
@@ -181,16 +180,16 @@ public class StructureModel implements Serializable {
}
}
- private StructureNode createFileStructureNode(String sourceFilePath) {
+ private IProgramElement createFileStructureNode(String sourceFilePath) {
String fileName = new File(sourceFilePath).getName();
- ProgramElementNode fileNode = new ProgramElementNode(fileName, ProgramElementNode.Kind.FILE_JAVA, null);
+ IProgramElement fileNode = new ProgramElement(fileName, IProgramElement.Kind.FILE_JAVA, null);
fileNode.setSourceLocation(new SourceLocation(new File(sourceFilePath), 1, 1));
fileNode.addChild(NO_STRUCTURE);
return fileNode;
}
- private StructureNode findNodeForSourceLineHelper(StructureNode node, String sourceFilePath, int lineNumber) {
+ private IProgramElement findNodeForSourceLineHelper(IProgramElement node, String sourceFilePath, int lineNumber) {
if (matches(node, sourceFilePath, lineNumber)
&& !hasMoreSpecificChild(node, sourceFilePath, lineNumber)) {
return node;
@@ -198,8 +197,8 @@ public class StructureModel implements Serializable {
if (node != null && node.getChildren() != null) {
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- StructureNode foundNode = findNodeForSourceLineHelper(
- (StructureNode)it.next(),
+ IProgramElement foundNode = findNodeForSourceLineHelper(
+ (IProgramElement)it.next(),
sourceFilePath,
lineNumber);
if (foundNode != null) return foundNode;
@@ -209,7 +208,7 @@ public class StructureModel implements Serializable {
return null;
}
- private boolean matches(StructureNode node, String sourceFilePath, int lineNumber) {
+ private boolean matches(IProgramElement node, String sourceFilePath, int lineNumber) {
try {
// if (node != null && node.getSourceLocation() != null)
// System.err.println("====\n1: " +
@@ -224,17 +223,17 @@ public class StructureModel implements Serializable {
&& node.getSourceLocation().getEndLine() >= lineNumber)
||
(lineNumber <= 1
- && node instanceof ProgramElementNode
- && ((ProgramElementNode)node).getProgramElementKind().isSourceFileKind())
+ && node instanceof IProgramElement
+ && ((IProgramElement)node).getKind().isSourceFileKind())
);
} catch (IOException ioe) {
return false;
}
}
- private boolean hasMoreSpecificChild(StructureNode node, String sourceFilePath, int lineNumber) {
+ private boolean hasMoreSpecificChild(IProgramElement node, String sourceFilePath, int lineNumber) {
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- ProgramElementNode child = (ProgramElementNode)it.next();
+ IProgramElement child = (IProgramElement)it.next();
if (matches(child, sourceFilePath, lineNumber)) return true;
}
return false;
diff --git a/asm/src/org/aspectj/asm/StructureModelManager.java b/asm/src/org/aspectj/asm/StructureModelManager.java
index 1464a1eaf..c99b747ad 100644
--- a/asm/src/org/aspectj/asm/StructureModelManager.java
+++ b/asm/src/org/aspectj/asm/StructureModelManager.java
@@ -34,10 +34,10 @@ public class StructureModelManager {
private List associations = new ArrayList();
protected StructureModelManager() {
- associations.add(new AdviceAssociation());
- associations.add(new IntroductionAssociation());
- associations.add(new InheritanceAssociation());
- associations.add(new ReferenceAssociation());
+// associations.add(new AdviceAssociation());
+// associations.add(new IntroductionAssociation());
+// associations.add(new InheritanceAssociation());
+// associations.add(new ReferenceAssociation());
}
public StructureModel getStructureModel() {
@@ -59,62 +59,64 @@ public class StructureModelManager {
boolean showSubMember,
boolean showMemberAndType) {
- if (!model.isValid()) return null;
-
- HashMap annotations = new HashMap();
- StructureNode node = model.findRootNodeForSourceFile(sourceFile);
- if (node == StructureModel.NO_STRUCTURE) {
- return null;
- } else {
- ProgramElementNode fileNode = (ProgramElementNode)node;
- ArrayList peNodes = new ArrayList();
- getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType);
- for (Iterator it = peNodes.iterator(); it.hasNext(); ) {
- ProgramElementNode peNode = (ProgramElementNode)it.next();
- List entries = new ArrayList();
- entries.add(peNode);
- ISourceLocation sourceLoc = peNode.getSourceLocation();
- if (null != sourceLoc) {
- Integer hash = new Integer(sourceLoc.getLine());
- List existingEntry = (List)annotations.get(hash);
- if (existingEntry != null) {
- entries.addAll(existingEntry);
- }
- annotations.put(hash, entries);
- }
- }
- return annotations;
- }
- }
-
- private void getAllStructureChildren(ProgramElementNode node, List result, boolean showSubMember, boolean showMemberAndType) {
- List children = node.getChildren();
- for (Iterator it = children.iterator(); it.hasNext(); ) {
- StructureNode next = (StructureNode)it.next();
- if (next instanceof ProgramElementNode) {
- ProgramElementNode pNode = (ProgramElementNode)next;
- if (pNode != null
- && ((pNode.isCode() && showSubMember) || (!pNode.isCode() && showMemberAndType))
- && pNode.getRelations() != null
- && pNode.getRelations().size() > 0) {
- result.add(next);
- }
- getAllStructureChildren((ProgramElementNode)next, result, showSubMember, showMemberAndType);
- }
- }
+ throw new RuntimeException("unimplemented");
+
+// if (!model.isValid()) return null;
+//
+// HashMap annotations = new HashMap();
+// IProgramElement node = model.findRootNodeForSourceFile(sourceFile);
+// if (node == StructureModel.NO_STRUCTURE) {
+// return null;
+// } else {
+// IProgramElement fileNode = (IProgramElement)node;
+// ArrayList peNodes = new ArrayList();
+// getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType);
+// for (Iterator it = peNodes.iterator(); it.hasNext(); ) {
+// IProgramElement peNode = (IProgramElement)it.next();
+// List entries = new ArrayList();
+// entries.add(peNode);
+// ISourceLocation sourceLoc = peNode.getSourceLocation();
+// if (null != sourceLoc) {
+// Integer hash = new Integer(sourceLoc.getLine());
+// List existingEntry = (List)annotations.get(hash);
+// if (existingEntry != null) {
+// entries.addAll(existingEntry);
+// }
+// annotations.put(hash, entries);
+// }
+// }
+// return annotations;
+// }
}
- public void addListener(StructureModelListener listener) {
+// private void getAllStructureChildren(IProgramElement node, List result, boolean showSubMember, boolean showMemberAndType) {
+// List children = node.getChildren();
+// for (Iterator it = children.iterator(); it.hasNext(); ) {
+// IProgramElement next = (IProgramElement)it.next();
+// if (next instanceof IProgramElement) {
+// IProgramElement pNode = (IProgramElement)next;
+// if (pNode != null
+// && ((pNode.isCode() && showSubMember) || (!pNode.isCode() && showMemberAndType))
+// && pNode.getRelations() != null
+// && pNode.getRelations().size() > 0) {
+// result.add(next);
+// }
+// getAllStructureChildren((IProgramElement)next, result, showSubMember, showMemberAndType);
+// }
+// }
+// }
+
+ public void addListener(IStructureModelListener listener) {
structureListeners.add(listener);
}
- public void removeStructureListener(StructureModelListener listener) {
+ public void removeStructureListener(IStructureModelListener listener) {
structureListeners.remove(listener);
}
private void notifyListeners() {
for (Iterator it = structureListeners.iterator(); it.hasNext(); ) {
- ((StructureModelListener)it.next()).modelUpdated(model);
+ ((IStructureModelListener)it.next()).modelUpdated(model);
}
}
diff --git a/asm/src/org/aspectj/asm/StructureNode.java b/asm/src/org/aspectj/asm/StructureNode.java
deleted file mode 100644
index 2c3322ab9..000000000
--- a/asm/src/org/aspectj/asm/StructureNode.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.*;
-import java.io.*;
-
-import org.aspectj.bridge.*;
-import org.aspectj.bridge.IMessage;
-
-/**
- * Children are non-repeating making the parent-child structure a strict
- * tree.
- *
- * !!! relies on a java.io.Serializable implementation of ISourceLocation
- *
- * @author Mik Kersten
- */
-public abstract class StructureNode implements Serializable, Comparable {
-
- protected StructureNode parent = null;
- protected String name = "";
- protected String kind = "";
- // children.listIterator() should support remove() operation
- protected List children = new ArrayList();
- protected IMessage message = null;
- protected ISourceLocation sourceLocation = null;
-
- /**
- * Used during serialization.
- */
- public StructureNode() { }
-
- public StructureNode(String name, String kind, List children) {
- this.name = name;
- this.kind = kind;
- if (children != null) {
- this.children = children;
- }
- setParents();
- }
-
- public StructureNode(String name, String kind) {
- this.name = name;
- this.kind = kind;
- }
-
- public String toLongString() {
- final StringBuffer buffer = new StringBuffer();
- ModelWalker walker = new ModelWalker() {
- private int depth = 0;
-
- public void preProcess(StructureNode node) {
- for (int i = 0; i < depth; i++) buffer.append(' ');
- buffer.append(node.toString());
- buffer.append('\n');
- depth += 2;
- }
-
- public void postProcess(StructureNode node) {
- depth -= 2;
- }
- };
- walker.process(this);
- return buffer.toString();
- }
-
- public String toString() {
- return name;
- }
-
- public String getKind() {
- return kind;
- }
-
- public List getChildren() {
- return children;
- }
-
- public void addChild(StructureNode child) {
- if (children == null) {
- children = new ArrayList();
- }
- children.add(child);
- child.setParent(this);
- }
-
- public void addChild(int position, StructureNode child) {
- if (children == null) {
- children = new ArrayList();
- }
- children.add(position, child);
- child.setParent(this);
- }
-
- public boolean removeChild(StructureNode child) {
- child.setParent(null);
- return children.remove(child);
- }
-
- public StructureNode walk(ModelWalker walker) {
- for (Iterator it = children.iterator(); it.hasNext(); ) {
- StructureNode child = (StructureNode)it.next();
- walker.process(child);
- }
- return this;
- }
-
-// public boolean equals(Object o) {
-// if (!(o instanceof StructureNode)) return false;
-// StructureNode sn = (StructureNode)o;
-// return objectEqual(sn.getName(), this.getName())
-// && objectEqual(sn.getKind(), this.getKind())
-// && objectEqual(sn.getChildren(), this.getChildren());
-// }
-//
-// protected boolean objectEqual(Object o1, Object o2) {
-// return (o1 == null && o2 == null) || (o1 != null && o1.equals(o2));
-// }
-
- /**
- * Comparison is string-name based only.
- */
- public int compareTo(Object o) throws ClassCastException {
- if (this == o) {
- return 0;
- } else {
- StructureNode sn = (StructureNode)o;
- return this.getName().compareTo(sn.getName());
- }
- }
-
- public String getName() {
- return name;
- }
-
- public ISourceLocation getSourceLocation() {
- return sourceLocation;
- }
-
- public void setSourceLocation(ISourceLocation sourceLocation) {
- this.sourceLocation = sourceLocation;
- }
-
- public IMessage getMessage() {
- return message;
- }
-
- public void setMessage(IMessage message) {
- this.message = message;
- }
-
- public StructureNode getParent() {
- return parent;
- }
-
- public void setParent(StructureNode parent) {
- this.parent = parent;
- }
-
- private void setParents() {
- if (children == null) return;
- for (Iterator it = children.iterator(); it.hasNext(); ) {
- ((StructureNode)it.next()).setParent(this);
- }
- }
-//
-// /**
-// * Creates and returns a copy of this object.
-// */
-// public Object clone() {
-// List cloneChildren = new ArrayList();
-// for (Iterator it = children.iterator(); it.hasNext(); ) {
-// cloneChildren.add(((StructureNode)it.next()).clone());
-// }
-// StructureNode cloneNode = new StructureNode(name, kind, cloneChildren);
-// return cloneNode;
-// }
-
- public void setName(String string) {
- name = string;
- }
-
-}
-
-
-// private void writeObject(ObjectOutputStream s) throws IOException {
-// s.defaultWriteObject();
-// // customized serialization code
-// }
-//
-// private void readObject(ObjectInputStream s) throws IOException {
-// s.defaultReadObject();
-// // customized deserialization code
-// ...
-// // followed by code to update the object, if necessary
-// }
-
-// public void writeExternal(ObjectOutput out) throws IOException {
-// if (this instanceof ProgramElementNode) {
-// out.writeInt(1);
-// writeString(name, out);
-// writeString(kind, out);
-// ((ProgramElementNode)this).writeExternal(out);
-// } if (this instanceof RelationNode) {
-// out.writeInt(1);
-// writeString(name, out);
-// writeString(kind, out);
-// ((RelationNode)this).writeExternal(out);
-// } if (this instanceof LinkNode) {
-// out.writeInt(3);
-// writeString(name, out);
-// writeString(kind, out);
-// ((LinkNode)this).writeExternal(out);
-// } else {
-// out.writeInt(0);
-// writeString(name, out);
-// writeString(kind, out);
-// }
-// }
-//
-// public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-// int kindint = in.readInt();
-// name = readString(in);
-// kind = readString(in);
-//
-// switch (kindint) {
-// case 1:
-// ((StructureNode)it.next()).readExternal(in);
-// break;
-// case 2:
-// ((RelationNode)it.next()).readExternal(in);
-// break;
-// case 3:
-// ((LinkNode)it.next()).readExternal(in);
-// break;
-// }
-// }
-//
-// protected void writeString(String s, ObjectOutput out) throws IOException {
-// out.writeInt(s.length());
-// out.write(s.getBytes());
-// }
-//
-// protected String readString(ObjectInput in) throws IOException {
-// int length = in.readInt();
-// byte[] nameArray = new byte[length];
-// in.read(nameArray, 0, length);
-// return new String(nameArray);
-// }
-//
-
-
diff --git a/asm/src/org/aspectj/asm/StructureNodeFactory.java b/asm/src/org/aspectj/asm/StructureNodeFactory.java
deleted file mode 100644
index 40428739d..000000000
--- a/asm/src/org/aspectj/asm/StructureNodeFactory.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.asm;
-
-import java.util.Hashtable;
-import java.util.List;
-
-/**
- * @author Mik Kersten
- */
-public class StructureNodeFactory {
-
- private static Hashtable programElementNodes = new Hashtable();
-
- private static final ProgramElementNode UNRESOLVED_LINK_NODE = new ProgramElementNode("<error: unresolved link>", ProgramElementNode.Kind.ERROR, null, null, "", "", "", null, null, null, false);
-
- public static void clear() {
- programElementNodes.clear();
- }
-
- public static ProgramElementNode makeNode(List relations, List children) {
- return makeNode(relations, children, false);
- }
-
- public static LinkNode makeLink(boolean terminal) {
- ProgramElementNode peNode = null;
- if (terminal) {
- peNode = makeNode(null, null, false);
- } else {
- peNode = makeNode(null, null, true);
- }
-
- if (peNode == null) {
- return new LinkNode(UNRESOLVED_LINK_NODE);
- } else {
- return new LinkNode(peNode);
- }
- }
-
- private static ProgramElementNode makeNode(List relations, List children, boolean resolve) {
-// if (resolve) {
-// if (astObject instanceof InitializerDec) {
-// InitializerDec initDec = (InitializerDec)astObject;
-// return (ProgramElementNode)programElementNodes.get(initDec.getDeclaringType().getTypeDec());
-// } else if (astObject instanceof Decs) {
-// Decs decs = (Decs)astObject;
-// return (ProgramElementNode)programElementNodes.get(decs.getDeclaringType().getTypeDec());
-// } else {
-// ProgramElementNode peNode = (ProgramElementNode)programElementNodes.get(astObject);
-// if (peNode == null) {
-// return makeNode(astObject, null, null, false);
-// } else {
-// return peNode;
-// }
-// }
-// } else {
-// String declaringType = "";
-// if (astObject.getDeclaringType() != null) {
-// declaringType = astObject.getDeclaringType().toShortString();
-// }
-//
-// org.aspectj.asm.SourceLocation sourceLocation = new org.aspectj.asm.SourceLocation(
-// astObject.getSourceLocation().getSourceFileName(),
-// astObject.getSourceLocation().getBeginLine(),
-// astObject.getSourceLocation().getEndLine(),
-// astObject.getSourceLocation().getBeginColumn());
-//
-// ProgramElementNode newNode = new ProgramElementNode(
-// genSignature(astObject).trim(),
-// genKind(astObject),
-// genModifiers(astObject),
-// genAccessibility(astObject),
-// declaringType,
-// genPackageName(astObject),
-// genFormalComment(astObject),
-// sourceLocation,
-// relations,
-// children,
-// isMemberKind(astObject),
-// astObject);
-// programElementNodes.put(astObject, newNode);
-// newNode.setRunnable(genIsRunnable(newNode));
-// setSpecifiers(astObject, newNode);
-//
-// return newNode;
-// }
- return null;
- }
-
-// private static void setSpecifiers(ASTObject astObject, ProgramElementNode node) {
-// if (astObject instanceof MethodDec) {
-// Method method = ((MethodDec)astObject).getMethod();
-// for (Iterator it = method.getDeclaringType().getDirectSuperTypes().iterator(); it.hasNext(); ) {
-// NameType type = (NameType)it.next();
-// SemanticObject so = type.findMatchingSemanticObject(method);
-//
-// if (so != null && so instanceof Method) {
-//
-// Method superMethod = (Method)so;
-// if (so.isAbstract()) {
-// node.setImplementor(true);
-// } else {
-// node.setOverrider(true);
-// }
-// }
-// }
-// }
-// }
-//
-// private static boolean genIsRunnable(ProgramElementNode node) {
-// if (node.getModifiers().contains(ProgramElementNode.Modifiers.STATIC)
-// && node.getAccessibility().equals(ProgramElementNode.Accessibility.PUBLIC)
-// && node.getSignature().equals("main(String[])")) {
-// return true;
-// } else {
-// return false;
-// }
-// }
-//
-// private static boolean genIsStmntKind(ASTObject astObject) {
-// return astObject instanceof CatchClause
-// || astObject instanceof SOLink
-// || astObject instanceof BasicAssignExpr;
-// }
-//
-// private static List genModifiers(ASTObject astObject) {
-// List modifiers = new ArrayList();
-// if (astObject instanceof Dec) {
-// Dec dec = (Dec)astObject;
-// if (dec.getModifiers().isStrict()) modifiers.add(ProgramElementNode.Modifiers.STRICTFP);
-// if (dec.getModifiers().isAbstract()) modifiers.add(ProgramElementNode.Modifiers.ABSTRACT);
-// if (dec.getModifiers().isSynchronized()) modifiers.add(ProgramElementNode.Modifiers.SYNCHRONIZED);
-// if (dec.getModifiers().isNative()) modifiers.add(ProgramElementNode.Modifiers.NATIVE);
-// if (dec.getModifiers().isFinal()) modifiers.add(ProgramElementNode.Modifiers.FINAL);
-// if (dec.getModifiers().isTransient()) modifiers.add(ProgramElementNode.Modifiers.TRANSIENT);
-// if (dec.getModifiers().isStatic()) modifiers.add(ProgramElementNode.Modifiers.STATIC);
-// if (dec.getModifiers().isVolatile()) modifiers.add(ProgramElementNode.Modifiers.VOLATILE);
-// }
-// return modifiers;
-// }
-//
-// private static ProgramElementNode.Accessibility genAccessibility(ASTObject astObject) {
-// //List modifiers = new ArrayList();
-// if (astObject instanceof Dec) {
-// Dec dec = (Dec)astObject;
-// if (dec.getModifiers().isPublic()) return ProgramElementNode.Accessibility.PUBLIC;
-// if (dec.getModifiers().isProtected()) return ProgramElementNode.Accessibility.PROTECTED;
-// if (dec.getModifiers().isPrivileged()) return ProgramElementNode.Accessibility.PRIVILEGED;
-// if (dec.getModifiers().isPackagePrivate()) return ProgramElementNode.Accessibility.PACKAGE;
-// if (dec.getModifiers().isPrivate()) return ProgramElementNode.Accessibility.PRIVATE;
-// }
-// return ProgramElementNode.Accessibility.PUBLIC;
-// }
-//
-// /**
-// * @todo special cases should be fixes to AST nodes, this should have no instanceof tests.
-// */
-// private static ProgramElementNode.Kind genKind(ASTObject astObject) {
-// if (astObject instanceof CompilationUnit) {
-// return ProgramElementNode.Kind.FILE_JAVA;
-// } else if (genIsStmntKind(astObject)) {
-// return ProgramElementNode.Kind.CODE;
-// } else if (astObject instanceof Dec) {
-// String kindString = ((Dec)astObject).getKind();
-// return ProgramElementNode.Kind.getKindForString(kindString);
-// } else {
-// return ProgramElementNode.Kind.ERROR;
-// }
-// }
-//
-// private static boolean isMemberKind(ASTObject astObject) {
-// if (astObject instanceof Dec) {
-// Dec dec = (Dec)astObject;
-// return dec.getDeclaringType() != null && !dec.getDeclaringType().equals(dec.getName());
-// } else {
-// return false;
-// }
-// }
-//
-// private static String genPackageName(ASTObject astObject) {
-// if (astObject instanceof TypeDec) {
-// return ((TypeDec)astObject).getPackageName();
-// } else if (astObject instanceof CompilationUnit) {
-// return ((CompilationUnit)astObject).getPackageName();
-// } else if (astObject.getDeclaringType() != null) {
-// return astObject.getDeclaringType().getPackageName();
-// } else {
-// return "";
-// }
-// }
-//
-// private static String genDeclaringType(ASTObject astObject) {
-// if (astObject != null && astObject.getDeclaringType() != null) {
-// return astObject.getDeclaringType().toShortString();
-// } else {
-// return null;
-// }
-// }
-//
-// /**
-// * Tries to return the ajdoc generated comment, otherwise returns the raw comment.
-// */
-// private static String genFormalComment(ASTObject astObject) {
-// try {
-// return (String)astObject.getComment().getClass().getMethod("commentText", new Class[]{}).invoke(astObject.getComment(), new Object[]{});
-// } catch (Throwable t) {
-// if (astObject != null) {
-// return astObject.getFormalComment();
-// } else {
-// return "";
-// }
-// }
-// }
-//
-// /**
-// * Specialized signature generation for nodes in the structure model.
-// *
-// * @todo the compiler should generate these names, doing it this way is atrocious
-// */
-// private static String genSignature(ASTObject astObject) {
-// String name = "";
-// if (astObject instanceof CompilationUnit) {
-// return astObject.getSourceFile().getName();
-// } else if (astObject instanceof MethodDec) {
-// Method method = ((MethodDec)astObject).getMethod();
-// return method.getName() + method.getFormals().toShortString();
-// } else if (astObject instanceof TypeDec) {
-// return ((TypeDec)astObject).getSourceExtendedId();
-// } else if (astObject instanceof FieldDec) {
-// return ((FieldDec)astObject).getName();
-// } else if (astObject instanceof ConstructorDec) {
-// ConstructorDec constructorDec = (ConstructorDec)astObject;
-// return constructorDec.getDeclaringType().getSourceExtendedId() + constructorDec.getFormals().toShortString();
-// } else if (astObject instanceof IntroducedDec) {
-// IntroducedDec introDec = (IntroducedDec)astObject;
-// return introDec.getTargets().toShortString() + '.' + genSignature(introDec.getDec());
-//// introDec.toShortString();
-// } else if (astObject instanceof PointcutDec) {
-// PointcutDec pointcutDec = (PointcutDec)astObject;
-// return pointcutDec.getName() + pointcutDec.getFormals().toShortString();
-//// } else if (astObject instanceof CallExpr) {
-//// CallExpr call = (CallExpr)astObject;
-//// name = call.get;
-// } else if (astObject instanceof ShowErrorDec) {
-// ShowErrorDec errorDec = (ShowErrorDec)astObject;
-// return errorDec.toShortString();
-// } else if (astObject instanceof SoftThrowableDec) {
-// SoftThrowableDec softThrowableDec = (SoftThrowableDec)astObject;
-// return softThrowableDec.toShortString();
-// } else if (astObject instanceof IntroducedSuperDec) {
-// IntroducedSuperDec introducedSuperDec = (IntroducedSuperDec)astObject;
-// return introducedSuperDec.toShortString();
-// } else if (astObject instanceof AdviceDec) {
-// AdviceDec adviceDec = (AdviceDec)astObject;
-// return adviceDec.toShortString();
-// } else if (astObject instanceof SOLink) {
-// SOLink soLink = (SOLink)astObject;
-// return genSignature(soLink.getTarget().getCorrespondingDec());
-// } else if (astObject instanceof CatchClause) {
-// CatchClause catchClause = (CatchClause)astObject;
-// return catchClause.getFormal().getType().getSourceExtendedId();
-// } else if (astObject instanceof BasicAssignExpr) {
-// return astObject.unparse();
-//// } else if (genIsStmntKind(astObject)) {
-//// name = astObject.unparse();
-//// name = name.replace('/', ' ');
-//// name = name.replace('*', ' ');
-//// name = name.replace('\n', ' ');
-//// name.trim();
-//// java.util.StringTokenizer st = new java.util.StringTokenizer(name, " ");
-//// String s = "";
-//// while (st.hasMoreElements()) {
-//// s += ((String)st.nextElement()).trim() + " ";
-//// }
-//// name = s;
-//// int endIndex = name.indexOf(')');
-//// if (endIndex != -1) {
-//// name = name.substring(0, endIndex+1);
-//// }
-//// if (name.startsWith("this.")) {
-//// name = name.substring(5);
-//// }
-// } else {
-// return "? " + astObject.toShortString();
-// }
-// }
-}
diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java
new file mode 100644
index 000000000..5fd769e02
--- /dev/null
+++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java
@@ -0,0 +1,364 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * ******************************************************************/
+
+
+package org.aspectj.asm.internal;
+
+import java.util.*;
+
+import org.aspectj.asm.*;
+import org.aspectj.bridge.*;
+import org.aspectj.bridge.IMessage.Kind;
+
+
+/**
+ * @author Mik Kersten
+ */
+public class ProgramElement implements IProgramElement {
+
+ protected IProgramElement parent = null;
+ protected String name = "";
+ // children.listIterator() should support remove() operation
+ protected List children = new ArrayList();
+ protected IMessage message = null;
+ protected ISourceLocation sourceLocation = null;
+
+ private List modifiers = new ArrayList();
+ private List relations = new ArrayList();
+
+ private Kind kind;
+ private Accessibility accessibility;
+ private String declaringType = "";
+ private String formalComment = "";
+ private String packageName = null;
+ private boolean runnable = false;
+ private boolean implementor = false;
+ private boolean overrider = false;
+
+ private String bytecodeName;
+ private String bytecodeSignature;
+ private String fullSignature;
+ private String returnType;
+
+ /**
+ * Used during de-externalization.
+ */
+ public ProgramElement() { }
+
+ /**
+ * Use to create program element nodes that do not correspond to source locations.
+ */
+ public ProgramElement(
+ String name,
+ Kind kind,
+ List children) {
+ this.name = name;
+ this.kind = kind;
+ setChildren(children);
+// System.err.println("> created: " + name + ", children: " + children);
+ }
+
+ public ProgramElement(
+ String name,
+ IProgramElement.Kind kind,
+ ISourceLocation sourceLocation,
+ int modifiers,
+ String formalComment,
+ List children)
+ {
+ this(name, kind, children);
+ this.sourceLocation = sourceLocation;
+ this.kind = kind;
+ this.formalComment = formalComment;
+ this.modifiers = genModifiers(modifiers);
+ this.accessibility = genAccessibility(modifiers);
+ }
+
+ /**
+ * Use to create program element nodes that correspond to source locations.
+ */
+ public ProgramElement(
+ String name,
+ Kind kind,
+ List modifiers,
+ Accessibility accessibility,
+ String declaringType,
+ String packageName,
+ String formalComment,
+ ISourceLocation sourceLocation,
+ List relations,
+ List children,
+ boolean member) {
+
+ this(name, kind, children);
+ this.sourceLocation = sourceLocation;
+ this.kind = kind;
+ this.modifiers = modifiers;
+ this.accessibility = accessibility;
+ this.declaringType = declaringType;
+ this.packageName = packageName;
+ this.formalComment = formalComment;
+ this.relations = relations;
+ }
+
+ public List getModifiers() {
+ return modifiers;
+ }
+
+ public Accessibility getAccessibility() {
+ return accessibility;
+ }
+
+ public String getDeclaringType() {
+ return declaringType;
+ }
+
+ public String getPackageName() {
+ if (kind == Kind.PACKAGE) return getSignature();
+ if (getParent() == null || !(getParent() instanceof IProgramElement)) {
+ return "";
+ }
+ return ((IProgramElement)getParent()).getPackageName();
+ }
+
+ public Kind getKind() {
+ return kind;
+ }
+
+ public String getSignature() {
+ return name;
+ }
+
+ public boolean isCode() {
+ return kind.equals(Kind.CODE);
+ }
+
+ public ISourceLocation getSourceLocation() {
+ return sourceLocation;
+ }
+
+ public void setSourceLocation(ISourceLocation sourceLocation) {
+ this.sourceLocation = sourceLocation;
+ }
+
+ public IMessage getMessage() {
+ return message;
+ }
+
+ public void setMessage(IMessage message) {
+ this.message = message;
+ }
+
+ public IProgramElement getParent() {
+ return parent;
+ }
+
+ public void setParent(IProgramElement parent) {
+ this.parent = parent;
+ }
+
+ public boolean isMemberKind() {
+ return kind.isMemberKind();
+ }
+
+ public void setRunnable(boolean value) {
+ this.runnable = value;
+ }
+
+ public boolean isRunnable() {
+ return runnable;
+ }
+
+ public boolean isImplementor() {
+ return implementor;
+ }
+
+ public void setImplementor(boolean value) {
+ this.implementor = value;
+ }
+
+ public boolean isOverrider() {
+ return overrider;
+ }
+
+ public void setOverrider(boolean value) {
+ this.overrider = value;
+ }
+
+ public List getRelations() {
+ return relations;
+ }
+
+ public void setRelations(List relations) {
+ if (relations.size() > 0) {
+ this.relations = relations;
+ }
+ }
+
+ public String getFormalComment() {
+ return formalComment;
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ public static List genModifiers(int modifiers) {
+ List modifiersList = new ArrayList();
+ if ((modifiers & AccStatic) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
+ if ((modifiers & AccFinal) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
+ if ((modifiers & AccSynchronized) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
+ if ((modifiers & AccVolatile) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
+ if ((modifiers & AccTransient) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
+ if ((modifiers & AccNative) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
+ if ((modifiers & AccAbstract) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC);
+ return modifiersList;
+ }
+
+ public static IProgramElement.Accessibility genAccessibility(int modifiers) {
+ if ((modifiers & AccPublic) != 0) return IProgramElement.Accessibility.PUBLIC;
+ if ((modifiers & AccPrivate) != 0) return IProgramElement.Accessibility.PRIVATE;
+ if ((modifiers & AccProtected) != 0) return IProgramElement.Accessibility.PROTECTED;
+ if ((modifiers & AccPrivileged) != 0) return IProgramElement.Accessibility.PRIVILEGED;
+ else return IProgramElement.Accessibility.PACKAGE;
+ }
+
+
+
+ // XXX these names and values are from org.eclipse.jdt.internal.compiler.env.IConstants
+ 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;
+
+
+ public String getBytecodeName() {
+ return bytecodeName;
+ }
+
+ public String getBytecodeSignature() {
+ return bytecodeSignature;
+ }
+
+ public void setBytecodeName(String bytecodeName) {
+ this.bytecodeName = bytecodeName;
+ }
+
+ public void setBytecodeSignature(String bytecodeSignature) {
+ this.bytecodeSignature = bytecodeSignature;
+ }
+
+ public String getFullSignature() {
+ return fullSignature;
+ }
+
+ public void setFullSignature(String string) {
+ fullSignature = string;
+ }
+
+ public void setKind(Kind kind) {
+ this.kind = kind;
+ }
+
+ public void setReturnType(String returnType) {
+ this.returnType = returnType;
+ }
+
+ public String getReturnType() {
+ return returnType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List getChildren() {
+ return children;
+ }
+
+ public void setChildren(List children) {
+ this.children = children;
+ if (children == null) return;
+ for (Iterator it = children.iterator(); it.hasNext(); ) {
+ ((IProgramElement)it.next()).setParent(this);
+ }
+ }
+
+ public void addChild(IProgramElement child) {
+ if (children == null) {
+ children = new ArrayList();
+ }
+ children.add(child);
+ child.setParent(this);
+ }
+
+ public void addChild(int position, IProgramElement child) {
+ if (children == null) {
+ children = new ArrayList();
+ }
+ children.add(position, child);
+ child.setParent(this);
+ }
+
+ public boolean removeChild(IProgramElement child) {
+ child.setParent(null);
+ return children.remove(child);
+ }
+
+ public void setName(String string) {
+ name = string;
+ }
+
+// private void setParents() {
+//// System.err.println(">> setting parents on: " + name);
+// if (children == null) return;
+// for (Iterator it = children.iterator(); it.hasNext(); ) {
+// ((IProgramElement)it.next()).setParent(this);
+// }
+// }
+
+ public IProgramElement walk(HierarchyWalker walker) {
+ for (Iterator it = children.iterator(); it.hasNext(); ) {
+ IProgramElement child = (IProgramElement)it.next();
+ walker.process(child);
+ }
+ return this;
+ }
+
+ public String toLongString() {
+ final StringBuffer buffer = new StringBuffer();
+ HierarchyWalker walker = new HierarchyWalker() {
+ private int depth = 0;
+
+ public void preProcess(IProgramElement node) {
+ for (int i = 0; i < depth; i++) buffer.append(' ');
+ buffer.append(node.toString());
+ buffer.append('\n');
+ depth += 2;
+ }
+
+ public void postProcess(IProgramElement node) {
+ depth -= 2;
+ }
+ };
+ walker.process(this);
+ return buffer.toString();
+ }
+}
+
diff --git a/asm/src/org/aspectj/asm/internal/Relationship.java b/asm/src/org/aspectj/asm/internal/Relationship.java
new file mode 100644
index 000000000..bb26501dc
--- /dev/null
+++ b/asm/src/org/aspectj/asm/internal/Relationship.java
@@ -0,0 +1,53 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * ******************************************************************/
+
+
+package org.aspectj.asm.internal;
+
+import java.util.List;
+
+import org.aspectj.asm.*;
+import org.aspectj.asm.IRelationship;
+import org.aspectj.asm.IRelationship.Kind;
+
+
+/**
+ * @author Mik Kersten
+ */
+public class Relationship implements IRelationship {
+
+ private String name = null;
+ private IProgramElement source = null;
+ private List/*IProgramElement*/ targets = null;
+ private Kind kind = null;
+
+ public Relationship(String name, IProgramElement source, List targets, Kind kind) {
+ this.name = name;
+ this.source = source;
+ this.targets = targets;
+ this.kind = kind;
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public IProgramElement getSource() {
+ return null;
+ }
+
+ public List getTargets() {
+ return null;
+ }
+
+ public Kind getKind() {
+ return null;
+ }
+}