--- /dev/null
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MyAnnotation {
+ MyEnum[] value();
+}
\ No newline at end of file
--- /dev/null
+import java.util.Arrays;
+
+privileged public aspect MyAspect {
+
+ Object around(MyClass o, MyAnnotation a) :
+ execution(@MyAnnotation * *(..)) &&
+ target(o) &&
+ @annotation(a) {
+ if (!isOneOf(o.getValue(), a.value()))
+ throw new IllegalStateException(
+ o.getValue() +
+ " is not one of " +
+ Arrays.toString(a.value()));
+ return proceed(o, a);
+ }
+
+ private static final <T> boolean isOneOf(T obj, T[] arr) {
+ for (T el : arr) if (obj == el) return true;
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+public class MyClass {
+
+ public MyEnum getValue() {
+ return MyEnum.ONE;
+ }
+
+ @MyAnnotation({ MyEnum.ONE, MyEnum.TWO })
+ public void test() {
+ }
+
+ public static void main(String[] args) {
+ new MyClass().test();
+ }
+}
\ No newline at end of file
--- /dev/null
+public enum MyEnum {
+ ONE, TWO, THREE, FOUR, FIVE
+}
\ No newline at end of file
<ajc-test dir="bugs152/pr148537" title="classcast annotation value">
<compile files="MyClass.java,MyAspect.java" options="-1.5"/>
</ajc-test>
+
+ <ajc-test dir="bugs152/pr148545" title="nosuchmethoderror for privileged aspect">
+ <compile files="MyClass.java,MyAspect.java,MyAnnotation.java,MyEnum.java" options="-1.5"/>
+ <run class="MyClass"/>
+ </ajc-test>
<ajc-test dir="bugs152/pr145391" title="itd calling generic method - 2">
<compile files="GenericType2.java" options="-1.5"/>