本文整理汇总了Java中org.apache.bcel.classfile.Method.isNative方法的典型用法代码示例。如果您正苦于以下问题:Java Method.isNative方法的具体用法?Java Method.isNative怎么用?Java Method.isNative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.Method
的用法示例。
在下文中一共展示了Method.isNative方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
/**
* Test driver.
*/
public static void main(String[] argv) throws Exception {
if (argv.length != 1) {
System.err.println("Usage: " + BetterCFGBuilder2.class.getName() + " <class file>");
System.exit(1);
}
String methodName = System.getProperty("cfgbuilder.method");
JavaClass jclass = new ClassParser(argv[0]).parse();
ClassGen classGen = new ClassGen(jclass);
Method[] methodList = jclass.getMethods();
for (int i = 0; i < methodList.length; ++i) {
Method method = methodList[i];
if (method.isAbstract() || method.isNative())
continue;
if (methodName != null && !method.getName().equals(methodName))
continue;
MethodGen methodGen = new MethodGen(method, jclass.getClassName(), classGen.getConstantPool());
CFGBuilder cfgBuilder = new BetterCFGBuilder2(methodGen);
cfgBuilder.build();
CFG cfg = cfgBuilder.getCFG();
CFGPrinter cfgPrinter = new CFGPrinter(cfg);
System.out.println("---------------------------------------------------------------------");
System.out.println("Method: " + SignatureConverter.convertMethodSignature(methodGen));
System.out.println("---------------------------------------------------------------------");
cfgPrinter.print(System.out);
}
}
示例2: main
import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public static void main(String[] argv) throws Exception {
if (argv.length != 1) {
System.err.println("Usage: " + DominatorsAnalysis.class.getName() + " <classfile>");
System.exit(1);
}
RepositoryLookupFailureCallback lookupFailureCallback = new RepositoryLookupFailureCallback() {
public void reportMissingClass(ClassNotFoundException ex) {
ex.printStackTrace();
System.exit(1);
}
};
AnalysisContext analysisContext = new AnalysisContext(lookupFailureCallback);
JavaClass jclass = new ClassParser(argv[0]).parse();
ClassContext classContext = analysisContext.getClassContext(jclass);
String methodName = System.getProperty("dominators.method");
boolean ignoreExceptionEdges = Boolean.getBoolean("dominators.ignoreExceptionEdges");
Method[] methodList = jclass.getMethods();
for (int i = 0; i < methodList.length; ++i) {
Method method = methodList[i];
if (method.isNative() || method.isAbstract())
continue;
if (methodName != null && !methodName.equals(method.getName()))
continue;
System.out.println("Method: " + method.getName());
CFG cfg = classContext.getCFG(method);
DepthFirstSearch dfs = classContext.getDepthFirstSearch(method);
DominatorsAnalysis analysis = new DominatorsAnalysis(cfg, dfs, ignoreExceptionEdges);
Dataflow<BitSet, DominatorsAnalysis> dataflow =
new Dataflow<BitSet, DominatorsAnalysis>(cfg, analysis);
dataflow.execute();
for (Iterator<BasicBlock> j = cfg.blockIterator(); j.hasNext();) {
BasicBlock block = j.next();
BitSet dominators = analysis.getResultFact(block);
System.out.println("Block " + block.getId() + ": " + dominators);
}
}
}
示例3: main
import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public static void main(String[] argv) throws Exception {
if (argv.length != 1) {
System.err.println("Usage: " + BlockTypeAnalysis.class.getName() + " <classfile>");
System.exit(1);
}
RepositoryLookupFailureCallback lookupFailureCallback = new RepositoryLookupFailureCallback() {
public void reportMissingClass(ClassNotFoundException ex) {
ex.printStackTrace();
System.exit(1);
}
};
AnalysisContext analysisContext = new AnalysisContext(lookupFailureCallback);
JavaClass jclass = new ClassParser(argv[0]).parse();
ClassContext classContext = analysisContext.getClassContext(jclass);
String methodName = System.getProperty("blocktype.method");
Method[] methodList = jclass.getMethods();
for (int i = 0; i < methodList.length; ++i) {
Method method = methodList[i];
if (method.isNative() || method.isAbstract())
continue;
if (methodName != null && !methodName.equals(method.getName()))
continue;
System.out.println("Method: " + method.getName());
CFG cfg = classContext.getCFG(method);
DepthFirstSearch dfs = classContext.getDepthFirstSearch(method);
final BlockTypeAnalysis analysis = new BlockTypeAnalysis(dfs);
Dataflow<BlockType, BlockTypeAnalysis> dataflow =
new Dataflow<BlockType, BlockTypeAnalysis>(cfg, analysis);
dataflow.execute();
if (Boolean.getBoolean("blocktype.printcfg")) {
CFGPrinter cfgPrinter = new CFGPrinter(cfg) {
public String blockAnnotate(BasicBlock block) {
BlockType blockType = analysis.getResultFact(block);
return " [Block type: " + blockType.toString() + "]";
}
};
cfgPrinter.print(System.out);
}
}
}