src.samples.java.ex.UEC_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fb-contrib Show documentation
Show all versions of fb-contrib Show documentation
An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.
package ex;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@SuppressWarnings("all")
public class UEC_Sample {
Map fpConcur = new ConcurrentHashMap<>();
public enum Suite {
Spades, Hearts, Clubs, Diamonds
};
public enum FalsePositive {
A, B, C
};
private final Set wildSuites = new HashSet<>();
private final EnumSet eWildSuites = EnumSet.noneOf(Suite.class);
private interface EnumStub {
}
public enum EnumWithInf implements EnumStub {
A, B, C
};
public UEC_Sample() {
wildSuites.add(Suite.Spades);
}
public UEC_Sample(Suite s) {
wildSuites.add(s);
}
public Map deal() {
Map hand = new HashMap<>();
hand.put(Suite.Spades, new Integer(10));
hand.put(Suite.Hearts, new Integer(9));
return hand;
}
public EnumMap eDeal() {
EnumMap hand = new EnumMap(Suite.class);
hand.put(Suite.Spades, new Integer(10));
hand.put(Suite.Hearts, new Integer(9));
return hand;
}
public void uecFP() {
Set testSet = EnumSet.of(FalsePositive.A);
testSet.add(FalsePositive.B);
}
public Set getSuites() {
return EnumSet. allOf(Suite.class);
}
public void uecFP2() {
Set suites = getSuites();
suites.add(Suite.Clubs);
}
public void fpEnumsWithInf() {
Set es = new HashSet<>();
es.add(EnumWithInf.A);
es.add(EnumWithInf.B);
es.add(EnumWithInf.C);
}
public void fpDontRecommendOnConcurrent(FalsePositive fp) {
fpConcur.put(fp, Integer.valueOf(1));
}
}