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


Java XFactory类代码示例

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


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

示例1: findSuperImplementorAsXMethod

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
public static @CheckForNull
XMethod findSuperImplementorAsXMethod(JavaClass clazz, String name, String signature, BugReporter bugReporter) {
    try {
        JavaClass c = clazz;
        while (true) {
            c = c.getSuperClass();
            if (c == null)
                return null;
            Method m = findImplementation(c, name, signature);
            if (m != null && !m.isAbstract())
                return XFactory.createXMethod(c, m);

        }
    } catch (ClassNotFoundException e) {
        bugReporter.reportMissingClass(e);
        return null;
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:19,代码来源:Lookup.java

示例2: visitParameterAnnotation

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
@Override
public void visitParameterAnnotation(int p, String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) {
    if (database == null) {
        return;
    }

    NullnessAnnotation n = NullnessAnnotation.Parser.parse(annotationClass);
    annotationClass = lastPortion(annotationClass);
    if (n == null)
        return;

    XMethod xmethod = XFactory.createXMethod(this);
    if (DEBUG) {
        System.out.println("Parameter " + p + " @" + annotationClass.substring(annotationClass.lastIndexOf('/') + 1) + " in "
                + xmethod.toString());
    }
    XMethodParameter xparameter = new XMethodParameter(xmethod, p);

    database.addDirectAnnotation(xparameter, n);

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

示例3: visit

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
@Override
public void visit(ConstantValue s) {
    if (!visitingField())
        return;
    int i = s.getConstantValueIndex();
    Constant c = getConstantPool().getConstant(i);
    if (c instanceof ConstantString) {
        String value = ((ConstantString) c).getBytes(getConstantPool());
        if (value.length() < SIZE_OF_HUGE_CONSTANT)
            return;
        String key = getStringKey(value);
        definition.put(key, XFactory.createXField(this));
        stringSize.put(key, value.length());
    }

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

示例4: visitAnnotation

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
@Override
public void visitAnnotation(String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) {

    if (!annotationClass.startsWith(NET_JCIP_ANNOTATIONS))
        return;
    annotationClass = annotationClass.substring(NET_JCIP_ANNOTATIONS.length());
    ElementValue value = map.get("value");
    ClassMember member;
    if (visitingField())
        member = XFactory.createXField(this);
    else if (visitingMethod())
        member = XFactory.createXMethod(this);
    else {
        Map<String, ElementValue> annotationsOfThisClass = AnalysisContext.currentAnalysisContext()
                .getJCIPAnnotationDatabase().getEntryForClass(getDottedClassName());
        annotationsOfThisClass.put(annotationClass, value);
        return;
    }
    Map<String, ElementValue> annotationsOfThisMember = AnalysisContext.currentAnalysisContext().getJCIPAnnotationDatabase()
            .getEntryForClassMember(member);
    annotationsOfThisMember.put(annotationClass, value);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:23,代码来源:NoteJCIPAnnotation.java

示例5: parseKey

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
@Override
protected FieldDescriptor parseKey(String s) throws PropertyDatabaseFormatException {
    String[] tuple = s.split(",");
    if (tuple.length != 4) {
        throw new PropertyDatabaseFormatException("Invalid field tuple: " + s);
    }

    String className = XFactory.canonicalizeString(tuple[0]);
    String fieldName = XFactory.canonicalizeString(tuple[1]);
    String signature = XFactory.canonicalizeString(tuple[2]);
    int accessFlags;
    try {
        accessFlags = Integer.parseInt(tuple[3]);
    } catch (NumberFormatException e) {
        throw new PropertyDatabaseFormatException("Invalid field access flags: " + tuple[3]);
    }

    return DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), fieldName, signature,
            (accessFlags & Constants.ACC_STATIC) != 0);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:21,代码来源:FieldPropertyDatabase.java

示例6: modelFieldStore

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
private void modelFieldStore(Location location) throws DataflowAnalysisException {
    // Model field stores
    XField writtenField = XFactory.createXField((FieldInstruction) location.getHandle().getInstruction(), cpg);
    TypeQualifierAnnotation tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(writtenField,
            typeQualifierValue);
    When when = (tqa != null) ? tqa.when : When.UNKNOWN;

    // The ValueNumberFrame *before* the FieldInstruction should
    // have the ValueNumber of the stored value on the top of the stack.
    ValueNumberFrame vnaFrameAtStore = vnaDataflow.getFactAtLocation(location);
    if (vnaFrameAtStore.isValid()) {
        ValueNumber vn = vnaFrameAtStore.getTopValue();
        SourceSinkInfo sink = new SourceSinkInfo(SourceSinkType.FIELD_STORE, location, vn, when);
        registerSourceSink(sink);
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:17,代码来源:BackwardTypeQualifierDataflowAnalysis.java

示例7: computeJumpInfo

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
/**
 * @param jclass
 * @param method
 * @param stack
 * @param branchAnalysis
 * @return
 */
public static JumpInfo computeJumpInfo(JavaClass jclass, Method method, final OpcodeStack stack,
        DismantleBytecode branchAnalysis) {
    branchAnalysis.setupVisitorForClass(jclass);
    MethodInfo xMethod = (MethodInfo) XFactory.createXMethod(jclass, method);
    int oldCount = 0;
    while (true) {
        stack.resetForMethodEntry0(ClassName.toSlashedClassName(jclass.getClassName()), method);
        branchAnalysis.doVisitMethod(method);
        int newCount = stack.jumpEntries.size();
        if (xMethod.hasBackBranch() != stack.backwardsBranch && !stack.encountedTop) {
            AnalysisContext.logError(
                    String.format("For %s, mismatch on existence of backedge: %s for precomputation, %s for bytecode analysis",
                            xMethod, xMethod.hasBackBranch(), stack.backwardsBranch));
        }
        if (newCount == oldCount || !stack.encountedTop || !stack.backwardsBranch)
            break;
        oldCount = newCount;
    }

    return new JumpInfo(stack.jumpEntries, stack.jumpStackEntries, stack.jumpEntryLocations);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:29,代码来源:OpcodeStack.java

示例8: 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

示例9: parseKey

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
@Override
protected MethodDescriptor parseKey(String methodStr) throws PropertyDatabaseFormatException {
    String[] tuple = methodStr.split(",");
    if (tuple.length != 4)
        throw new PropertyDatabaseFormatException("Invalid method tuple: " + methodStr);

    try {
        int accessFlags = Integer.parseInt(tuple[3]);
        // return
        // XFactory.createMethodDescriptor(XFactory.canonicalizeString(tuple[0]),
        // XFactory.canonicalizeString( tuple[1]),
        // XFactory.canonicalizeString(tuple[2]), accessFlags);
        String className = XFactory.canonicalizeString(tuple[0]);
        String methodName = XFactory.canonicalizeString(tuple[1]);
        String methodSig = XFactory.canonicalizeString(tuple[2]);
        return DescriptorFactory.instance().getMethodDescriptor(ClassName.toSlashedClassName(className), methodName,
                methodSig, (accessFlags & Constants.ACC_STATIC) != 0);

    } catch (NumberFormatException e) {
        return null;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:23,代码来源:MethodPropertyDatabase.java

示例10: checkNonNullPutField

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
/**
 * If this is a putfield or putstatic instruction, check to see if the field
 * is @NonNull, and treat it as dereferences.
 *
 * @param location
 *            the Location of the instruction
 * @param vnaFrame
 *            the ValueNumberFrame at the Location of the instruction
 * @param fact
 *            the dataflow value to modify
 * @throws DataflowAnalysisException
 */
private void checkNonNullPutField(Location location, ValueNumberFrame vnaFrame, UnconditionalValueDerefSet fact)
        throws DataflowAnalysisException {
    INullnessAnnotationDatabase database = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase();
    if (database == null) {
        return;
    }

    FieldInstruction fieldIns = (FieldInstruction) location.getHandle().getInstruction();

    XField field = XFactory.createXField(fieldIns, methodGen.getConstantPool());
    char firstChar = field.getSignature().charAt(0);
    if (firstChar != 'L' && firstChar != '[')
        return;
    NullnessAnnotation resolvedAnnotation = database.getResolvedAnnotation(field, true);
    if (resolvedAnnotation == NullnessAnnotation.NONNULL) {
        IsNullValueFrame invFrame = invDataflow.getFactAtLocation(location);
        if (!invFrame.isValid())
            return;
        IsNullValue value = invFrame.getTopValue();
        if (reportDereference(value)) {
            ValueNumber vn = vnaFrame.getTopValue();
            fact.addDeref(vn, location);
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:38,代码来源:UnconditionalValueDerefAnalysis.java

示例11: visit

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
@Override
public void visit(Method obj) {
    if (obj.isAbstract() || BCELUtil.isSynthetic(obj))
        return;
    if (!obj.isPublic())
        return;
    if (!getMethodName().equals("clone"))
        return;
    if (!getMethodSig().startsWith("()"))
        return;
    hasCloneMethod = true;
    cloneIsDeprecated = getXMethod().isDeprecated();
    cloneMethodAnnotation = MethodAnnotation.fromVisitedMethod(this);
    cloneOnlyThrowsException = PruneUnconditionalExceptionThrowerEdges.doesMethodUnconditionallyThrowException(XFactory
            .createXMethod(this));
    // ExceptionTable tbl = obj.getExceptionTable();
    // throwsExceptions = tbl != null && tbl.getNumberOfExceptions() > 0;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:19,代码来源:CloneIdiom.java

示例12: visitAnnotation

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
@Override
public void visitAnnotation(String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) {
    if (annotationClass.startsWith(NET_JCIP_ANNOTATIONS)) {
        annotationClass = annotationClass.substring(NET_JCIP_ANNOTATIONS.length());
    } else if (annotationClass.startsWith(JSR305_CONCURRENT_ANNOTATIONS)) {
        annotationClass = annotationClass.substring(JSR305_CONCURRENT_ANNOTATIONS.length());
    } else {
        return;
    }
    JCIPAnnotationDatabase annotationDatabase = AnalysisContext.currentAnalysisContext()
        .getJCIPAnnotationDatabase();
    ElementValue value = map.get("value");
    ClassMember member;
    if (visitingField()) {
        member = XFactory.createXField(this);
    } else if (visitingMethod()) {
        member = XFactory.createXMethod(this);
    } else {
        annotationDatabase.addEntryForClass(getDottedClassName(), annotationClass, value);
        return;
    }
    annotationDatabase.addEntryForClassMember(member, annotationClass, value);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:24,代码来源:NoteJCIPAnnotation.java

示例13: getJumpInfoFromStackMap

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
private JumpInfoFromStackMap getJumpInfoFromStackMap() {
    IAnalysisCache analysisCache = Global.getAnalysisCache();
    XMethod xMethod = XFactory.createXMethod(v.getThisClass(), v.getMethod());
    if (xMethod instanceof MethodInfo) {
        MethodInfo mi = (MethodInfo) xMethod;
        if (!mi.hasBackBranch())
            return null;
    }
    
    try {
        return analysisCache.getMethodAnalysis(JumpInfoFromStackMap.class, xMethod.getMethodDescriptor());
        
    } catch (CheckedAnalysisException e) {
        AnalysisContext.logError("Error getting jump information from StackMap", e);
        return null;
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:18,代码来源:OpcodeStack.java

示例14: addPropertiesForMethodContainingWarning

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
/**
 * @param propertySet
 * @param xMethod
 */
private void addPropertiesForMethodContainingWarning(WarningPropertySet<WarningProperty> propertySet) {
    XMethod xMethod = XFactory.createXMethod(classContext.getJavaClass(), method);

    boolean uncallable = !AnalysisContext.currentXFactory().isCalledDirectlyOrIndirectly(xMethod) && xMethod.isPrivate();

    if (uncallable)
        propertySet.addProperty(GeneralWarningProperty.IN_UNCALLABLE_METHOD);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:13,代码来源:NoiseNullDeref.java

示例15: registerFieldLoadSource

import edu.umd.cs.findbugs.ba.XFactory; //导入依赖的package包/类
private void registerFieldLoadSource(Location location) throws DataflowAnalysisException {
    XField loadedField = XFactory.createXField((FieldInstruction) location.getHandle().getInstruction(), cpg);
    if (loadedField.isResolved()) {
        TypeQualifierAnnotation tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(loadedField,
                typeQualifierValue);
        When when = (tqa != null) ? tqa.when : When.UNKNOWN;
        registerTopOfStackSource(SourceSinkType.FIELD_LOAD, location, when, false, null);
    }

}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:11,代码来源:ForwardTypeQualifierDataflowAnalysis.java


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