summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2005-03-11 17:31:40 +0000
committeraclement <aclement>2005-03-11 17:31:40 +0000
commit5375d7f3e1d6c7ce49cd3cccc48daf4ddade1ed3 (patch)
tree844212a8a0fea52819c2c2b7caafe59b1a3c8b68 /weaver
parenta0aeb25088c023f6da9eccfae37fa72acab0f309 (diff)
downloadaspectj-5375d7f3e1d6c7ce49cd3cccc48daf4ddade1ed3.tar.gz
aspectj-5375d7f3e1d6c7ce49cd3cccc48daf4ddade1ed3.zip
Much more robust way to dig round the structure model ...
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java46
1 files changed, 27 insertions, 19 deletions
diff --git a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java
index 2333c2df6..540a4693b 100644
--- a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java
+++ b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.aspectj.apache.bcel.classfile.Field;
import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.apache.bcel.classfile.Utility;
+import org.aspectj.apache.bcel.generic.Type;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
@@ -30,6 +31,7 @@ import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.SourceLocation;
import org.aspectj.weaver.bcel.BcelAdvice;
+
public class AsmRelationshipProvider {
protected static AsmRelationshipProvider INSTANCE = new AsmRelationshipProvider();
@@ -356,25 +358,31 @@ public class AsmRelationshipProvider {
IProgramElement typeElem = AsmManager.getDefault().getHierarchy().findElementForType(pkg,type);
if (typeElem == null) return;
-
- IProgramElement methodElem = null;
- String name = method.getName();
-
- String sig = method.getSignature();
-
- try {
- if (sig.startsWith("(")) sig = sig.substring(1,sig.lastIndexOf(")"));
- String argsSig = (sig.length()==0?"":Utility.signatureToString(sig));
-
- if (name.startsWith("<init>")) {
- // its a ctor
- methodElem = AsmManager.getDefault().getHierarchy().findElementForLabel(typeElem,IProgramElement.Kind.CONSTRUCTOR,type+"("+argsSig+")");
- } else {
- // its a method
- methodElem = AsmManager.getDefault().getHierarchy().findElementForLabel(typeElem,IProgramElement.Kind.METHOD,method.getName()+"("+argsSig+")");
- }
-
-
+
+ // FIXME asc tidy this up you lazy git
+ StringBuffer parmString = new StringBuffer("(");
+ Type[] args = method.getArgumentTypes();
+ for (int i = 0; i < args.length; i++) {
+ Type type2 = args[i];
+ String s = Utility.signatureToString(type2.getSignature());
+ if (s.lastIndexOf(".")!=-1) s =s.substring(s.lastIndexOf(".")+1);
+ parmString.append(s);
+ if ((i+1)<args.length) parmString.append(",");
+ }
+ parmString.append(")");
+ IProgramElement methodElem = null;
+
+ if (method.getName().startsWith("<init>")) {
+ // its a ctor
+ methodElem = AsmManager.getDefault().getHierarchy().findElementForSignature(typeElem,IProgramElement.Kind.CONSTRUCTOR,type+parmString);
+ } else {
+ // its a method
+ methodElem = AsmManager.getDefault().getHierarchy().findElementForSignature(typeElem,IProgramElement.Kind.METHOD,method.getName()+parmString);
+ }
+
+ if (methodElem == null) return;
+
+ try {
String sourceHandle =
ProgramElement.createHandleIdentifier(sourceLocation.getSourceFile(),sourceLocation.getLine(),
sourceLocation.getColumn(),sourceLocation.getOffset());