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.

AsmDetector.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* *******************************************************************
  2. * Copyright (c) 2008 Contributors
  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. * Andy Clement
  11. * ******************************************************************/
  12. package org.aspectj.weaver.bcel.asm;
  13. import java.lang.reflect.Method;
  14. /**
  15. * Determines if a version of asm is around that will enable us to add stack map attributes to classes that we produce.
  16. *
  17. * @author Andy Clement
  18. */
  19. public class AsmDetector {
  20. public static boolean isAsmAround;
  21. static {
  22. try {
  23. Class<?> reader = Class.forName("aj.org.objectweb.asm.ClassReader");
  24. Class<?> visitor = Class.forName("aj.org.objectweb.asm.ClassVisitor");
  25. Method m = reader.getMethod("accept", new Class[] { visitor, Integer.TYPE });
  26. isAsmAround = m != null;
  27. } catch (Exception e) {
  28. isAsmAround = false;
  29. }
  30. // System.out.println(isAsmAround?"ASM detected":"No ASM found");
  31. }
  32. }