Package edu.umd.cs.findbugs.ba

Examples of edu.umd.cs.findbugs.ba.XMethod


    boolean sawInitializeSuper;

    @Override
    public void sawOpcode(int seen) {
        if (getMethodName().equals("<init>") && seen == INVOKEVIRTUAL) {
            XMethod m = getXMethodOperand();
            if (m != null && !m.isPrivate() && !m.isFinal()) {
                int args = PreorderVisitor.getNumberArguments(m.getSignature());
                OpcodeStack.Item item = stack.getStackItem(args);
                if (item.getRegisterNumber() == 0) {
                    try {
                        Set<XMethod> targets = Hierarchy2.resolveVirtualMethodCallTargets(m, false, false);
                        Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();

                        for (XMethod called : targets) {
                            if (!called.isAbstract() && !called.equals(m)
                                    && subtypes2.isSubtype(called.getClassDescriptor(), getClassDescriptor())) {
                                fieldSummary.setCalledFromSuperConstructor(new ProgramPoint(this), called);
                            }
                        }
                    } catch (ClassNotFoundException e) {
                        AnalysisContext.reportMissingClass(e);
                    }

                }

            }

        }

        if (seen == INVOKESPECIAL && getMethodName().equals("<init>") && getNameConstantOperand().equals("<init>")) {

            String classOperand = getClassConstantOperand();
            OpcodeStack.Item invokedOn = stack.getItemMethodInvokedOn(this);
            if (invokedOn.getRegisterNumber() == 0 && !classOperand.equals(getClassName())) {
                sawInitializeSuper = true;
                XMethod invoked = getXMethodOperand();
                if (invoked != null) {
                    fieldSummary.sawSuperCall(getXMethod(), invoked);
                }
            }
View Full Code Here


    }

    private boolean isExplicitlyNullable() {
        AnalysisContext analysisContext = AnalysisContext.currentAnalysisContext();
        INullnessAnnotationDatabase nullnessAnnotationDatabase = analysisContext.getNullnessAnnotationDatabase();
        XMethod xMethod = getXMethod();
        NullnessAnnotation na = nullnessAnnotationDatabase.getResolvedAnnotation(xMethod, true);
        return na != null && na != NullnessAnnotation.NONNULL;
    }
View Full Code Here

            String className = inv.getClassName(cpg);

            Location loc = new Location(thrower, basicBlock);
            TypeFrame typeFrame = typeDataflow.getFactAtLocation(loc);
            XMethod primaryXMethod = XFactory.createXMethod(inv, cpg);
            // if (primaryXMethod.isAbstract()) continue;
            Set<XMethod> targetSet = null;
            try {

                if (className.startsWith("[")) {
View Full Code Here

        case Constants.INVOKESTATIC:
        case Constants.INVOKEVIRTUAL:
        case Constants.INVOKEINTERFACE:
        case Constants.INVOKESPECIAL:
            MethodDescriptor called = getMethodDescriptorOperand();
            XMethod calledXMethod = XFactory.createXMethod(called);
            InterproceduralCallGraphVertex calledVertex = findVertex(calledXMethod);
            callGraph.createEdge(currentVertex, calledVertex);
            break;
        default:
            break;
View Full Code Here

    public void sawOpcode(int seen) {
        switch (seen) {
        case INVOKEVIRTUAL:
        case INVOKESPECIAL:
        case INVOKESTATIC:
            XMethod callSeen = XFactory.createXMethod(MethodAnnotation.fromCalledMethod(this));
            DefaultEncodingAnnotation annotation = defaultEncodingAnnotationDatabase.getDirectAnnotation(callSeen);
            if (annotation != null) {
                bugAccumulator.accumulateBug(new BugInstance(this, "DM_DEFAULT_ENCODING", HIGH_PRIORITY).addClassAndMethod(this)
                        .addCalledMethod(this), this);
            }
View Full Code Here

        if (methodDescriptor.getName().startsWith("access$")) {
            return;
        }

        XMethod xMethod = XFactory.createXMethod(methodDescriptor);
        if (DEBUG) {
            System.out.println("CheckTypeQualifiers: checking " + methodDescriptor.toString());
        }

        Collection<TypeQualifierValue<?>> relevantQualifiers = Analysis.getRelevantTypeQualifiers(methodDescriptor, cfg);
View Full Code Here

            return null;
        }
    }
    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;
        }
View Full Code Here

                return true;
            }
            if (getSignature().equals("Ljavax/servlet/ServletOutputStream;")) {
                return true;
            }
            XMethod writingToSource = getReturnValueOf();


            return writingToSource != null && writingToSource.getClassName().equals("javax.servlet.http.HttpServletResponse")
                    && (writingToSource.getName().equals("getWriter") || writingToSource.getName().equals("getOutputStream"));
        }
View Full Code Here

        }

        public static @CheckForNull JumpInfo computeJumpInfo(JavaClass jclass, Method method,
                JumpStackComputation branchAnalysis) {
            branchAnalysis.setupVisitorForClass(jclass);
            XMethod createXMethod = XFactory.createXMethod(jclass, method);
            if (!(createXMethod instanceof MethodInfo)) {
                return null;
            }
            MethodInfo xMethod = (MethodInfo) createXMethod;
View Full Code Here

        writer.write(",");
        writer.write(method.getName());
        writer.write(",");
        writer.write(method.getSignature());
        writer.write(",");
        XMethod xMethod =  XFactory.createXMethod(method);
        writer.write(Integer.toString(xMethod.getAccessFlags() & 0xf));
    }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.ba.XMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.