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.

AroundAMain.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v 2.0
  6. * which accompanies this distribution and is available at
  7. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. import org.aspectj.runtime.internal.AroundClosure;
  13. import org.aspectj.util.Reflection;
  14. public class AroundAMain {//extends TestCase {
  15. public AroundAMain(String name) {
  16. // super(name);
  17. }
  18. public static void main(String[] args) throws ClassNotFoundException {
  19. AroundClosure closure = new AroundClosure() {
  20. @Override
  21. public Object run(Object[] args) throws Throwable {
  22. // System.out.println("run with: " + Arrays.asList(args));
  23. return 10;
  24. }
  25. };
  26. Object instance = Reflection.getStaticField(Class.forName("AroundA"),
  27. "ajc$perSingletonInstance");
  28. Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$1$73ebb943", // was $AroundA$46
  29. 10, true, closure);
  30. Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$2$a758212d", // Was $AroundA$c5
  31. "hello there", closure);
  32. Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$3$a758212d", // Was $AroundA$150
  33. new String[1], closure);
  34. }
  35. }