本文整理汇总了Java中org.apache.bcel.generic.MethodGen.isAbstract方法的典型用法代码示例。如果您正苦于以下问题:Java MethodGen.isAbstract方法的具体用法?Java MethodGen.isAbstract怎么用?Java MethodGen.isAbstract使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.generic.MethodGen
的用法示例。
在下文中一共展示了MethodGen.isAbstract方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processMethod
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
private void processMethod(Method m) {
final MethodGen gen = new MethodGen(m, visited.getClassName(), constants);
builder.getMetricsMgr().notifyMethod(gen);
if (!gen.isAbstract() && !gen.isNative()) {
Stream.of(gen.getInstructionList().getInstructionHandles())
.map(ih -> ih.getInstruction())
.forEach(i -> builder.getMetricsMgr().notifyInstruction(i));
}
}
示例2: processInstructions
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
private void processInstructions(Method m) {
MethodGen mg = new MethodGen(m, design.getCurrentClass(), poolGen);
if (!mg.isAbstract() && !mg.isNative()) {
InstructionHandle ih = mg.getInstructionList().getStart();
for (; ih != null; ih = ih.getNext()) {
Instruction i = ih.getInstruction();
log(" instr=" + i, Project.MSG_DEBUG);
// if (i instanceof BranchInstruction) {
// branch_map.put(i, ih); // memorize container
// }
// if (ih.hasTargeters()) {
// if (i instanceof BranchInstruction) {
// _out.println(" InstructionHandle ih_"
// + ih.getPosition() + ";");
// } else {
// _out.print(" InstructionHandle ih_"
// + ih.getPosition() + " = ");
// }
// } else {
// _out.print(" ");
// }
// if (!visitInstruction(i))
i.accept(visitor);
}
// CodeExceptionGen[] handlers = mg.getExceptionHandlers();
//
// log("handlers len="+handlers.length, Project.MSG_DEBUG);
// for (int i = 0; i < handlers.length; i++) {
// CodeExceptionGen h = handlers[i];
// ObjectType t = h.getCatchType();
// log("type="+t, Project.MSG_DEBUG);
// if(t != null) {
// log("type="+t.getClassName(), Project.MSG_DEBUG);
// }
// }
// updateExceptionHandlers();
}
}
示例3: counterAdaptClass
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
byte[] counterAdaptClass(final InputStream is, final String name)
throws Exception
{
JavaClass jc = new ClassParser(is, name + ".class").parse();
ClassGen cg = new ClassGen(jc);
ConstantPoolGen cp = cg.getConstantPool();
if (!cg.isInterface()) {
FieldGen fg = new FieldGen(ACC_PUBLIC,
Type.getType("I"),
"_counter",
cp);
cg.addField(fg.getField());
}
Method[] ms = cg.getMethods();
for (int j = 0; j < ms.length; ++j) {
MethodGen mg = new MethodGen(ms[j], cg.getClassName(), cp);
if (!mg.getName().equals("<init>") && !mg.isStatic()
&& !mg.isAbstract() && !mg.isNative())
{
if (mg.getInstructionList() != null) {
InstructionList il = new InstructionList();
il.append(new ALOAD(0));
il.append(new ALOAD(0));
il.append(new GETFIELD(cp.addFieldref(name, "_counter", "I")));
il.append(new ICONST(1));
il.append(new IADD());
il.append(new PUTFIELD(cp.addFieldref(name, "_counter", "I")));
mg.getInstructionList().insert(il);
mg.setMaxStack(Math.max(mg.getMaxStack(), 2));
boolean lv = ms[j].getLocalVariableTable() == null;
boolean ln = ms[j].getLineNumberTable() == null;
if (lv) {
mg.removeLocalVariables();
}
if (ln) {
mg.removeLineNumbers();
}
cg.replaceMethod(ms[j], mg.getMethod());
}
}
}
return cg.getJavaClass().getBytes();
}