File: AsmDetector.java

package info (click to toggle)
aspectj 1.6.12+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 17,556 kB
  • sloc: java: 123,374; xml: 26,506; sh: 521; makefile: 100
file content (36 lines) | stat: -rw-r--r-- 1,149 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* *******************************************************************
 * Copyright (c) 2008 Contributors
 * All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *	 Andy Clement
 * ******************************************************************/
package org.aspectj.weaver.bcel.asm;

import java.lang.reflect.Method;

/**
 * Determines if a version of asm is around that will enable us to add stack map attributes to classes that we produce.
 * 
 * @author Andy Clement
 */
public class AsmDetector {

	public static boolean isAsmAround;

	static {
		try {
			Class<?> reader = Class.forName("org.objectweb.asm.ClassReader");
			Class<?> visitor = Class.forName("org.objectweb.asm.ClassVisitor");
			Method m = reader.getMethod("accept", new Class[] { visitor, Integer.TYPE });
			isAsmAround = m != null;
		} catch (Exception e) {
			isAsmAround = false;
		}
		// System.out.println(isAsmAround?"ASM detected":"No ASM found");
	}
}