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.

123456789101112131415161718192021222324252627282930313233
  1. // compile this guy with -usejavac to show warning
  2. public class AssertInInnerIntro {
  3. public static void main(String[] args) {
  4. turnOnAssertions();
  5. runTests();
  6. }
  7. static void turnOnAssertions() {
  8. ClassLoader cl = AssertInInnerIntro.class.getClassLoader();
  9. cl.setClassAssertionStatus("C", false);
  10. cl.setClassAssertionStatus("A", true);
  11. }
  12. static void runTests() {
  13. // should throw assertion error, will not
  14. C.foo();
  15. }
  16. }
  17. class C {
  18. }
  19. aspect A {
  20. static void C.foo() {
  21. new Runnable() {
  22. public void run() {
  23. assert false;
  24. }
  25. }.run();
  26. }
  27. }