本文整理汇总了Java中org.apache.bcel.generic.GETFIELD.getFieldName方法的典型用法代码示例。如果您正苦于以下问题:Java GETFIELD.getFieldName方法的具体用法?Java GETFIELD.getFieldName怎么用?Java GETFIELD.getFieldName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.generic.GETFIELD
的用法示例。
在下文中一共展示了GETFIELD.getFieldName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ignoreExceptionEdge
import org.apache.bcel.generic.GETFIELD; //导入方法依赖的package包/类
public boolean ignoreExceptionEdge(Edge edge, Lock resource, ConstantPoolGen cpg) {
try {
Location location = cfg.getExceptionThrowerLocation(edge);
if (DEBUG) {
System.out.println("Exception thrower location: " + location);
}
Instruction ins = location.getHandle().getInstruction();
if (ins instanceof GETFIELD) {
GETFIELD insGetfield = (GETFIELD) ins;
String fieldName = insGetfield.getFieldName(cpg);
if (DEBUG) {
System.out.println("Inspecting GETFIELD of " + fieldName + " at " + location);
}
// Ignore exceptions from getfield instructions where the
// object reference is known not to be null
if (fieldName.equals("lock"))
return true;
IsNullValueFrame frame = isNullDataflow.getFactAtLocation(location);
if (!frame.isValid())
return false;
IsNullValue receiver = frame.getInstance(ins, cpg);
boolean notNull = receiver.isDefinitelyNotNull();
if (DEBUG && notNull) {
System.out.println("Ignoring exception from non-null GETFIELD");
}
return notNull;
} else if (ins instanceof InvokeInstruction) {
InvokeInstruction iins = (InvokeInstruction) ins;
String methodName = iins.getMethodName(cpg);
// System.out.println("Method " + methodName);
if (methodName.startsWith("access$"))
return true;
if (methodName.equals("readLock") || methodName.equals("writeLock"))
return true;
if (methodName.equals("lock") || methodName.equals("unlock"))
return true;
}
if (DEBUG) {
System.out.println("FOUND Exception thrower at: " + location);
}
} catch (DataflowAnalysisException e) {
AnalysisContext.logError("Error while looking for exception edge", e);
}
return false;
}