当前位置: 首页>>代码示例>>Java>>正文


Java GenericUtilities.merge方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:25,代码来源:TypeFrameModelingVisitor.java

示例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();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:29,代码来源:TypeFrameModelingVisitor.java

示例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;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:51,代码来源:TypeFrameModelingVisitor.java


注:本文中的edu.umd.cs.findbugs.ba.generic.GenericUtilities.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。