--- /dev/null
+import java.lang.annotation.*;
+
+public class AllKinds {
+ public static void main(String[] args) {
+
+ }
+}
+
+enum Color { RED, GREEN, AMBER }
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ComplexAnnotation {
+ int ival();
+ byte bval();
+ char cval();
+ long jval();
+ double dval();
+ boolean zval();
+ short sval();
+ float fval();
+ Color enumval();
+ String strval();
+ Class clazzval();
+ int[] arrayval();
+}
+
+aspect X {
+ pointcut p1(): execution(@ComplexAnnotation(ival=5) * *(..));
+ pointcut p2(): execution(@ComplexAnnotation(bval=5) * *(..));
+ pointcut p3(): execution(@ComplexAnnotation(cval='5') * *(..));
+ pointcut p4(): execution(@ComplexAnnotation(jval=32232323) * *(..));
+ pointcut p5(): execution(@ComplexAnnotation(dval=5.0) * *(..));
+ pointcut p6(): execution(@ComplexAnnotation(zval=true) * *(..));
+ pointcut p7(): execution(@ComplexAnnotation(sval=42) * *(..));
+ pointcut p8(): execution(@ComplexAnnotation(enumval=Color.GREEN) * *(..));
+ pointcut p9(): execution(@ComplexAnnotation(strval="Hello") * *(..));
+// pointcut pa(): execution(@ComplexAnnotation(clazzval=String.class) * *(..));
+// pointcut pb(): execution(@ComplexAnnotation(arrayval={1,2,3}) * *(..));
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class BooleanValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(zval=true) public void methodOne() {}
+ @Anno(zval=false) public void methodTwo() {}
+}
+
+@interface Anno {
+ boolean zval();
+}
+
+
+aspect X {
+ before(): execution(@Anno(zval=true) * *(..)) {}
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class ByteValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(bval=123) public void methodOne() {}
+ @Anno(bval=27) public void methodTwo() {}
+}
+
+@interface Anno {
+ byte bval();
+}
+
+
+aspect X {
+ before(): execution(@Anno(bval=123) * *(..)) {}
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class CharValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(cval='e') public void methodOne() {}
+ @Anno(cval='a') public void methodTwo() {}
+}
+
+@interface Anno {
+ char cval();
+}
+
+
+aspect X {
+ before(): execution(@Anno(cval='a') * *(..)) {}
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class DoubleValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(dval=37.01) public void methodOne() {}
+ @Anno(dval=52.123) public void methodTwo() {}
+}
+
+@interface Anno {
+ double dval();
+}
+
+
+aspect X {
+ before(): execution(@Anno(dval=37.01) * *(..)) {}
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class Error {
+ public static void main(String[] args) { }
+
+}
+
+@interface Anno {
+ int ival();
+ float fval();
+ double dval();
+ byte bval();
+ short sval();
+ boolean zval();
+ long jval();
+ Color enumval();
+ char cval();
+ String stringval();
+}
+
+enum Color { RED,GREEN,BLUE };
+
+aspect X {
+ before(): execution(@Anno(ival=Color.GREEN) * *(..)) {}
+ before(): execution(@Anno(fval="hello") * *(..)) {} // invalid
+ before(): execution(@Anno(bval="foo") * *(..)) {}
+ before(): execution(@Anno(cval="no") * *(..)) {}
+ before(): execution(@Anno(jval=30.0f) * *(..)) {}
+ before(): execution(@Anno(dval="foo") * *(..)) {}
+ before(): execution(@Anno(zval=123) * *(..)) {}
+ before(): execution(@Anno(sval=4212312312) * *(..)) {}
+ before(): execution(@Anno(enumval=12) * *(..)) {}
+ before(): execution(@Anno(stringval=234) * *(..)) {}
+// before(): execution(@Anno(clazzval=String.class) * *(..));
+// before(): execution(@Anno(arrayval={1,2,3}) * *(..));
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class ErrorOne {
+ public static void main(String[] args) { }
+}
+
+@interface Anno {
+ float fval();
+}
+
+enum Color { RED,GREEN,BLUE };
+
+// Non existent value of the annotation!
+aspect X {
+ before(): execution(@Anno(ival=Color.GREEN) * *(..)) {}
+}
--- /dev/null
+
+enum TraceLevel { NONE, LEVEL1, LEVEL2, LEVEL3 }
+
+@interface Trace {
+ TraceLevel value() default TraceLevel.NONE;
+}
+
+aspect X {
+ before(): execution(@Trace !@Trace(TraceLevel.NONE) * *(..)) {
+ System.err.println("tracing "+thisJoinPoint);
+ }
+}
+
+public class ExampleOne {
+
+ public static void main(String[] args) {
+ ExampleOne eOne = new ExampleOne();
+ eOne.m001();
+ eOne.m002();
+ eOne.m003();
+ eOne.m004();
+ eOne.m005();
+ eOne.m006();
+ eOne.m007();
+ }
+
+ @Trace(TraceLevel.NONE)
+ public void m001() {}
+
+ @Trace(TraceLevel.LEVEL2)
+ public void m002() {}
+
+ @Trace(TraceLevel.LEVEL3)
+ public void m003() {}
+
+ @Trace(TraceLevel.NONE)
+ public void m004() {}
+
+ @Trace(TraceLevel.LEVEL2)
+ public void m005() {}
+
+ @Trace(TraceLevel.NONE)
+ public void m006() {}
+
+ @Trace
+ public void m007() {}
+
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class FloatValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(fval=37.0f) public void methodOne() {}
+ @Anno(fval=52.1f) public void methodTwo() {}
+}
+
+@interface Anno {
+ float fval();
+}
+
+
+aspect X {
+// before(): execution(@Anno(ival=5) * *(..)) {}
+ before(): execution(@Anno(fval=52.1f) * *(..)) {}
+// before(): execution(@Anno(bval=5) * *(..)) {}
+// before(): execution(@Anno(cval='5') * *(..)) {}
+// before(): execution(@Anno(jval=32232323) * *(..)) {}
+// before(): execution(@Anno(dval=5.0) * *(..)) {}
+// before(): execution(@Anno(zval=true) * *(..)) {}
+// before(): execution(@Anno(sval=42) * *(..)) {}
+// before(): execution(@Anno(enumval=Color.GREEN) * *(..)) {}
+// before(): execution(@Anno(strval="Hello") * *(..)) {}
+// before(): execution(@Anno(clazzval=String.class) * *(..));
+// before(): execution(@Anno(arrayval={1,2,3}) * *(..));
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class IntValueMatching {
+ public static void main(String[] args) {
+
+ }
+
+ @Anno(ival=3) public void a() {}
+ @Anno(ival=5) public void b() {}
+}
+
+enum Color { RED, GREEN, AMBER }
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Anno {
+ int ival();
+}
+
+
+aspect X {
+ before(): execution(@Anno(ival=5) * *(..)) {}
+// before(): execution(@Anno(bval=5) * *(..)) {}
+// before(): execution(@Anno(cval='5') * *(..)) {}
+// before(): execution(@Anno(jval=32232323) * *(..)) {}
+// before(): execution(@Anno(dval=5.0) * *(..)) {}
+// before(): execution(@Anno(zval=true) * *(..)) {}
+// before(): execution(@Anno(sval=42) * *(..)) {}
+// before(): execution(@Anno(enumval=Color.GREEN) * *(..)) {}
+// before(): execution(@Anno(strval="Hello") * *(..)) {}
+// before(): execution(@Anno(clazzval=String.class) * *(..));
+// before(): execution(@Anno(arrayval={1,2,3}) * *(..));
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class LongValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(jval=123123123) public void methodOne() {}
+ @Anno(jval=8) public void methodTwo() {}
+}
+
+@interface Anno {
+ long jval();
+}
+
+
+aspect X {
+ before(): execution(@Anno(jval=123123123) * *(..)) {}
+}
--- /dev/null
+// testing what happens with multiple annotations together in a type pattern list @(A B C) type thing
+
+
+enum Rainbow { RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET }
+
+@interface Col1 { Rainbow value() default Rainbow.RED; }
+@interface Col2 { Rainbow value() default Rainbow.YELLOW; }
+
+aspect X {
+ before(): execution(@(Col1 && Col2) * *(..)) {
+ System.err.println("advising "+thisJoinPoint);
+ }
+}
+
+public class MultiTypePatterns {
+
+ public static void main(String[] args) {
+ MultiTypePatterns eOne = new MultiTypePatterns();
+ }
+
+ @Col1 public void m001() {}
+ @Col2 public void m002() {}
+ @Col1 @Col2 public void m003() {}
+
+}
enum Color { RED, GREEN, AMBER }
@interface TrafficLight {
- Color value() default Color.RED;
+ Color value() default Color.RED; Color a() default Color.GREEN; Color c() default Color.GREEN; Color e() default Color.GREEN;
}
public class Parsing {
pointcut p2(): execution(@TrafficLight(a=Color.GREEN) * *(..));
pointcut p3(): execution(@TrafficLight(a=Color.RED,c=Color.RED) * *(..));
pointcut p4(): execution(@TrafficLight(a=Color.RED,c=Color.RED,e=Color.RED) * *(..));
-}
\ No newline at end of file
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class ShortValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(sval=32700) public void methodOne() {}
+ @Anno(sval=27) public void methodTwo() {}
+}
+
+@interface Anno {
+ short sval();
+}
+
+
+aspect X {
+ before(): execution(@Anno(sval=32700) * *(..)) {}
+}
--- /dev/null
+import java.lang.annotation.*;
+
+public class StringValueMatching {
+ public static void main(String[] args) { }
+
+ @Anno(stringval="foobar") public void methodOne() {}
+ @Anno(stringval="goo") public void methodTwo() {}
+}
+
+@interface Anno {
+ String stringval();
+}
+
+
+aspect X {
+ before(): execution(@Anno(stringval="foobar") * *(..)) {}
+}
--- /dev/null
+//@Retention(RetentionPolicy.RUNTIME)
+@interface ComplexAnnotation {
+ int ival();
+ byte bval();
+ char cval();
+ long jval();
+ double dval();
+ boolean zval();
+ short sval();
+ float fval();
+// Color enumval();
+ String strval();
+ Class classval();
+ int[] arrayval();
+}
+