src.samples.java.ex.PMB_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.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
public class PMB_Sample {
private static Set bl_data = new HashSet(); // tag
private static List data = new ArrayList(); // no tag
private static Set inner_data = new HashSet(); // no tag
private static StringBuilder return_data = new StringBuilder(); // no tag
private static Map fp_data = new WeakHashMap();
private static final Set bloatableSigs = new HashSet();
static {
bloatableSigs.add("Ljava/util/concurrent/ArrayBlockingQueue;");
bloatableSigs.add("Ljava/util/ArrayList;");
bloatableSigs.add("Ljava/util/concurrent/BlockingQueue;");
bloatableSigs.add("Ljava/util/Collection;");
bloatableSigs.add("Ljava/util/concurrent/ConcurrentHashMap;");
bloatableSigs.add("Ljava/util/concurrent/ConcurrentSkipListMap;");
bloatableSigs.add("Ljava/util/concurrent/ConcurrentSkipListSet;");
bloatableSigs.add("Ljava/util/concurrent/CopyOnWriteArraySet;");
bloatableSigs.add("Ljava/util/EnumSet;");
bloatableSigs.add("Ljava/util/EnumMap;");
bloatableSigs.add("Ljava/util/HashMap;");
bloatableSigs.add("Ljava/util/HashSet;");
bloatableSigs.add("Ljava/util/Hashtable;");
bloatableSigs.add("Ljava/util/IdentityHashMap;");
bloatableSigs.add("Ljava/util/concurrent/LinkedBlockingQueue;");
bloatableSigs.add("Ljava/util/LinkedHashMap;");
bloatableSigs.add("Ljava/util/LinkedHashSet;");
bloatableSigs.add("Ljava/util/LinkedList;");
bloatableSigs.add("Ljava/util/List;");
bloatableSigs.add("Ljava/util/concurrent/PriorityBlockingQueue;");
bloatableSigs.add("Ljava/util/PriorityQueue;");
bloatableSigs.add("Ljava/util/Map;");
bloatableSigs.add("Ljava/util/Queue;");
bloatableSigs.add("Ljava/util/Set;");
bloatableSigs.add("Ljava/util/SortedSet;");
bloatableSigs.add("Ljava/util/SortedMap;");
bloatableSigs.add("Ljava/util/Stack;");
bloatableSigs.add("Ljava/lang/StringBuffer;");
bloatableSigs.add("Ljava/lang/StringBuilder;");
bloatableSigs.add("Ljava/util/TreeMap;");
bloatableSigs.add("Ljava/util/TreeSet;");
bloatableSigs.add("Ljava/util/Vector;");
}
// tag
private ThreadLocal local = new ThreadLocal() {
@Override
protected DateFormat initialValue() {
return new SimpleDateFormat();
}
};
private static ThreadLocal staticLocal = new ThreadLocal() {
@Override
protected DateFormat initialValue() {
return new SimpleDateFormat();
}
};
public void add(String s) {
bl_data.add(s);
data.add(s);
System.out.println(staticLocal);
System.out.println(local);
}
public void remove(String s) {
data.remove(s);
}
public void fpInnerDoesRemove() {
inner_data.add("Hello");
Runnable r = new Runnable() {
@Override
public void run() {
inner_data.remove("Hello");
}
};
r.run();
}
public void fpAddToWeakHashMap() {
fp_data.put("Hello", "There");
}
}