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.

SynchroInterface.java 911B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import org.aspectj.testing.Tester;
  2. import java.lang.reflect.*;
  3. public class SynchroInterface {
  4. public static void main(String[] args) {
  5. try {
  6. new SynchroInterface().realMain(args);
  7. } catch (Throwable t) {
  8. Tester.check(false, "uh oh " + t);
  9. } finally {
  10. Tester.check(Consts.ran, "method didn't run");
  11. }
  12. }
  13. public void realMain(String[] args) throws Throwable {
  14. Class.forName("EmptyClass").getMethod("method", new Class[]{}).invoke(new EmptyClass(), new Class[]{});
  15. }
  16. }
  17. class Consts {
  18. public static boolean ran = false;
  19. }
  20. class EmptyClass {
  21. }
  22. interface EmptyInterface {
  23. }
  24. aspect IntroType {
  25. introduction EmptyClass {
  26. implements EmptyInterface;
  27. }
  28. }
  29. aspect IntroMethod {
  30. introduction EmptyInterface {
  31. public synchronized void method() {
  32. Consts.ran = true;
  33. }
  34. }
  35. }