]> source.dussan.org Git - aspectj.git/commitdiff
another scenario for 148545 - generic return type too.
authoraclement <aclement>
Mon, 26 Jun 2006 07:31:36 +0000 (07:31 +0000)
committeraclement <aclement>
Mon, 26 Jun 2006 07:31:36 +0000 (07:31 +0000)
tests/bugs152/pr148545/MyAspect2.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
tests/src/org/aspectj/systemtest/ajc152/ajc152.xml

diff --git a/tests/bugs152/pr148545/MyAspect2.java b/tests/bugs152/pr148545/MyAspect2.java
new file mode 100644 (file)
index 0000000..8d4a769
--- /dev/null
@@ -0,0 +1,21 @@
+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
index 8f5dbcd39d604de1c4f9e8e17d9e3173b4967447..17996d89effbacae3c48101895ef3778b2788110 100644 (file)
@@ -36,6 +36,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 //  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");}
index 4c916532ae0f14196dc3a59f4bc08e9a6c4d8fca..481e3243c5488645d936bc67f0f52243974704b9 100644 (file)
     </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">