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.

MethodLocalAroundReturns.java 568B

12345678910111213141516171819202122
  1. import org.aspectj.testing.Tester;
  2. public class MethodLocalAroundReturns {
  3. public static void main (String[] args) {
  4. C c = C.make();
  5. Tester.check(null != c, "null c");
  6. Tester.check("ok".equals(c.toString()), "bad c: " + c);
  7. }
  8. }
  9. class C {
  10. static C make() { return null; }
  11. }
  12. aspect A {
  13. /** @testcase method-local class defined in around return statement */
  14. C around() : call(C C.make()) {
  15. return new C() {
  16. public String toString() { return "ok"; } // bad compiler error here
  17. };
  18. }
  19. }