01: /*
02: * FindBugs - Find bugs in Java programs
03: * Copyright (C) 2005, University of Maryland
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
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: static void setProperty(int property, boolean value) {
54: AnalysisContext.currentAnalysisContext().setBoolProperty(
55: property, value);
56: }
57:
58: static boolean getProperty(int property) {
59: return AnalysisContext.currentAnalysisContext()
60: .getBoolProperty(property);
61: }
62:
63: /**
64: * Set relaxed reporting mode.
65: *
66: * @param relaxedMode true if relaxed reporting mode should be enabled, false if not
67: */
68: public static void setRelaxedMode(boolean relaxedMode) {
69: setProperty(RELAXED_REPORTING_MODE, relaxedMode);
70: }
71:
72: /**
73: * Get relaxed reporting mode.
74: *
75: * @return true if relaxed reporting mode should be enabled, false if not
76: */
77: public static boolean isRelaxedMode() {
78: return getProperty(RELAXED_REPORTING_MODE);
79: }
80: }
|