Skip to content

Commit

Permalink
clean up warnings caused by type qualifiers
Browse files Browse the repository at this point in the history
git-svn-id: https://findbugs.googlecode.com/svn/trunk@14543 eae3c2d3-9b19-0410-a86e-396b6ccb6ab3
  • Loading branch information
billpugh committed Dec 3, 2012
1 parent 3eef449 commit 83f8c89
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@

/**
* Boolean-valued analysis properties for FindBugs.
*
*
* @see edu.umd.cs.findbugs.ba.AnalysisContext#setBoolProperty(int, boolean)
* @see edu.umd.cs.findbugs.ba.AnalysisContext#getBoolProperty(int)
* @author David Hovemeyer
*/
public abstract class FindBugsAnalysisFeatures {
private static final int START;
static {
START = AnalysisFeatures.NUM_BOOLEAN_ANALYSIS_PROPERTIES;
}


/**
* "Relaxed" warning reporting mode. Rather than using hard-coded heuristics
Expand All @@ -43,16 +40,16 @@ public abstract class FindBugsAnalysisFeatures {
* machine-learning-based ranking algorithm).
*/
public static final @AnalysisFeature
int RELAXED_REPORTING_MODE = START + 0;
int RELAXED_REPORTING_MODE = AnalysisFeatures.Builder.build("RELAXED_REPORTING_MODE");

/**
* Enable interprocedural analysis.
*/
public static final @AnalysisFeature
int INTERPROCEDURAL_ANALYSIS = START + 1;
int INTERPROCEDURAL_ANALYSIS = AnalysisFeatures.Builder.build("INTERPROCEDURAL_ANALYSIS");

public static final @AnalysisFeature
int INTERPROCEDURAL_ANALYSIS_OF_REFERENCED_CLASSES = START + 2;
int INTERPROCEDURAL_ANALYSIS_OF_REFERENCED_CLASSES = AnalysisFeatures.Builder.build("INTERPROCEDURAL_ANALYSIS_OF_REFERENCED_CLASSES");

static void setProperty(@AnalysisFeature int property, boolean value) {
AnalysisContext.currentAnalysisContext().setBoolProperty(property, value);
Expand All @@ -64,7 +61,7 @@ static boolean getProperty(@AnalysisFeature int property) {

/**
* Set relaxed reporting mode.
*
*
* @param relaxedMode
* true if relaxed reporting mode should be enabled, false if not
*/
Expand All @@ -74,7 +71,7 @@ public static void setRelaxedMode(boolean relaxedMode) {

/**
* Get relaxed reporting mode.
*
*
* @return true if relaxed reporting mode should be enabled, false if not
*/
public static boolean isRelaxedMode() {
Expand Down
11 changes: 7 additions & 4 deletions findbugs/src/java/edu/umd/cs/findbugs/OpcodeStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.apache.bcel.generic.BasicType;
import org.apache.bcel.generic.Type;

import edu.umd.cs.findbugs.OpcodeStack.Item.SpecialKind;
import edu.umd.cs.findbugs.ba.AnalysisContext;
import edu.umd.cs.findbugs.ba.AnalysisFeatures;
import edu.umd.cs.findbugs.ba.ClassMember;
Expand Down Expand Up @@ -229,14 +230,16 @@ public static class Item {
public static final @SpecialKind
int SERVLET_OUTPUT = 23;

public static HashMap<Integer, String> specialKindNames = new HashMap<Integer, String>();
public static final HashMap<Integer, String> specialKindNames = new HashMap<Integer, String>();

private static @SpecialKind int nextSpecialKind = asSpecialKind(SERVLET_OUTPUT + 1);

public static @SpecialKind
int defineNewSpecialKind(String name) {
specialKindNames.put(nextSpecialKind, name);
return asSpecialKind( nextSpecialKind++);
@SpecialKind int result = asSpecialKind( nextSpecialKind+1);
nextSpecialKind = result;
return result;
}

private static final int IS_INITIAL_PARAMETER_FLAG = 1;
Expand Down Expand Up @@ -2991,7 +2994,7 @@ else if (rhs.getConstant() != null && seen == LAND && (constantToLong(rhs) & 0xf

private void pushByFloatMath(int seen, Item it, Item it2) {
Item result;
int specialKind = Item.FLOAT_MATH;
@SpecialKind int specialKind = Item.FLOAT_MATH;
if ((it.getConstant() instanceof Float) && it2.getConstant() instanceof Float) {
if (seen == FADD)
result = new Item("F", Float.valueOf(constantToFloat(it2) + constantToFloat(it)));
Expand All @@ -3016,7 +3019,7 @@ else if (seen == FREM)

private void pushByDoubleMath(int seen, Item it, Item it2) {
Item result;
int specialKind = Item.FLOAT_MATH;
@SpecialKind int specialKind = Item.FLOAT_MATH;
if ((it.getConstant() instanceof Double) && it2.getConstant() instanceof Double) {
if (seen == DADD)
result = new Item("D", Double.valueOf(constantToDouble(it2) + constantToDouble(it)));
Expand Down
15 changes: 14 additions & 1 deletion findbugs/src/java/edu/umd/cs/findbugs/ba/AnalysisFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Boolean analysis properties for use in the AnalysisContext. These can be used
* to enable or disable various analysis features in the bytecode analysis
* framework.
*
*
* @author David Hovemeyer
*/
public interface AnalysisFeatures {
Expand All @@ -40,6 +40,17 @@ public interface AnalysisFeatures {
public @interface AnalysisFeature {
}


public static class Builder {
static int next = NUM_BOOLEAN_ANALYSIS_PROPERTIES;
private static @AnalysisFeature int asFeatureNum(int num) { return num; }
static @AnalysisFeature
public int build(String name) {
int num = next++;
return asFeatureNum(num);
}

}
/**
* Determine (1) what exceptions can be thrown on exception edges, (2) which
* catch blocks are reachable, and (3) which exception edges carry only
Expand Down Expand Up @@ -103,7 +114,9 @@ public interface AnalysisFeatures {
* Number of boolean analysis properties reserved for the bytecode analysis
* framework. Clients of the framework may use property values &gt;= this
* value.
* @deprecated - use Builder instead
*/
@Deprecated
public static final @AnalysisFeature
int NUM_BOOLEAN_ANALYSIS_PROPERTIES = 128;

Expand Down

0 comments on commit 83f8c89

Please sign in to comment.