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


Java ParameterProperty类代码示例

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


ParameterProperty类属于edu.umd.cs.findbugs.ba.interproc包,在下文中一共展示了ParameterProperty类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sawOpcode

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
@Override
public void sawOpcode(int seen) {
    if (seen == SIPUSH) {
        lastConstantForSIPUSH = getIntConstant();
    }
    if (seen == INVOKEINTERFACE || seen == INVOKEVIRTUAL || seen == INVOKESPECIAL || seen == INVOKESTATIC) {
        String signature = getSigConstantOperand();

        int numberArguments = PreorderVisitor.getNumberArguments(signature);

        for (int i = 0; i < numberArguments; i++) {
            Item item = stack.getStackItem(numberArguments - 1 - i);
            if (item.getSpecialKind() == OpcodeStack.Item.RESULT_OF_I2L) {
                ParameterProperty property = database.getProperty(getMethodDescriptorOperand());
                if (property != null && property.hasProperty(i)) {
                    int priority = NORMAL_PRIORITY;

                    if (getPrevOpcode(1) == I2L && getPrevOpcode(2) == IMUL && getPrevOpcode(3) == SIPUSH
                            && lastConstantForSIPUSH == 1000) {
                        priority = HIGH_PRIORITY;

                    } else if (getPrevOpcode(1) == I2L && getPrevOpcode(2) == IMUL && getPrevOpcode(4) == SIPUSH
                            && lastConstantForSIPUSH == 1000) {
                        priority = HIGH_PRIORITY;
                    }
                    BugInstance bug = new BugInstance(this, "ICAST_INT_2_LONG_AS_INSTANT", priority).addClassAndMethod(this)
                            .addCalledMethod(this).addValueSource(item, this).addSourceLine(this);
                    bugReporter.reportBug(bug);
                }

            }
        }

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

示例2: decodeProperty

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
@Override
protected ParameterProperty decodeProperty(String propStr) throws PropertyDatabaseFormatException {
    try {
        int longInstants = Integer.parseInt(propStr);
        ParameterProperty prop = new ParameterProperty(longInstants);
        return prop;
    } catch (NumberFormatException e) {
        throw new PropertyDatabaseFormatException("Invalid unconditional deref param set: " + propStr);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:TrainLongInstantfParams.java

示例3: visit

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
@Override
public void visit(Code obj) {

    if (!getMethod().isPublic() && !getMethod().isProtected())
        return;
    SignatureParser p = new SignatureParser(getMethodSig());
    LocalVariableTable t = obj.getLocalVariableTable();

    if (t == null)
        return;
    ParameterProperty property = new ParameterProperty();

    int index = getMethod().isStatic() ? 0 : 1;
    int parameterNumber = 0;
    for (Iterator<String> i = p.parameterSignatureIterator(); i.hasNext();) {
        String s = i.next();
        LocalVariable localVariable = t.getLocalVariable(index, 0);
        if (localVariable != null) {
            String name = localVariable.getName();
            if (s.equals("J") && (name.toLowerCase().indexOf("instant") >= 0 || name.startsWith("date"))) {

                // System.out.println(getFullyQualifiedMethodName() + " " + s + " " + index + " " + name);
                property.setParamWithProperty(parameterNumber, true);
            }
        }
        if (s.equals("J") || s.equals("D"))
            index += 2;
        else
            index += 1;
        parameterNumber++;
    }
    if (!property.isEmpty()) {
        // System.out.println(getFullyQualifiedMethodName() + " " + property);
        database.setProperty(getMethodDescriptor(), property);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:37,代码来源:TrainLongInstantfParams.java

示例4: visitClassContext

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
public void visitClassContext(ClassContext classContext) {

        JavaClass jclass = classContext.getJavaClass();

        for (Method method : jclass.getMethods()) {
            XMethod xmethod = XFactory.createXMethod(classContext.getJavaClass(), method);
            ParameterProperty nonnullParameters = AnalysisContext.currentAnalysisContext().getUnconditionalDerefParamDatabase()
                    .getProperty(xmethod.getMethodDescriptor());
            if (nonnullParameters != null) {
                for (int p : nonnullParameters.iterable()) {
                    TypeQualifierAnnotation directTypeQualifierAnnotation = TypeQualifierApplications
                            .getDirectTypeQualifierAnnotation(xmethod, p, nonnullTypeQualifierValue);
                    if (directTypeQualifierAnnotation != null && directTypeQualifierAnnotation.when == When.UNKNOWN) {
                        //
                        // The LocalVariableAnnotation is constructed using the
                        // local variable
                        // number of the parameter, not the parameter number.
                        //
                        int paramLocal = xmethod.isStatic() ? p : p + 1;

                        reporter.reportBug(new BugInstance(this, "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
                                NORMAL_PRIORITY).addClassAndMethod(jclass, method).add(
                                LocalVariableAnnotation.getParameterLocalVariableAnnotation(method, paramLocal)));

                    }

                }
            }
        }

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

示例5: decodeProperty

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
@Override
protected ParameterProperty decodeProperty(String propStr) throws PropertyDatabaseFormatException {
    try {
        int unconditionalDerefSet = Integer.parseInt(propStr);
        ParameterProperty prop = new ParameterProperty(unconditionalDerefSet);
        return prop;
    } catch (NumberFormatException e) {
        throw new PropertyDatabaseFormatException("Invalid unconditional deref param set: " + propStr);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:ParameterNullnessPropertyDatabase.java

示例6: setUp

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
    empty = new ParameterProperty();

    nonEmpty = new ParameterProperty();
    nonEmpty.setParamWithProperty(11, true);
    nonEmpty.setParamWithProperty(25, true);

    extremes = new ParameterProperty();
    extremes.setParamWithProperty(0, true);
    extremes.setParamWithProperty(31, true);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:13,代码来源:NonNullParamPropertyTest.java

示例7: encodeProperty

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
@Override
protected String encodeProperty(ParameterProperty property) {
    return String.valueOf(property.getParamsWithProperty());
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:5,代码来源:TrainLongInstantfParams.java

示例8: NonNullSpecification

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
public NonNullSpecification(JavaClassAndMethod classAndMethod, ParameterProperty nonParamProperty,
        ParameterProperty possiblyNullProperty) {
    this.classAndMethod = classAndMethod;
    this.nonNullProperty = nonParamProperty;
    this.possiblyNullProperty = possiblyNullProperty;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:7,代码来源:NonNullSpecification.java

示例9: getNonNullProperty

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
public ParameterProperty getNonNullProperty() {
    return nonNullProperty;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:NonNullSpecification.java

示例10: getCheckForNullProperty

import edu.umd.cs.findbugs.ba.interproc.ParameterProperty; //导入依赖的package包/类
public ParameterProperty getCheckForNullProperty() {
    return possiblyNullProperty;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:NonNullSpecification.java


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