summaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authormkersten <mkersten>2003-08-14 17:18:34 +0000
committermkersten <mkersten>2003-08-14 17:18:34 +0000
commit56d4d719ba6e1ff20efe3f1003aa8eec8d5b88a2 (patch)
tree98aed82a88fcdef2d0aaf660ce44f9ec8bb8896d /asm
parentb5d8b449c79cbedc82e03381cc459ae8c8ae9718 (diff)
downloadaspectj-56d4d719ba6e1ff20efe3f1003aa8eec8d5b88a2.tar.gz
aspectj-56d4d719ba6e1ff20efe3f1003aa8eec8d5b88a2.zip
Improved declare relationships. Implemented batch-build relationship clearing policy.
Diffstat (limited to 'asm')
-rw-r--r--asm/src/org/aspectj/asm/IProgramElement.java2
-rw-r--r--asm/src/org/aspectj/asm/IRelationshipMap.java5
-rw-r--r--asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java2
-rw-r--r--asm/src/org/aspectj/asm/internal/ProgramElement.java21
-rw-r--r--asm/src/org/aspectj/asm/internal/RelationshipMap.java4
5 files changed, 29 insertions, 5 deletions
diff --git a/asm/src/org/aspectj/asm/IProgramElement.java b/asm/src/org/aspectj/asm/IProgramElement.java
index 42a83d2b3..0c1b0595c 100644
--- a/asm/src/org/aspectj/asm/IProgramElement.java
+++ b/asm/src/org/aspectj/asm/IProgramElement.java
@@ -24,8 +24,6 @@ import org.aspectj.bridge.*;
*/
public interface IProgramElement extends Serializable {
- public static final String ID_DELIM = "|";
-
public List/*IProgramElement*/ getChildren();
public void setChildren(List children);
diff --git a/asm/src/org/aspectj/asm/IRelationshipMap.java b/asm/src/org/aspectj/asm/IRelationshipMap.java
index b5a12e534..f487ce661 100644
--- a/asm/src/org/aspectj/asm/IRelationshipMap.java
+++ b/asm/src/org/aspectj/asm/IRelationshipMap.java
@@ -64,5 +64,10 @@ public interface IRelationshipMap extends Serializable {
public void remove(String handle, IRelationship relationship);
public void removeAll(String source);
+
+ /**
+ * Clear all of the relationships in the map.
+ */
+ public void clear();
}
diff --git a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
index 6a523da11..e8d2f9902 100644
--- a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
+++ b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
@@ -270,7 +270,7 @@ public class AspectJElementHierarchy implements IHierarchy {
// TODO: optimize this lookup
public IProgramElement findElementForHandle(String handle) {
- StringTokenizer st = new StringTokenizer(handle, IProgramElement.ID_DELIM);
+ StringTokenizer st = new StringTokenizer(handle, ProgramElement.ID_DELIM);
String file = st.nextToken();
int line = new Integer(st.nextToken()).intValue();
int col = new Integer(st.nextToken()).intValue();
diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java
index ff509689d..830b323bd 100644
--- a/asm/src/org/aspectj/asm/internal/ProgramElement.java
+++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java
@@ -13,12 +13,11 @@
package org.aspectj.asm.internal;
-import java.io.IOException;
+import java.io.*;
import java.util.*;
import org.aspectj.asm.*;
import org.aspectj.bridge.*;
-import org.aspectj.bridge.IMessage.Kind;
/**
@@ -26,6 +25,8 @@ import org.aspectj.bridge.IMessage.Kind;
*/
public class ProgramElement implements IProgramElement {
+ static final String ID_DELIM = "|";
+
protected IProgramElement parent = null;
protected String name = "";
// children.listIterator() should support remove() operation
@@ -391,6 +392,22 @@ public class ProgramElement implements IProgramElement {
return label;
}
+ // TODO: determine if using canonical path incurrs performance overhead
+ public static String createHandleIdentifier(File sourceFile, int line,int column) {
+ try {
+ StringBuffer sb = new StringBuffer();
+ sb.append(sourceFile.getCanonicalPath());
+ sb.append(ID_DELIM);
+ sb.append(line);
+ sb.append(ID_DELIM);
+ sb.append(column);
+ return sb.toString();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ return null;
+ }
+ }
+
public String getHandleIdentifier() {
try {
StringBuffer sb = new StringBuffer();
diff --git a/asm/src/org/aspectj/asm/internal/RelationshipMap.java b/asm/src/org/aspectj/asm/internal/RelationshipMap.java
index cd7e776c6..86f9606f1 100644
--- a/asm/src/org/aspectj/asm/internal/RelationshipMap.java
+++ b/asm/src/org/aspectj/asm/internal/RelationshipMap.java
@@ -111,4 +111,8 @@ public class RelationshipMap extends HashMap implements IRelationshipMap {
put(source.getHandleIdentifier(), relationship);
}
+ public void clear() {
+ super.clear();
+ }
+
}