diff options
14 files changed, 393 insertions, 0 deletions
diff --git a/tests/features161/optimizedAnnotationBinding/Anno.java b/tests/features161/optimizedAnnotationBinding/Anno.java new file mode 100644 index 000000000..2e200afcd --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/Anno.java @@ -0,0 +1,8 @@ +package a.b.c; + +import java.lang.annotation.*; +import x.y.z.Level; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Anno { Level value();} + diff --git a/tests/features161/optimizedAnnotationBinding/CaseEight.java b/tests/features161/optimizedAnnotationBinding/CaseEight.java new file mode 100644 index 000000000..58460069a --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseEight.java @@ -0,0 +1,35 @@ +// CaseEight - annotations in packages two +package p.q.r; + +import java.lang.annotation.*; + +public class CaseEight { + + public static void main(String []argv) { + CaseEight o = new CaseEight(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno(Level.NONE) public void b() {} + @Anno(Level.ONE) public void c() {} + @Anno(Level.TWO) public void d() {} + @Anno(Level.THREE) public void e() {} + + } + + enum Level { NONE, ONE, TWO, THREE; } + + @Retention(RetentionPolicy.RUNTIME) + @interface Anno { Level value();} + +aspect X { + + before(p.q.r.Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseEleven.java b/tests/features161/optimizedAnnotationBinding/CaseEleven.java new file mode 100644 index 000000000..d8f86d80d --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseEleven.java @@ -0,0 +1,35 @@ +// CaseEleven - binding multiple annotation fields +import java.lang.annotation.*; + +public class CaseEleven { + + public static void main(String []argv) { + + CaseEleven o = new CaseEleven(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno(value=Level.NONE,c=Color.RED) public void b() {} + @Anno(value=Level.ONE) public void c() {} + @Anno(value=Level.TWO,c=Color.GREEN) public void d() {} + @Anno(value=Level.THREE,c=Color.BLUE) public void e() {} + +} + +enum Level { NONE, ONE, TWO, THREE; } +enum Color { RED, GREEN, BLUE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { Level value(); Color c() default Color.GREEN; } + +aspect X { + + before(Level l,Color color): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) && @annotation(Anno(color)) { + System.out.println(l+":"+color); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseFive.java b/tests/features161/optimizedAnnotationBinding/CaseFive.java new file mode 100644 index 000000000..59b7c7675 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseFive.java @@ -0,0 +1,23 @@ +// CaseFive - not an enum, compiler limitation +import java.lang.annotation.*; + +public class CaseFive { + + public static void main(String []argv) { + CaseFive o = new CaseFive(); + o.a(); + } + + @Anno("hello") public void a() {} + +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { String value(); } + +aspect X { + + before(String l): execution(@Anno * *(..)) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseFour.java b/tests/features161/optimizedAnnotationBinding/CaseFour.java new file mode 100644 index 000000000..f754af226 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseFour.java @@ -0,0 +1,29 @@ +// CaseFour - default value specified and should be extracted +import java.lang.annotation.*; + +public class CaseFour { + + public static void main(String []argv) { + CaseFour o = new CaseFour(); + o.a(); + o.b(); + o.c(); + } + + @Anno public void a() {} + @Anno(Level.TWO) public void b() {} + @Anno public void c() {} + +} + +enum Level { NONE, ONE, TWO, THREE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { Level value() default Level.ONE;} + +aspect X { + + before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseNine.java b/tests/features161/optimizedAnnotationBinding/CaseNine.java new file mode 100644 index 000000000..9eb950677 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseNine.java @@ -0,0 +1,32 @@ +// CaseNine - everything in different packages +package p.q.r; + +import java.lang.annotation.*; +import a.b.c.Anno; +import x.y.z.Level; + +public class CaseNine { + + public static void main(String []argv) { + CaseNine o = new CaseNine(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno(Level.NONE) public void b() {} + @Anno(Level.ONE) public void c() {} + @Anno(Level.TWO) public void d() {} + @Anno(Level.THREE) public void e() {} + + } + +aspect X { + + before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseOne.java b/tests/features161/optimizedAnnotationBinding/CaseOne.java new file mode 100644 index 000000000..2b8d416d2 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseOne.java @@ -0,0 +1,34 @@ +// CaseOne - new syntax +import java.lang.annotation.*; + +public class CaseOne { + + public static void main(String []argv) { + + CaseOne o = new CaseOne(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno(Level.NONE) public void b() {} + @Anno(Level.ONE) public void c() {} + @Anno(Level.TWO) public void d() {} + @Anno(Level.THREE) public void e() {} + +} + +enum Level { NONE, ONE, TWO, THREE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { Level value();} + +aspect X { + + before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseSeven.java b/tests/features161/optimizedAnnotationBinding/CaseSeven.java new file mode 100644 index 000000000..ab095d516 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseSeven.java @@ -0,0 +1,35 @@ +// CaseSeven - annotations in packages +package p.q.r; + +import java.lang.annotation.*; + +public class CaseSeven { + + public static void main(String []argv) { + CaseSeven o = new CaseSeven(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno(Level.NONE) public void b() {} + @Anno(Level.ONE) public void c() {} + @Anno(Level.TWO) public void d() {} + @Anno(Level.THREE) public void e() {} + + } + + enum Level { NONE, ONE, TWO, THREE; } + + @Retention(RetentionPolicy.RUNTIME) + @interface Anno { Level value();} + +aspect X { + + before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(p.q.r.Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseSix.java b/tests/features161/optimizedAnnotationBinding/CaseSix.java new file mode 100644 index 000000000..f501df84a --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseSix.java @@ -0,0 +1,23 @@ +// CaseSix - not an execution join point - compiler limitation +import java.lang.annotation.*; + +public class CaseSix { + + @Anno static String s; + + public static void main(String []argv) { + s = "hello"; + } + +} +enum Level { NONE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { Level value() default Level.NONE; } + +aspect X { + + before(Level l): set(@Anno * *) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseTen.java b/tests/features161/optimizedAnnotationBinding/CaseTen.java new file mode 100644 index 000000000..daa2d4837 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseTen.java @@ -0,0 +1,34 @@ +// CaseTen - binding multiple things +import java.lang.annotation.*; + +public class CaseTen { + + public static void main(String []argv) { + + CaseTen o = new CaseTen(); + o.a(1); + o.b(2); + o.c(3); + o.d(4); + o.e(5); + } + + public void a(int i) {} + @Anno(Level.NONE) public void b(int i) {} + @Anno(Level.ONE) public void c(int i) {} + @Anno(Level.TWO) public void d(int i) {} + @Anno(Level.THREE) public void e(int i) {} + +} + +enum Level { NONE, ONE, TWO, THREE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { Level value();} + +aspect X { + + before(Level l,int i): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) && args(i) { + System.out.println(l+":"+i); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseThree.java b/tests/features161/optimizedAnnotationBinding/CaseThree.java new file mode 100644 index 000000000..e8d0c89e7 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseThree.java @@ -0,0 +1,34 @@ +// CaseThree - ambiguous +import java.lang.annotation.*; + +public class CaseThree { + + public static void main(String []argv) { + + CaseThree o = new CaseThree(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno(Level.NONE) public void b() {} + @Anno(Level.ONE) public void c() {} + @Anno(Level.TWO) public void d() {} + @Anno(Level.THREE) public void e() {} + +} + +enum Level { NONE, ONE, TWO, THREE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { Level value(); Level foo() default Level.ONE;} + +aspect X { + + before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseTwelve.java b/tests/features161/optimizedAnnotationBinding/CaseTwelve.java new file mode 100644 index 000000000..b51268b51 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseTwelve.java @@ -0,0 +1,35 @@ +// CaseTwelve - binding anno and anno value +import java.lang.annotation.*; + +public class CaseTwelve { + + public static void main(String []argv) { + + CaseTwelve o = new CaseTwelve(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno(value=Level.NONE,c=Color.RED) public void b() {} + @Anno(value=Level.ONE) public void c() {} + @Anno(value=Level.TWO,c=Color.GREEN) public void d() {} + @Anno(value=Level.THREE,c=Color.BLUE) public void e() {} + +} + +enum Level { NONE, ONE, TWO, THREE; } +enum Color { RED, GREEN, BLUE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { Level value(); Color c() default Color.GREEN; } + +aspect X { + + before(Level l,Anno a): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) && @annotation(a) { + System.out.println(l+":"+a.c()); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/CaseTwo.java b/tests/features161/optimizedAnnotationBinding/CaseTwo.java new file mode 100644 index 000000000..fab8f6eeb --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/CaseTwo.java @@ -0,0 +1,33 @@ +// CaseTwo - no such field in the annotation +import java.lang.annotation.*; + +public class CaseTwo { + + public static void main(String []argv) { + CaseTwo o = new CaseTwo(); + o.a(); + o.b(); + o.c(); + o.d(); + o.e(); + } + + public void a() {} + @Anno("A") public void b() {} + @Anno("B") public void c() {} + @Anno("C") public void d() {} + @Anno public void e() {} + +} + +enum Level { NONE, ONE, TWO, THREE; } + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { String value() default "";} + +aspect X { + + before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) { + System.out.println(l); + } +} diff --git a/tests/features161/optimizedAnnotationBinding/Level.java b/tests/features161/optimizedAnnotationBinding/Level.java new file mode 100644 index 000000000..a38bbec69 --- /dev/null +++ b/tests/features161/optimizedAnnotationBinding/Level.java @@ -0,0 +1,3 @@ +package x.y.z; + +public enum Level { NONE, ONE, TWO, THREE; } |