--- /dev/null
+import java.util.Arrays;
+
+privileged public aspect MyAspect2 {
+
+ Object around(MyClass o, MyAnnotation a) :
+ execution(@MyAnnotation * *(..)) &&
+ target(o) &&
+ @annotation(a) {
+ if (isOneOf(o.getValue(), a.value())==null)
+ throw new IllegalStateException(
+ o.getValue() +
+ " is not one of " +
+ Arrays.toString(a.value()));
+ return proceed(o, a);
+ }
+
+ private static final <T> T isOneOf(T obj, T[] arr) {
+ for (T el : arr) if (obj == el) return obj;
+ return null;
+ }
+}
\ No newline at end of file
// public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");}
// public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");}
public void testPrivilegeGeneric_pr148545() { runTest("nosuchmethoderror for privileged aspect");}
+ public void testPrivilegeGeneric_pr148545_2() { runTest("nosuchmethoderror for privileged aspect - 2");}
public void testUnknownAnnotationNPE() { runTest("NPE for unknown annotation");}
public void testDuplicateBridgeMethods_pr147801_1() { runTest("duplicate bridge methods");}
public void testPackageIgnoredForException_pr147701_1() { runTest("package for exception ignored");}
</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"/>
+ <compile files="MyClass.java,MyAspect.java,MyAnnotation.java,MyEnum.java" options="-1.5"/>
+ <run class="MyClass"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr148545" title="nosuchmethoderror for privileged aspect - 2">
+ <compile files="MyClass.java,MyAspect2.java,MyAnnotation.java,MyEnum.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="Join point 'method-execution(void MyClass.test())' in Type 'MyClass' (MyClass.java:8) advised by around advice from 'MyAspect2' (MyAspect2.java:5)"/>
+ </compile>
+ <run class="MyClass"/>
</ajc-test>
<ajc-test dir="bugs152/pr145391" title="itd calling generic method - 2">