Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

AsmDetector.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  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. /**
  14. * Determines if a version of asm is around that will enable us to add stack map attributes to classes that we produce.
  15. *
  16. * @author Andy Clement
  17. */
  18. public class AsmDetector {
  19. public static final String CLASS_READER = "org.objectweb.asm.ClassReader";
  20. public static final String CLASS_VISITOR = "org.objectweb.asm.ClassVisitor";
  21. public static boolean isAsmAround;
  22. static {
  23. try {
  24. Class<?> reader = Class.forName(CLASS_READER);
  25. Class<?> visitor = Class.forName(CLASS_VISITOR);
  26. reader.getMethod("accept", visitor, Integer.TYPE);
  27. isAsmAround = true;
  28. } catch (Exception e) {
  29. isAsmAround = false;
  30. }
  31. //System.out.println(isAsmAround ? "ASM detected" : "No ASM found");
  32. }
  33. }