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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 Common Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. import junit.framework.TestCase;
  13. import org.aspectj.runtime.internal.AroundClosure;
  14. import org.aspectj.util.Reflection;
  15. // FIXME: who is using this class ?
  16. public class AroundAMain extends TestCase {
  17. public AroundAMain(String name) {
  18. super(name);
  19. }
  20. public static void main(String[] args) throws ClassNotFoundException {
  21. AroundClosure closure = new AroundClosure() {
  22. public Object run(Object[] args) throws Throwable {
  23. // System.out.println("run with: " + Arrays.asList(args));
  24. return new Integer(10);
  25. }
  26. };
  27. Object instance = Reflection.getStaticField(Class.forName("AroundA"),
  28. "ajc$perSingletonInstance");
  29. Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$1$73ebb943", // was $AroundA$46
  30. new Integer(10), new Boolean(true), closure);
  31. Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$2$a758212d", // Was $AroundA$c5
  32. "hello there", closure);
  33. Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$3$a758212d", // Was $AroundA$150
  34. new String[1], closure);
  35. }
  36. }