import org.aspectj.apache.bcel.classfile.annotation.ElementValue;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
import org.aspectj.weaver.AnnotationNameValuePair;
import org.aspectj.weaver.AnnotationValue;
import org.aspectj.weaver.ArrayAnnotationValue;
+import org.aspectj.weaver.ClassAnnotationValue;
import org.aspectj.weaver.EnumAnnotationValue;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.SimpleAnnotationValue;
}
} else {
// class type
+ if (defaultValue instanceof ClassLiteralAccess) {
+ ClassLiteralAccess cla = (ClassLiteralAccess)defaultValue;
+ ClassAnnotationValue cav = new ClassAnnotationValue(new String(cla.targetType.signature()));
+ return cav;
+ }
throw new MissingImplementationException(
"Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value [" + defaultValue
+ "]");
- // if (contentsOffset + 3 >= this.contents.length) {
- // resizeContents(3);
- // }
- // contents[contentsOffset++] = (byte) 'c';
- // if (defaultValue instanceof ClassLiteralAccess) {
- // ClassLiteralAccess classLiteralAccess = (ClassLiteralAccess)
- // defaultValue;
- // final int classInfoIndex =
- // constantPool.literalIndex(classLiteralAccess
- // .targetType.signature());
- // contents[contentsOffset++] = (byte) (classInfoIndex >> 8);
- // contents[contentsOffset++] = (byte) classInfoIndex;
- // } else {
- // contentsOffset = attributeOffset;
- // }
}
} else {
throw new MissingImplementationException(
--- /dev/null
+// HasMethod with anno value matching
+
+@interface I {
+ Class i();
+}
+aspect A {
+ declare parents: hasmethod(@I(i=String.class) * *(..)) implements java.io.Serializable;
+}
+
+public class B {
+@I(i=String.class) public void m() {}
+ public static void main(String []argv) {
+ B b = new B();
+ if (!(b instanceof java.io.Serializable)) throw new IllegalStateException("");
+ }
+}
+class C {
+@I(i=Integer.class) public void m() {}
+}
+