diff options
author | aclement <aclement> | 2005-07-18 08:34:11 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-07-18 08:34:11 +0000 |
commit | e15794a2aa3c981571d54ff370c6e4f1d9ee97b1 (patch) | |
tree | e5fa3872d447ad70566746b0a0e697a40eac59f5 /tests/bugs150/pr98901 | |
parent | bba9c50768a1db72fc8606a80762333d4b12d140 (diff) | |
download | aspectj-e15794a2aa3c981571d54ff370c6e4f1d9ee97b1.tar.gz aspectj-e15794a2aa3c981571d54ff370c6e4f1d9ee97b1.zip |
testcases for pr98901 (annotations copied to targets of decannotation). Not yet wired into the full 150 suite.
Diffstat (limited to 'tests/bugs150/pr98901')
29 files changed, 813 insertions, 0 deletions
diff --git a/tests/bugs150/pr98901/Case01.aj b/tests/bugs150/pr98901/Case01.aj new file mode 100644 index 000000000..150775229 --- /dev/null +++ b/tests/bugs150/pr98901/Case01.aj @@ -0,0 +1,28 @@ +// "public method with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A01{ + public void a(){} +} + +aspect B01 { + declare @method : void A01.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A01.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case02.aj b/tests/bugs150/pr98901/Case02.aj new file mode 100644 index 000000000..2ad28a606 --- /dev/null +++ b/tests/bugs150/pr98901/Case02.aj @@ -0,0 +1,25 @@ +//"public method on the aspect that declares @method on it" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +aspect B02 { + public void a(){} + declare @method : void B02.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = B02.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case03.aj b/tests/bugs150/pr98901/Case03.aj new file mode 100644 index 000000000..d522c9df5 --- /dev/null +++ b/tests/bugs150/pr98901/Case03.aj @@ -0,0 +1,28 @@ +//"public annotated method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A03{ + @anInterface + public void a(){} +} + +aspect B03 { + + public static void main(String [] args){ + Class c = A03.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case04.aj b/tests/bugs150/pr98901/Case04.aj new file mode 100644 index 000000000..93e7b7224 --- /dev/null +++ b/tests/bugs150/pr98901/Case04.aj @@ -0,0 +1,29 @@ +// "public ITD method with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A04{ +} + +aspect B04 { + + public void A04.a(){} + declare @method : void A04.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A04.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case05.aj b/tests/bugs150/pr98901/Case05.aj new file mode 100644 index 000000000..321572b6c --- /dev/null +++ b/tests/bugs150/pr98901/Case05.aj @@ -0,0 +1,29 @@ +// "public annotated ITD method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A05{ +} + +aspect B05 { + + @anInterface + public void A05.a(){} + + public static void main(String [] args){ + Class c = A05.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case06.aj b/tests/bugs150/pr98901/Case06.aj new file mode 100644 index 000000000..4faefb144 --- /dev/null +++ b/tests/bugs150/pr98901/Case06.aj @@ -0,0 +1,26 @@ +// "public ITD-on-itself method with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +aspect B06 { + + public void B06.a(){} + declare @method : void B06.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = B06.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case07.aj b/tests/bugs150/pr98901/Case07.aj new file mode 100644 index 000000000..b437076af --- /dev/null +++ b/tests/bugs150/pr98901/Case07.aj @@ -0,0 +1,26 @@ +//"public annotated ITD-on-itself method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +aspect B07 { + + @anInterface + public void B07.a(){} + + public static void main(String [] args){ + Class c = B07.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case08.aj b/tests/bugs150/pr98901/Case08.aj new file mode 100644 index 000000000..dcb10fc85 --- /dev/null +++ b/tests/bugs150/pr98901/Case08.aj @@ -0,0 +1,29 @@ +// "public method on an Interface with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A08{ + public void a(); +} + +aspect B08 { + + declare @method : void A08.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A08.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case09.aj b/tests/bugs150/pr98901/Case09.aj new file mode 100644 index 000000000..0d4c88b07 --- /dev/null +++ b/tests/bugs150/pr98901/Case09.aj @@ -0,0 +1,28 @@ +// "public annotated method on an Interface" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A09{ + @anInterface + public void a(); +} + +aspect B09 { + + public static void main(String [] args){ + Class c = A09.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case10.aj b/tests/bugs150/pr98901/Case10.aj new file mode 100644 index 000000000..756f62b53 --- /dev/null +++ b/tests/bugs150/pr98901/Case10.aj @@ -0,0 +1,29 @@ +// "public ITD method onto an Interface with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A10{ +} + +aspect B10 { + + public void A10.a(){} + declare @method : void A10.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A10.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case11.aj b/tests/bugs150/pr98901/Case11.aj new file mode 100644 index 000000000..2ca05c525 --- /dev/null +++ b/tests/bugs150/pr98901/Case11.aj @@ -0,0 +1,29 @@ +//"public annotated ITD method onto an Interface" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A11{ +} + +aspect B11 { + + @anInterface + public void A11.a(){} + + public static void main(String [] args){ + Class c = A11.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case12.aj b/tests/bugs150/pr98901/Case12.aj new file mode 100644 index 000000000..eebe82497 --- /dev/null +++ b/tests/bugs150/pr98901/Case12.aj @@ -0,0 +1,29 @@ +// "public abstract method with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +abstract class A12{ + public abstract void a(); +} + +aspect B12 { + + declare @method : abstract void A12.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A12.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case13.aj b/tests/bugs150/pr98901/Case13.aj new file mode 100644 index 000000000..0e113cd4e --- /dev/null +++ b/tests/bugs150/pr98901/Case13.aj @@ -0,0 +1,28 @@ +// "public abstract method on the aspect that declares @method on it" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +abstract aspect A13{ + public abstract void a(); + declare @method : abstract void A13.a(..) : @anInterface; +} + +aspect B13 { + + public static void main(String [] args){ + Class c = A13.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case14.aj b/tests/bugs150/pr98901/Case14.aj new file mode 100644 index 000000000..2edbb457c --- /dev/null +++ b/tests/bugs150/pr98901/Case14.aj @@ -0,0 +1,28 @@ +// "public abstract annotated method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +abstract class A14{ + @anInterface + public abstract void a(); +} + +aspect B14 { + + public static void main(String [] args){ + Class c = A14.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case15.aj b/tests/bugs150/pr98901/Case15.aj new file mode 100644 index 000000000..4326f6730 --- /dev/null +++ b/tests/bugs150/pr98901/Case15.aj @@ -0,0 +1,29 @@ +// "public abstract ITD method with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +abstract class A15{ +} + +aspect B15 { + + public abstract void A15.a(); + declare @method : abstract void A15.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A15.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case16.aj b/tests/bugs150/pr98901/Case16.aj new file mode 100644 index 000000000..38f5965c6 --- /dev/null +++ b/tests/bugs150/pr98901/Case16.aj @@ -0,0 +1,29 @@ +// "public abstract annotated ITD method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +abstract class A16{ +} + +aspect B16 { + + @anInterface + public abstract void A16.a(); + + public static void main(String [] args){ + Class c = A16.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case17.aj b/tests/bugs150/pr98901/Case17.aj new file mode 100644 index 000000000..5bcca8021 --- /dev/null +++ b/tests/bugs150/pr98901/Case17.aj @@ -0,0 +1,28 @@ +// "public abstract ITD-on-itself method with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +abstract aspect A17 { + public abstract void A17.a(); + declare @method : abstract void A17.a(..) : @anInterface; +} + +aspect B17 { + + public static void main(String [] args){ + Class c = A17.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case18.aj b/tests/bugs150/pr98901/Case18.aj new file mode 100644 index 000000000..3a1d1b608 --- /dev/null +++ b/tests/bugs150/pr98901/Case18.aj @@ -0,0 +1,28 @@ +// "public abstract annotated ITD-on-itself method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +abstract aspect A18 { + @anInterface + public abstract void A18.a(); +} + +aspect B18 { + + public static void main(String [] args){ + Class c = A18.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case19.aj b/tests/bugs150/pr98901/Case19.aj new file mode 100644 index 000000000..ed4d91764 --- /dev/null +++ b/tests/bugs150/pr98901/Case19.aj @@ -0,0 +1,29 @@ +//"public abstract method on an Interface with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A19 { + public abstract void a(); +} + +aspect B19 { + + declare @method : abstract void A19.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A19.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case20.aj b/tests/bugs150/pr98901/Case20.aj new file mode 100644 index 000000000..091287e37 --- /dev/null +++ b/tests/bugs150/pr98901/Case20.aj @@ -0,0 +1,28 @@ +// "public abstract annotated method on an Interface" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A20 { + @anInterface + public abstract void a(); +} + +aspect B20 { + + public static void main(String [] args){ + Class c = A20.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case21.aj b/tests/bugs150/pr98901/Case21.aj new file mode 100644 index 000000000..2da5b4433 --- /dev/null +++ b/tests/bugs150/pr98901/Case21.aj @@ -0,0 +1,29 @@ +// "public abstract ITD method onto an Interface with declare @method" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A21 { +} + +aspect B21 { + + public abstract void A21.a(); + declare @method : abstract void A21.a(..) : @anInterface; + + public static void main(String [] args){ + Class c = A21.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case22.aj b/tests/bugs150/pr98901/Case22.aj new file mode 100644 index 000000000..fbadf80ca --- /dev/null +++ b/tests/bugs150/pr98901/Case22.aj @@ -0,0 +1,29 @@ +// "public abstract annotated ITD method onto an Interface" + +import java.lang.annotation.*; +import java.lang.reflect.Method; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +interface A22 { +} + +aspect B22 { + + @anInterface + public abstract void A22.a(); + + public static void main(String [] args){ + Class c = A22.class; + try { + Method m = c.getDeclaredMethod("a", new Class [0]); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case23.aj b/tests/bugs150/pr98901/Case23.aj new file mode 100644 index 000000000..53a112719 --- /dev/null +++ b/tests/bugs150/pr98901/Case23.aj @@ -0,0 +1,29 @@ +// "public field with declare @field" + +import java.lang.annotation.*; +import java.lang.reflect.Field; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A23 { + public int a; +} + +aspect B23 { + + declare @field : int A23.a : @anInterface; + + public static void main(String [] args){ + Class c = A23.class; + try { + Field m = c.getDeclaredField("a"); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case24.aj b/tests/bugs150/pr98901/Case24.aj new file mode 100644 index 000000000..c01d122e1 --- /dev/null +++ b/tests/bugs150/pr98901/Case24.aj @@ -0,0 +1,26 @@ +// "public field on the aspect that declares @field on it" + +import java.lang.annotation.*; +import java.lang.reflect.Field; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +aspect B24 { + + public int a; + declare @field : int B24.a : @anInterface; + + public static void main(String [] args){ + Class c = B24.class; + try { + Field m = c.getDeclaredField("a"); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case25.aj b/tests/bugs150/pr98901/Case25.aj new file mode 100644 index 000000000..d67f97343 --- /dev/null +++ b/tests/bugs150/pr98901/Case25.aj @@ -0,0 +1,28 @@ +// "public annotated field" + +import java.lang.annotation.*; +import java.lang.reflect.Field; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A25{ + @anInterface + public int a; +} + +aspect B25 { + + public static void main(String [] args){ + Class c = A25.class; + try { + Field m = c.getDeclaredField("a"); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case26.aj b/tests/bugs150/pr98901/Case26.aj new file mode 100644 index 000000000..0637d71c0 --- /dev/null +++ b/tests/bugs150/pr98901/Case26.aj @@ -0,0 +1,29 @@ +// "public ITD field with declare @field" + +import java.lang.annotation.*; +import java.lang.reflect.Field; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A26{ +} + +aspect B26 { + + public int A26.a; + declare @field : int A26.a : @anInterface; + + public static void main(String [] args){ + Class c = A26.class; + try { + Field m = c.getDeclaredField("a"); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case27.aj b/tests/bugs150/pr98901/Case27.aj new file mode 100644 index 000000000..661d911af --- /dev/null +++ b/tests/bugs150/pr98901/Case27.aj @@ -0,0 +1,29 @@ +// "public annotated ITD field" + +import java.lang.annotation.*; +import java.lang.reflect.Field; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +class A27{ +} + +aspect B27 { + + @anInterface + public int A27.a; + + public static void main(String [] args){ + Class c = A27.class; + try { + Field m = c.getDeclaredField("a"); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case28.aj b/tests/bugs150/pr98901/Case28.aj new file mode 100644 index 000000000..00896d7fb --- /dev/null +++ b/tests/bugs150/pr98901/Case28.aj @@ -0,0 +1,26 @@ +// "public ITD-on-itself field with declare @field" + +import java.lang.annotation.*; +import java.lang.reflect.Field; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +aspect B28 { + + public int B28.a; + declare @field : int B28.a : @anInterface; + + public static void main(String [] args){ + Class c = B28.class; + try { + Field m = c.getDeclaredField("a"); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} diff --git a/tests/bugs150/pr98901/Case29.aj b/tests/bugs150/pr98901/Case29.aj new file mode 100644 index 000000000..383588f55 --- /dev/null +++ b/tests/bugs150/pr98901/Case29.aj @@ -0,0 +1,26 @@ +// "public annotated ITD-on-itself field" + +import java.lang.annotation.*; +import java.lang.reflect.Field; + +@Retention(RetentionPolicy.RUNTIME) +@interface anInterface{} + +aspect B29 { + + @anInterface + public int B29.a; + + public static void main(String [] args){ + Class c = B29.class; + try { + Field m = c.getDeclaredField("a"); + Annotation [] anns = m.getDeclaredAnnotations(); + for (int i = 0;i < anns.length;i++){ + System.out.println(anns[i]); + } + } catch (Exception e){ + System.out.println("exceptional!"); + } + } +} |