Browse Source

Updates for annotation binding. Support for static methods !!

tags/Root_AspectJ5_Development
aclement 19 years ago
parent
commit
51aedc9a20

+ 1
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java View File

@@ -233,6 +233,7 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName {
public boolean hasAnnotation(TypeX ofType) {
Annotation[] as = declaration.annotations;
if (as == null) return false;
for (int i = 0; i < as.length; i++) {
Annotation annotation = as[i];
String tname = CharOperation.charToString(annotation.resolvedType.constantPoolName());

+ 5
- 4
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java View File

@@ -1309,7 +1309,7 @@ public class BcelShadow extends Shadow {
// !!! Refactor these once all shadow kinds added - there is lots of commonality
if (getKind() == Shadow.MethodCall) {
ResolvedMember rm[] = this.getTargetType().getDeclaredMethods(world);
ResolvedMember rm[] = getSignature().getDeclaringType().getDeclaredMethods(world);
ResolvedMember found = null;
String searchString = getSignature().getName()+getSignature().getParameterSignature();
for (int i = 0; i < rm.length; i++) {
@@ -1321,11 +1321,12 @@ public class BcelShadow extends Shadow {
ResolvedTypeX[] anns = found.getAnnotationTypes();
for (int i = 0; i < anns.length; i++) {
ResolvedTypeX typeX = anns[i];
kindedAnnotationVars.put(typeX,new KindedAnnotationAccessVar(typeX.resolve(world),(BcelVar)getTargetVar(),getSignature()));
kindedAnnotationVars.put(typeX,
new KindedAnnotationAccessVar(typeX.resolve(world),getSignature().getDeclaringType(),getSignature()));
}
}
if (getKind() == Shadow.MethodExecution) {
ResolvedMember rm[] = this.getTargetType().getDeclaredMethods(world);
ResolvedMember rm[] = getSignature().getDeclaringType().getDeclaredMethods(world);
ResolvedMember found = null;
String searchString = getSignature().getName()+getSignature().getParameterSignature();
for (int i = 0; i < rm.length; i++) {
@@ -1337,7 +1338,7 @@ public class BcelShadow extends Shadow {
ResolvedTypeX[] anns = found.getAnnotationTypes();
for (int i = 0; i < anns.length; i++) {
ResolvedTypeX typeX = anns[i];
kindedAnnotationVars.put(typeX,new KindedAnnotationAccessVar(typeX.resolve(world),(BcelVar)getTargetVar(),getSignature()));
kindedAnnotationVars.put(typeX,new KindedAnnotationAccessVar(typeX.resolve(world),getSignature().getDeclaringType(),getSignature()));
}
}
// if (getKind() == Shadow.FieldSet) {

+ 3
- 3
weaver/src/org/aspectj/weaver/bcel/KindedAnnotationAccessVar.java View File

@@ -33,7 +33,7 @@ public class KindedAnnotationAccessVar extends BcelVar {

private Member stackField;
private int index;
BcelVar target;
TypeX target;
Member sig;

// public KindedAnnotationAccessVar(ResolvedTypeX type, Member stackField, int index) {
@@ -42,7 +42,7 @@ public class KindedAnnotationAccessVar extends BcelVar {
// this.index = index;
// }
public KindedAnnotationAccessVar(ResolvedTypeX type,BcelVar theTargetIsStoredHere,Member sig) {
public KindedAnnotationAccessVar(ResolvedTypeX type,TypeX theTargetIsStoredHere,Member sig) {
super(type,0);
target = theTargetIsStoredHere;
this.sig = sig;
@@ -94,7 +94,7 @@ public class KindedAnnotationAccessVar extends BcelVar {
// Calls getClass
// System.err.println("What is the class of target? "+target.getType());
il.append(fact.createConstant(BcelWorld.makeBcelType(target.getType())));
il.append(fact.createConstant(BcelWorld.makeBcelType(target)));
// il.append(target.createLoad(fact));
// il.append(fact.createInvoke("java/lang/Object","getClass",jlClass,new Type[]{},Constants.INVOKEVIRTUAL));

Loading…
Cancel
Save