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.

IfPCDAssignmentCE.java 585B

1234567891011121314151617181920212223242526
  1. public class IfPCDAssignmentCE {
  2. public static void main (String[] args) {
  3. foo(new C());
  4. }
  5. static void foo(C a) {}
  6. }
  7. class C {
  8. static boolean doit() { return true; }
  9. static boolean doit(C a) { return true; }
  10. }
  11. aspect A {
  12. before(C c) : args(c) && call(void foo(C))
  13. && if ((c=new C()).doit()) { // CE 16
  14. }
  15. before(C c) : args(c) && call(void foo(C))
  16. && if (C.doit(c = new C())) { // CE 20
  17. }
  18. }
  19. /*
  20. Expecting compiler error on attempts to assign bound variable
  21. in if() PCD. Currently getting compiler stack trace.
  22. */