Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-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. public class AroundAMain extends TestCase {
  16. public AroundAMain(String name) {
  17. super(name);
  18. }
  19. public static void main(String[] args) throws ClassNotFoundException {
  20. AroundClosure closure = new AroundClosure() {
  21. public Object run(Object[] args) throws Throwable {
  22. // System.out.println("run with: " + Arrays.asList(args));
  23. return new Integer(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. new Integer(10), new Boolean(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. }