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


Java XFactory.createReferencedXMethod方法代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.ba.XFactory.createReferencedXMethod方法的典型用法代码示例。如果您正苦于以下问题:Java XFactory.createReferencedXMethod方法的具体用法?Java XFactory.createReferencedXMethod怎么用?Java XFactory.createReferencedXMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.umd.cs.findbugs.ba.XFactory的用法示例。


在下文中一共展示了XFactory.createReferencedXMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pushByInvoke

import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
private void pushByInvoke(DismantleBytecode dbc, boolean popThis) {
    String signature = dbc.getSigConstantOperand();
    if (dbc.getNameConstantOperand().equals("<init>") && signature.endsWith(")V") && popThis) {
        pop(PreorderVisitor.getNumberArguments(signature));
        Item constructed = pop();
        if (getStackDepth() > 0) {
            Item next = getStackItem(0);
            if (constructed.equals(next)) {
                next.source = XFactory.createReferencedXMethod(dbc);
                next.pc = dbc.getPC();
            }
        }
        return;
    }
    pop(PreorderVisitor.getNumberArguments(signature) + (popThis ? 1 : 0));
    pushBySignature(Type.getReturnType(signature).getSignature(), dbc);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:18,代码来源:OpcodeStack.java

示例2: pushByInvoke

import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
private void pushByInvoke(DismantleBytecode dbc, boolean popThis) {
    String signature = dbc.getSigConstantOperand();
    if (dbc.getNameConstantOperand().equals("<init>") && signature.endsWith(")V") && popThis) {
        pop(PreorderVisitor.getNumberArguments(signature));
        Item constructed = pop();
        if (getStackDepth() > 0) {
            Item next = getStackItem(0);
            if (constructed.equals(next)) {
                next = new Item(next);
                next.source = XFactory.createReferencedXMethod(dbc);
                next.pc = dbc.getPC();
                replace(0, next);
            }
        }
        return;
    }
    pop(PreorderVisitor.getNumberArguments(signature) + (popThis ? 1 : 0));
    pushBySignature(Type.getReturnType(signature).getSignature(), dbc);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:20,代码来源:OpcodeStack.java

示例3: sawOpcode

import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
public void sawOpcode(int seen) {

    if (DEBUG)
        System.out.printf("%3d %10s %3s %s%n", getPC(), OPCODE_NAMES[seen], state, stack);

    switch (seen) {
    case Constants.IF_ICMPEQ:
    case Constants.IF_ICMPNE:
        OpcodeStack.Item left = stack.getStackItem(1);
        OpcodeStack.Item right = stack.getStackItem(0);
        if (badUseOfCompareResult(left, right))

            bugAccumulator.accumulateBug(new BugInstance(this, "RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE", NORMAL_PRIORITY)
                    .addClassAndMethod(this).addMethod(left.getReturnValueOf()).describe(MethodAnnotation.METHOD_CALLED).addValueSource(right, this), this);
        else if (badUseOfCompareResult(right, left))
            bugAccumulator.accumulateBug(new BugInstance(this, "RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE", NORMAL_PRIORITY)
                    .addClassAndMethod(this).addMethod(right.getReturnValueOf()).describe(MethodAnnotation.METHOD_CALLED).addValueSource(left, this), this);
    }

    checkForInitWithoutCopyOnStack: if (seen == INVOKESPECIAL && getNameConstantOperand().equals("<init>")) {
        int arguments = PreorderVisitor.getNumberArguments(getSigConstantOperand());
        OpcodeStack.Item invokedOn = stack.getStackItem(arguments);
        if (invokedOn.isNewlyAllocated() && (!getMethodName().equals("<init>") || invokedOn.getRegisterNumber() != 0)) {

            for (int i = arguments + 1; i < stack.getStackDepth(); i++) {
                OpcodeStack.Item item = stack.getStackItem(i);
                if (item.isNewlyAllocated() && item.getSignature().equals(invokedOn.getSignature()))
                    break checkForInitWithoutCopyOnStack;
            }

            callSeen = XFactory.createReferencedXMethod(this);
            callPC = getPC();
            sawMethodCallWithIgnoredReturnValue();
            state = SCAN;
            previousOpcodeWasNEW = false;
            return;

        }
    }

    if (state == SAW_INVOKE && isPop(seen))
        sawMethodCallWithIgnoredReturnValue();
    else if (INVOKE_OPCODE_SET.get(seen)) {
        callPC = getPC();
        callSeen = XFactory.createReferencedXMethod(this);
        state = SAW_INVOKE;
        if (DEBUG)
            System.out.println("  invoking " + callSeen);
    } else
        state = SCAN;

    if (seen == NEW) {
        previousOpcodeWasNEW = true;
    } else {
        if (seen == INVOKESPECIAL && previousOpcodeWasNEW) {
            CheckReturnValueAnnotation annotation = checkReturnAnnotationDatabase.getResolvedAnnotation(callSeen, false);
            if (annotation != null && annotation != CheckReturnValueAnnotation.CHECK_RETURN_VALUE_IGNORE) {
                int priority = annotation.getPriority();
                if (!checkReturnAnnotationDatabase.annotationIsDirect(callSeen)
                        && !callSeen.getSignature().endsWith(callSeen.getClassName().replace('.', '/') + ";"))
                    priority++;
                bugAccumulator.accumulateBug(new BugInstance(this, annotation.getPattern(), priority).addClassAndMethod(this)
                        .addCalledMethod(this), this);
            }

        }
        previousOpcodeWasNEW = false;
    }

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:72,代码来源:MethodReturnCheck.java


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