Examples of ObligationPolicyDatabase


Examples of edu.umd.cs.findbugs.ba.obl.ObligationPolicyDatabase

            assert true;
        }
        UnresolvedXMethod xmethod = new UnresolvedXMethod(originalDescriptor);


        ObligationPolicyDatabase database = Global.getAnalysisCache().getOptionalDatabase(ObligationPolicyDatabase.class);

        if (BuildObligationPolicyDatabase.INFER_CLOSE_METHODS && database != null
                && !xmethod.getClassName().startsWith("java")) {
            boolean methodHasCloseInName = false;
            String methodName = xmethod.getName();
            SplitCamelCaseIdentifier splitter = new SplitCamelCaseIdentifier(methodName);
            methodHasCloseInName = splitter.split().contains("close");
            Obligation[] paramObligationTypes = database.getFactory().getParameterObligationTypes(xmethod);

            for (int i = 0; i < xmethod.getNumParams(); i++) {
                Obligation obligationType = paramObligationTypes[i];
                if (obligationType == null) {
                    continue;
                }
                if (methodHasCloseInName) {
                    // Method has "close" in its name.
                    // Assume that it deletes the obligation.
                    ObligationPolicyDatabaseEntry entry = database.addParameterDeletesObligationDatabaseEntry(xmethod,
                            obligationType, ObligationPolicyDatabaseEntryType.STRONG);

                } else {

                    /*
                     * // Interesting case: we have a parameter which is // an
                     * Obligation type, but no annotation or other indication //
                     * what is done by the method with the obligation. // We'll
                     * create a "weak" database entry deleting the //
                     * obligation. If strict checking is performed, // weak
                     * entries are ignored.
                     */
                    if (methodName.equals("<init>") || methodName.startsWith("access$") || xmethod.isStatic()
                            || methodName.toLowerCase().indexOf("close") >= 0
                            || xmethod.getSignature().toLowerCase().indexOf("Closeable") >= 0) {
                        ObligationPolicyDatabaseEntry entry = database.addParameterDeletesObligationDatabaseEntry(xmethod,
                                obligationType, ObligationPolicyDatabaseEntryType.WEAK);
                    }
                }
            }

View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.ObligationPolicyDatabase

        CFG cfg = analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
        DepthFirstSearch dfs = analysisCache.getMethodAnalysis(DepthFirstSearch.class, methodDescriptor);
        XMethod xmethod = XFactory.createXMethod(methodDescriptor);
        ConstantPoolGen cpg = analysisCache.getClassAnalysis(ConstantPoolGen.class, methodDescriptor.getClassDescriptor());

        ObligationPolicyDatabase database = analysisCache.getDatabase(ObligationPolicyDatabase.class);

        TypeDataflow typeDataflow = analysisCache.getMethodAnalysis(TypeDataflow.class, methodDescriptor);
        IsNullValueDataflow invDataflow = analysisCache.getMethodAnalysis(IsNullValueDataflow.class, methodDescriptor);

        ObligationFactory factory = database.getFactory();

        ObligationAnalysis analysis = new ObligationAnalysis(dfs, xmethod, cpg, factory, database, typeDataflow, invDataflow,
                analysisCache.getErrorLogger());
        ObligationDataflow dataflow = new ObligationDataflow(cfg, analysis);
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.ObligationPolicyDatabase

        this.willCloseWhenClosed = instance.getClassDescriptor(WillCloseWhenClosed.class);
        this.cleanupObligation = instance.getClassDescriptor(CleanupObligation.class);
        this.createsObligation = instance.getClassDescriptor(CreatesObligation.class);
        this.dischargesObligation = instance.getClassDescriptor(DischargesObligation.class);

        database = new ObligationPolicyDatabase();
        addBuiltInPolicies();
        URL u = DetectorFactoryCollection.getCoreResource("obligationPolicy.db");
        try {
            if (u != null) {
                AuxilaryObligationPropertyDatabase db = new AuxilaryObligationPropertyDatabase();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.