You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ClassLiteralField.java 790B

1234567891011121314151617181920212223242526
  1. import org.aspectj.testing.Tester;
  2. public class ClassLiteralField { // synthetic class$n set
  3. public static void main(String[] args) {
  4. Class c = ClassLiteralField.class; // synthetic class$n get
  5. assert c != null; //synthetic $assert
  6. new ClassLiteralField().doInner();
  7. }
  8. int x=10;
  9. void doInner() {
  10. new Runnable() { // synthetic this$n
  11. public void run() {
  12. x+=1; // synthetic this$n
  13. }
  14. }.run();
  15. }
  16. }
  17. aspect A {
  18. // before(): within(ClassLiteralField) && get(* *) && !get(* x) {
  19. // System.out.println("get: " + thisJoinPoint +", " + thisJoinPoint.getSourceLocation());
  20. // }
  21. declare error: within(ClassLiteralField) && get(* *) && !get(* x): "unexpected get";
  22. declare error: within(ClassLiteralField) && set(* *) && !set(* x): "unexpected set";
  23. }