KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > FindBugsAnalysisFeatures


1 /*
2  * FindBugs - Find bugs in Java programs
3  * Copyright (C) 2005, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs;
21
22 import edu.umd.cs.findbugs.ba.AnalysisContext;
23 import edu.umd.cs.findbugs.ba.AnalysisFeatures;
24
25 /**
26  * Boolean-valued analysis properties for FindBugs.
27  *
28  * @see edu.umd.cs.findbugs.ba.AnalysisContext#setBoolProperty(int, boolean)
29  * @see edu.umd.cs.findbugs.ba.AnalysisContext#getBoolProperty(int)
30  * @author David Hovemeyer
31  */

32 public abstract class FindBugsAnalysisFeatures {
33     private static final int START;
34      static {
35          START = AnalysisFeatures.NUM_BOOLEAN_ANALYSIS_PROPERTIES;
36      }
37     
38     /**
39      * "Relaxed" warning reporting mode.
40      * Rather than using hard-coded heuristics to decide when
41      * to suppress a warning, report warnings freely and
42      * encode the heuristics as BugProperties (for consumption
43      * by a machine-learning-based ranking algorithm).
44      */

45     public static final int RELAXED_REPORTING_MODE = START + 0;
46     
47     /**
48      * Enable interprocedural analysis.
49      */

50     public static final int INTERPROCEDURAL_ANALYSIS = START + 1;
51     public static final int INTERPROCEDURAL_ANALYSIS_OF_REFERENCED_CLASSES = START + 2;
52
53     private static void setProperty(int property, boolean value) {
54         AnalysisContext.currentAnalysisContext().setBoolProperty(property, value);
55     }
56     
57     private static boolean getProperty(int property) {
58         return AnalysisContext.currentAnalysisContext().getBoolProperty(property);
59     }
60
61     /**
62      * Set relaxed reporting mode.
63      *
64      * @param relaxedMode true if relaxed reporting mode should be enabled, false if not
65      */

66     public static void setRelaxedMode(boolean relaxedMode) {
67         setProperty(RELAXED_REPORTING_MODE, relaxedMode);
68     }
69     
70     /**
71      * Get relaxed reporting mode.
72      *
73      * @return true if relaxed reporting mode should be enabled, false if not
74      */

75     public static boolean isRelaxedMode() {
76         return getProperty(RELAXED_REPORTING_MODE);
77     }
78 }
79
Popular Tags