本文整理汇总了Java中edu.umd.cs.findbugs.ba.generic.GenericUtilities.merge方法的典型用法代码示例。如果您正苦于以下问题:Java GenericUtilities.merge方法的具体用法?Java GenericUtilities.merge怎么用?Java GenericUtilities.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.ba.generic.GenericUtilities
的用法示例。
在下文中一共展示了GenericUtilities.merge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleStoreInstruction
import edu.umd.cs.findbugs.ba.generic.GenericUtilities; //导入方法依赖的package包/类
@Override
public void handleStoreInstruction(StoreInstruction obj) {
try {
int numConsumed = obj.consumeStack(cpg);
if (numConsumed == 1) {
boolean isExact = isTopOfStackExact();
TypeFrame frame = getFrame();
Type value = frame.popValue();
int index = obj.getIndex();
if (value instanceof ReferenceType && !(value instanceof GenericObjectType)) {
GenericObjectType gType = getLocalVariable(index,
getLocation().getHandle().getPosition());
value = GenericUtilities.merge(gType, value);
}
frame.setValue(index, value);
frame.setExact(index, isExact);
} else
super.handleStoreInstruction(obj);
} catch (DataflowAnalysisException e) {
throw new InvalidBytecodeException(
"error handling store instruction ", e);
}
}
示例2: handleLoadInstruction
import edu.umd.cs.findbugs.ba.generic.GenericUtilities; //导入方法依赖的package包/类
/**
* Handler for all instructions which load values from a local variable and
* push them on the stack. Note that two locals are loaded for long and
* double loads.
*/
@Override
public void handleLoadInstruction(LoadInstruction obj) {
int numProduced = obj.produceStack(cpg);
if (numProduced == Constants.UNPREDICTABLE)
throw new InvalidBytecodeException("Unpredictable stack production");
if (numProduced != 1) {
super.handleLoadInstruction(obj);
return;
}
int index = obj.getIndex();
TypeFrame frame = getFrame();
Type value = frame.getValue(index);
if (value instanceof ReferenceType && !(value instanceof GenericObjectType)) {
GenericObjectType gType = getLocalVariable(index,
getLocation().getHandle().getPosition());
value = GenericUtilities.merge(gType, value);
}
boolean isExact = frame.isExact(index);
frame.pushValue(value);
if (isExact)
setTopOfStackIsExact();
}
示例3: getType
import edu.umd.cs.findbugs.ba.generic.GenericUtilities; //导入方法依赖的package包/类
/**
* @param xfield
* @return
*/
public static Type getType(XField xfield) {
Type t = Type.getType(xfield.getSignature());
if (!(t instanceof ReferenceType))
return t;
ReferenceType loadType = (ReferenceType) t;
// Check the field store type database to see if we can
// get a more precise type for this load.
useDatabase: {
FieldStoreTypeDatabase database = AnalysisContext
.currentAnalysisContext().getFieldStoreTypeDatabase();
if (database != null) {
FieldStoreType property = database.getProperty(xfield
.getFieldDescriptor());
if (property != null) {
loadType = property.getLoadType(loadType);
break useDatabase;
}
}
FieldSummary fieldSummary = AnalysisContext
.currentAnalysisContext().getFieldSummary();
if (fieldSummary != null) {
Item summary = fieldSummary.getSummary(xfield);
if (summary != null) {
if (xfield.isFinal() && summary.isNull()) {
return TypeFrame.getNullType();
}
if (!summary.getSignature().equals("Ljava/lang/Object;")) {
loadType = (ReferenceType) Type.getType(summary
.getSignature());
}
}
}
}
String sourceSignature = xfield.getSourceSignature();
if (sourceSignature != null && loadType instanceof ObjectType) {
loadType = GenericUtilities.merge(
GenericUtilities.getType(sourceSignature),
(ObjectType) loadType);
}
return loadType;
}