summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-06-25 18:50:54 +0000
committeraclement <aclement>2006-06-25 18:50:54 +0000
commit75a17318a97a8528c2604ada7ce159b3e46f12a6 (patch)
tree0a7635f5a7fef0de63cef00174937e206a29c480
parent045e82d5cebc9c9674ac71cffa3fefc34eeb042f (diff)
downloadaspectj-75a17318a97a8528c2604ada7ce159b3e46f12a6.tar.gz
aspectj-75a17318a97a8528c2604ada7ce159b3e46f12a6.zip
testcode for 148545
-rw-r--r--tests/bugs152/pr148545/MyAnnotation.java7
-rw-r--r--tests/bugs152/pr148545/MyAspect.java21
-rw-r--r--tests/bugs152/pr148545/MyClass.java14
-rw-r--r--tests/bugs152/pr148545/MyEnum.java3
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/ajc152.xml5
5 files changed, 50 insertions, 0 deletions
diff --git a/tests/bugs152/pr148545/MyAnnotation.java b/tests/bugs152/pr148545/MyAnnotation.java
new file mode 100644
index 000000000..309275641
--- /dev/null
+++ b/tests/bugs152/pr148545/MyAnnotation.java
@@ -0,0 +1,7 @@
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MyAnnotation {
+ MyEnum[] value();
+} \ No newline at end of file
diff --git a/tests/bugs152/pr148545/MyAspect.java b/tests/bugs152/pr148545/MyAspect.java
new file mode 100644
index 000000000..b42f52b25
--- /dev/null
+++ b/tests/bugs152/pr148545/MyAspect.java
@@ -0,0 +1,21 @@
+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
diff --git a/tests/bugs152/pr148545/MyClass.java b/tests/bugs152/pr148545/MyClass.java
new file mode 100644
index 000000000..194e9b4b8
--- /dev/null
+++ b/tests/bugs152/pr148545/MyClass.java
@@ -0,0 +1,14 @@
+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
diff --git a/tests/bugs152/pr148545/MyEnum.java b/tests/bugs152/pr148545/MyEnum.java
new file mode 100644
index 000000000..cfbcb38b1
--- /dev/null
+++ b/tests/bugs152/pr148545/MyEnum.java
@@ -0,0 +1,3 @@
+public enum MyEnum {
+ ONE, TWO, THREE, FOUR, FIVE
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
index aba07f7bc..4c916532a 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
+++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
@@ -112,6 +112,11 @@
<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"/>