From 742ab2e178ff40bf67220c7cb2b54e5042e80d02 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 5 Sep 2008 18:06:07 +0000 Subject: [PATCH] 246125: break bcel dependency in AsmRelationshipProvider --- .../aspectj/weaver/AsmRelationshipProvider.java | 14 +++++--------- .../org/aspectj/weaver/bcel/BcelClassWeaver.java | 16 ++++++++-------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java index e78dbe77f..4683ab7a7 100644 --- a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java +++ b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java @@ -15,10 +15,6 @@ package org.aspectj.weaver; import java.util.Iterator; 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; @@ -351,7 +347,7 @@ public class AsmRelationshipProvider { * read 'fragile') bit of code that could break at any moment but it's working for my simple testcase. Currently just fails * silently if any of the lookup code doesn't find anything... */ - public void addDeclareAnnotationRelationship(ISourceLocation sourceLocation, String typename, Method method) { + public void addDeclareAnnotationMethodRelationship(ISourceLocation sourceLocation, String typename, ResolvedMember method) { if (!AsmManager.isCreatingModel()) return; @@ -368,10 +364,10 @@ public class AsmRelationshipProvider { return; StringBuffer parmString = new StringBuffer("("); - Type[] args = method.getArgumentTypes(); + UnresolvedType[] args = method.getParameterTypes(); +// Type[] args = method.getArgumentTypes(); for (int i = 0; i < args.length; i++) { - Type type2 = args[i]; - String s = Utility.signatureToString(type2.getSignature(), false); + String s = args[i].getName();//Utility.signatureToString(args[i].getName()getSignature(), false); parmString.append(s); if ((i + 1) < args.length) parmString.append(","); @@ -420,7 +416,7 @@ public class AsmRelationshipProvider { * we have no line number info for it, we have to dig through the structure model under the fields' type in order to locate it. * Currently just fails silently if any of the lookup code doesn't find anything... */ - public void addDeclareAnnotationRelationship(ISourceLocation sourceLocation, String typename, Field field) { + public void addDeclareAnnotationFieldRelationship(ISourceLocation sourceLocation, String typename, ResolvedMember field) { if (!AsmManager.isCreatingModel()) return; diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index a58fcf7c6..0414feb86 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -879,8 +879,8 @@ class BcelClassWeaver implements IClassWeaver { annotationsToAdd.add(ag); mg.addAnnotation(decaM.getAnnotationX()); - AsmRelationshipProvider.getDefault().addDeclareAnnotationRelationship(decaM.getSourceLocation(), - clazz.getName(), mg.getMethod()); + AsmRelationshipProvider.getDefault().addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), + clazz.getName(), mg.getMemberView());//getMethod()); reportMethodCtorWeavingMessage(clazz, mg.getMemberView(), decaM, mg.getDeclarationLineNumber()); isChanged = true; modificationOccured = true; @@ -923,8 +923,8 @@ class BcelClassWeaver implements IClassWeaver { annotationsToAdd.add(a); mg.addAnnotation(decaM.getAnnotationX()); - AsmRelationshipProvider.getDefault().addDeclareAnnotationRelationship(decaM.getSourceLocation(), - clazz.getName(), mg.getMethod()); + AsmRelationshipProvider.getDefault().addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), + clazz.getName(), mg.getMemberView());//getMethod()); isChanged = true; modificationOccured = true; forRemoval.add(decaM); @@ -1302,8 +1302,8 @@ class BcelClassWeaver implements IClassWeaver { } } - AsmRelationshipProvider.getDefault().addDeclareAnnotationRelationship(decaF.getSourceLocation(), - clazz.getName(), aBcelField.getFieldAsIs()); + AsmRelationshipProvider.getDefault().addDeclareAnnotationFieldRelationship(decaF.getSourceLocation(), + clazz.getName(), aBcelField);//.getFieldAsIs()); reportFieldAnnotationWeavingMessage(clazz, fields, fieldCounter, decaF); isChanged = true; modificationOccured = true; @@ -1337,8 +1337,8 @@ class BcelClassWeaver implements IClassWeaver { continue; // skip this one... } aBcelField.addAnnotation(decaF.getAnnotationX()); - AsmRelationshipProvider.getDefault().addDeclareAnnotationRelationship(decaF.getSourceLocation(), - clazz.getName(), aBcelField.getFieldAsIs()); + AsmRelationshipProvider.getDefault().addDeclareAnnotationFieldRelationship(decaF.getSourceLocation(), + clazz.getName(), aBcelField);//.getFieldAsIs()); isChanged = true; modificationOccured = true; forRemoval.add(decaF); -- 2.39.5