diff options
author | mkersten <mkersten> | 2003-08-05 16:24:05 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-08-05 16:24:05 +0000 |
commit | 5594a6579a215af6f9db9c806f4e331ec6259136 (patch) | |
tree | 83de3d2a7967780c03221f3a1d53dd68c3dc2e39 /asm/src | |
parent | 6c1ca40c54c11315aa5caadf23c8f439b26c41e4 (diff) | |
download | aspectj-5594a6579a215af6f9db9c806f4e331ec6259136.tar.gz aspectj-5594a6579a215af6f9db9c806f4e331ec6259136.zip |
Revised and added tests for ASM containment hierarchy.
Diffstat (limited to 'asm/src')
-rw-r--r-- | asm/src/org/aspectj/asm/LinkNode.java | 4 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/ProgramElementNode.java | 31 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/StructureModel.java | 21 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/StructureNode.java | 5 |
4 files changed, 55 insertions, 6 deletions
diff --git a/asm/src/org/aspectj/asm/LinkNode.java b/asm/src/org/aspectj/asm/LinkNode.java index 5f43f0426..9db0dd2bb 100644 --- a/asm/src/org/aspectj/asm/LinkNode.java +++ b/asm/src/org/aspectj/asm/LinkNode.java @@ -42,7 +42,9 @@ public class LinkNode extends StructureNode { public String toString() { String name = ""; if (programElementNode.getProgramElementKind().equals(ProgramElementNode.Kind.ADVICE) || - programElementNode.getProgramElementKind().equals(ProgramElementNode.Kind.INTRODUCTION) || + 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; diff --git a/asm/src/org/aspectj/asm/ProgramElementNode.java b/asm/src/org/aspectj/asm/ProgramElementNode.java index 06974bfd3..7cacd890e 100644 --- a/asm/src/org/aspectj/asm/ProgramElementNode.java +++ b/asm/src/org/aspectj/asm/ProgramElementNode.java @@ -25,7 +25,7 @@ import org.aspectj.bridge.ISourceLocation; */ public class ProgramElementNode extends StructureNode { - private List modifiers = new ArrayList(); + private List modifiers = new ArrayList(); private List relations = new ArrayList(); private Kind kind; @@ -39,7 +39,8 @@ public class ProgramElementNode extends StructureNode { private String bytecodeName; private String bytecodeSignature; - + private String fullSignature; + private String returnType; /** * Used during de-externalization. @@ -278,7 +279,9 @@ public class ProgramElementNode extends StructureNode { 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 INTRODUCTION = new Kind("introduction"); + 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"); @@ -288,13 +291,15 @@ public class ProgramElementNode extends StructureNode { 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, INTRODUCTION, CONSTRUCTOR, METHOD, FIELD, POINTCUT, ADVICE, - DECLARE_PARENTS, DECLARE_WARNING, DECLARE_ERROR, DECLARE_SOFT, CODE, ERROR }; + 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++) { @@ -384,5 +389,21 @@ public class ProgramElementNode extends StructureNode { 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; + } + } diff --git a/asm/src/org/aspectj/asm/StructureModel.java b/asm/src/org/aspectj/asm/StructureModel.java index a4f2acc9d..3998c41bb 100644 --- a/asm/src/org/aspectj/asm/StructureModel.java +++ b/asm/src/org/aspectj/asm/StructureModel.java @@ -63,6 +63,27 @@ public class StructureModel implements Serializable { return root != null && fileMap != null; } + /** + * Returns the first match + * + * @param parent + * @param kind not null + * @param decErrLabel + * @return null if not found + */ + public ProgramElementNode findNode(ProgramElementNode parent, ProgramElementNode.Kind kind, String name) { + for (Iterator it = parent.getChildren().iterator(); it.hasNext(); ) { + ProgramElementNode node = (ProgramElementNode)it.next(); + if (node.getProgramElementKind().equals(kind) + && name.equals(node.getName())) { + return node; + } else { + ProgramElementNode childSearch = findNode(node, kind, name); + if (childSearch != null) return childSearch; + } + } + return null; + } /** * @param packageName if null default package is searched diff --git a/asm/src/org/aspectj/asm/StructureNode.java b/asm/src/org/aspectj/asm/StructureNode.java index 440e31791..2c3322ab9 100644 --- a/asm/src/org/aspectj/asm/StructureNode.java +++ b/asm/src/org/aspectj/asm/StructureNode.java @@ -188,6 +188,11 @@ public abstract class StructureNode implements Serializable, Comparable { // StructureNode cloneNode = new StructureNode(name, kind, cloneChildren); // return cloneNode; // } + + public void setName(String string) { + name = string; + } + } |