IllegalArgumentExceptions and minor cleanups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1632 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
47cc86cea8
commit
c2a17a5fbc
|
@ -222,8 +222,12 @@ public class CodeScanner {
|
|||
|
||||
/**
|
||||
* @return Set <TypeReference>
|
||||
* @throws IllegalArgumentException if statements == null
|
||||
*/
|
||||
public static Set<TypeReference> getCaughtExceptions(SSAInstruction[] statements) {
|
||||
public static Set<TypeReference> getCaughtExceptions(SSAInstruction[] statements) throws IllegalArgumentException {
|
||||
if (statements == null) {
|
||||
throw new IllegalArgumentException("statements == null");
|
||||
}
|
||||
final HashSet<TypeReference> result = HashSetFactory.make(10);
|
||||
Visitor v = new Visitor() {
|
||||
@Override
|
||||
|
@ -377,8 +381,11 @@ public class CodeScanner {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasObjectArrayStore(SSAInstruction[] statements) {
|
||||
public static boolean hasObjectArrayStore(SSAInstruction[] statements) throws IllegalArgumentException {
|
||||
|
||||
if (statements == null) {
|
||||
throw new IllegalArgumentException("statements == null");
|
||||
}
|
||||
class ScanVisitor extends Visitor {
|
||||
boolean foundOne = false;
|
||||
|
||||
|
|
|
@ -149,8 +149,12 @@ public abstract class DemandFlowGraph extends FlowLabelGraph {
|
|||
* add representation of flow for a node, if not already present
|
||||
*
|
||||
* @param node
|
||||
* @throws IllegalArgumentException if node == null
|
||||
*/
|
||||
public void addSubgraphForNode(CGNode node) {
|
||||
public void addSubgraphForNode(CGNode node) throws IllegalArgumentException {
|
||||
if (node == null) {
|
||||
throw new IllegalArgumentException("node == null");
|
||||
}
|
||||
if (node.getIR() == null) {
|
||||
throw new IllegalArgumentException("no ir for node " + node);
|
||||
}
|
||||
|
@ -360,13 +364,15 @@ public abstract class DemandFlowGraph extends FlowLabelGraph {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param sfk
|
||||
* the static field
|
||||
* @return all the variables that get the value of sfk
|
||||
* @throws IllegalArgumentException if sfk == null
|
||||
*/
|
||||
public Iterator<? extends Object> getReadsOfStaticField(StaticFieldKey sfk) {
|
||||
public Iterator<? extends Object> getReadsOfStaticField(StaticFieldKey sfk) throws IllegalArgumentException {
|
||||
if (sfk == null) {
|
||||
throw new IllegalArgumentException("sfk == null");
|
||||
}
|
||||
Collection<MemoryAccess> fieldReads = mam.getFieldReads(sfk.getField());
|
||||
for (MemoryAccess a : fieldReads) {
|
||||
addSubgraphForNode(a.getNode());
|
||||
|
|
|
@ -81,7 +81,10 @@ public class GetFieldLabel implements IFlowLabel {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitGetField(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,6 @@ public class MatchBarLabel implements IFlowLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#bar()
|
||||
*/
|
||||
public MatchLabel bar() {
|
||||
|
@ -62,12 +60,13 @@ public class MatchBarLabel implements IFlowLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#visit(demandGraph.IFlowLabel.IFlowLabelVisitor,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitMatchBar(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,10 @@ public class MatchLabel implements IFlowLabel {
|
|||
return theInstance;
|
||||
}
|
||||
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitMatch(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,6 @@ public class NewBarLabel implements IFlowLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#bar()
|
||||
*/
|
||||
public NewLabel bar() {
|
||||
|
@ -62,12 +60,13 @@ public class NewBarLabel implements IFlowLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#visit(demandGraph.IFlowLabel.IFlowLabelVisitor,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitNewBar(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,10 @@ public class NewLabel implements IFlowLabel {
|
|||
return theInstance;
|
||||
}
|
||||
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitNew(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,10 @@ public class ParamLabel extends CallLabel {
|
|||
return new ParamLabel(callSite);
|
||||
}
|
||||
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitParam(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,6 @@ public class PutFieldBarLabel implements IFlowLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#bar()
|
||||
*/
|
||||
public PutFieldLabel bar() {
|
||||
|
@ -95,12 +93,13 @@ public class PutFieldBarLabel implements IFlowLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#visit(demandGraph.IFlowLabel.IFlowLabelVisitor,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitPutFieldBar(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,10 @@ public class PutFieldLabel implements IFlowLabel {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitPutField(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ public class ReturnBarLabel extends CallLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#bar()
|
||||
*/
|
||||
public ReturnLabel bar() {
|
||||
|
@ -63,12 +61,13 @@ public class ReturnBarLabel extends CallLabel {
|
|||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see demandGraph.IFlowLabel#visit(demandGraph.IFlowLabel.IFlowLabelVisitor,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
public void visit(IFlowLabelVisitor v, Object dst) {
|
||||
public void visit(IFlowLabelVisitor v, Object dst) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
v.visitReturnBar(this, dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,10 @@ public class ArraySet<T> extends AbstractSet<T> {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean addAll(ArraySet<T> other) {
|
||||
public boolean addAll(ArraySet<T> other) throws IllegalArgumentException {
|
||||
if (other == null) {
|
||||
throw new IllegalArgumentException("other == null");
|
||||
}
|
||||
boolean ret = false;
|
||||
for (int i = 0; i < other.size(); i++) {
|
||||
boolean added = add(other.get(i));
|
||||
|
|
|
@ -157,14 +157,17 @@ public class ImmutableStack<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param other
|
||||
* @return <code>true</code> iff other.size() = k, k <= this.size(), and the
|
||||
* top k elements of this equal other
|
||||
* @throws IllegalArgumentException if other == null
|
||||
*/
|
||||
public boolean topMatches(ImmutableStack<T> other) {
|
||||
if (other.size() > size())
|
||||
public boolean topMatches(ImmutableStack<T> other) throws IllegalArgumentException {
|
||||
if (other == null) {
|
||||
throw new IllegalArgumentException("other == null");
|
||||
}
|
||||
if (other.size() > size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = other.size() - 1, j = this.size() - 1; i >= 0; i--, j--) {
|
||||
if (!other.get(i).equals(get(j)))
|
||||
return false;
|
||||
|
|
|
@ -80,7 +80,7 @@ public class Util {
|
|||
* Factorial on doubles; avoids overflow problems present when using integers.
|
||||
*
|
||||
* @param n_
|
||||
* arg on which to compute factorial
|
||||
* arg on which to compute factorial
|
||||
* @return (<code>double</code> approximation to) factorial of largest
|
||||
* positive integer <= (n_ + epsilon)
|
||||
*/
|
||||
|
@ -179,10 +179,10 @@ public class Util {
|
|||
*
|
||||
* @return The first element satisfying the predicate; otherwise null.
|
||||
*/
|
||||
public static <T> T find(Collection<T> c_, Predicate<T> p_) {
|
||||
for (Iterator<T> iter = c_.iterator(); iter.hasNext();) {
|
||||
public static <T> T find(Collection<T> c, Predicate<T> p) {
|
||||
for (Iterator<T> iter = c.iterator(); iter.hasNext();) {
|
||||
T obj = iter.next();
|
||||
if (p_.test(obj))
|
||||
if (p.test(obj))
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -195,12 +195,12 @@ public class Util {
|
|||
*
|
||||
* @return All the elements satisfying the predicate
|
||||
*/
|
||||
public static <T> Collection<T> findAll(Collection<T> c_, Predicate<T> p_) {
|
||||
public static <T> Collection<T> findAll(Collection<T> c, Predicate<T> p) {
|
||||
Collection<T> result = new LinkedList<T>();
|
||||
|
||||
for (Iterator<T> iter = c_.iterator(); iter.hasNext();) {
|
||||
for (Iterator<T> iter = c.iterator(); iter.hasNext();) {
|
||||
T obj = iter.next();
|
||||
if (p_.test(obj))
|
||||
if (p.test(obj))
|
||||
result.add(obj);
|
||||
}
|
||||
|
||||
|
@ -211,9 +211,9 @@ public class Util {
|
|||
* Test whether <em>all</em> elements of the given {@link Collection}
|
||||
* satisfy the given {@link Predicate}.
|
||||
*/
|
||||
public static <T> boolean forAll(Collection<T> c_, Predicate<T> p_) {
|
||||
for (T t : c_) {
|
||||
if (!p_.test(t))
|
||||
public static <T> boolean forAll(Collection<T> c, Predicate<T> p) {
|
||||
for (T t : c) {
|
||||
if (!p.test(t))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -222,14 +222,14 @@ public class Util {
|
|||
/**
|
||||
* Perform an action for all elements in a collection.
|
||||
*
|
||||
* @param c_
|
||||
* the collection
|
||||
* @param v_
|
||||
* the visitor defining the action
|
||||
* @param c
|
||||
* the collection
|
||||
* @param v
|
||||
* the visitor defining the action
|
||||
*/
|
||||
public static <T> void doForAll(Collection<T> c_, ObjectVisitor<T> v_) {
|
||||
for (Iterator<T> iter = c_.iterator(); iter.hasNext();)
|
||||
v_.visit(iter.next());
|
||||
public static <T> void doForAll(Collection<T> c, ObjectVisitor<T> v) {
|
||||
for (Iterator<T> iter = c.iterator(); iter.hasNext();)
|
||||
v.visit(iter.next());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,11 +238,18 @@ public class Util {
|
|||
* {@link java.lang.reflect reflection} to create a list of the same type as
|
||||
* 'srcList', but reflection works really slowly in some implementations, so
|
||||
* it's best to avoid it.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if srcList == null
|
||||
*/
|
||||
public static <T, U> List<U> map(List<T> srcList, Mapper<T, U> mapper_) {
|
||||
public static <T, U> List<U> map(List<T> srcList, Mapper<T, U> mapper) throws IllegalArgumentException {
|
||||
if (srcList == null) {
|
||||
throw new IllegalArgumentException("srcList == null");
|
||||
}
|
||||
ArrayList<U> result = new ArrayList<U>();
|
||||
for (Iterator<T> srcIter = srcList.iterator(); srcIter.hasNext();)
|
||||
result.add(mapper_.map(srcIter.next()));
|
||||
for (Iterator<T> srcIter = srcList.iterator(); srcIter.hasNext();) {
|
||||
result.add(mapper.map(srcIter.next()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -254,11 +261,11 @@ public class Util {
|
|||
* 'srcList', but reflection works really slowly in some implementations, so
|
||||
* it's best to avoid it.
|
||||
*/
|
||||
public static <T> List<T> filter(Collection<T> src_, Predicate<T> pred_) {
|
||||
public static <T> List<T> filter(Collection<T> src, Predicate<T> pred) {
|
||||
ArrayList<T> result = new ArrayList<T>();
|
||||
for (Iterator<T> srcIter = src_.iterator(); srcIter.hasNext();) {
|
||||
for (Iterator<T> srcIter = src.iterator(); srcIter.hasNext();) {
|
||||
T curElem = srcIter.next();
|
||||
if (pred_.test(curElem))
|
||||
if (pred.test(curElem))
|
||||
result.add(curElem);
|
||||
}
|
||||
return result;
|
||||
|
@ -268,17 +275,17 @@ public class Util {
|
|||
* Filter a collection according to some predicate, placing the result in a
|
||||
* List
|
||||
*
|
||||
* @param src_
|
||||
* collection to be filtered
|
||||
* @param pred_
|
||||
* the predicate
|
||||
* @param result_
|
||||
* the list for the result. assumed to be empty
|
||||
* @param src
|
||||
* collection to be filtered
|
||||
* @param pred
|
||||
* the predicate
|
||||
* @param result
|
||||
* the list for the result. assumed to be empty
|
||||
*/
|
||||
public static <T> void filter(Collection<T> src_, Predicate<T> pred_, List<T> result_) {
|
||||
for (T t : src_) {
|
||||
if (pred_.test(t)) {
|
||||
result_.add(t);
|
||||
public static <T> void filter(Collection<T> src, Predicate<T> pred, List<T> result) {
|
||||
for (T t : src) {
|
||||
if (pred.test(t)) {
|
||||
result.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -290,10 +297,10 @@ public class Util {
|
|||
* 'srcSet', but reflection works really slowly in some implementations, so
|
||||
* it's best to avoid it.
|
||||
*/
|
||||
public static <T, U> Set<U> mapToSet(Collection<T> srcSet, Mapper<T, U> mapper_) {
|
||||
public static <T, U> Set<U> mapToSet(Collection<T> srcSet, Mapper<T, U> mapper) {
|
||||
HashSet<U> result = new HashSet<U>();
|
||||
for (Iterator<T> srcIter = srcSet.iterator(); srcIter.hasNext();)
|
||||
result.add(mapper_.map(srcIter.next()));
|
||||
result.add(mapper.map(srcIter.next()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -301,42 +308,46 @@ public class Util {
|
|||
* Grow an int[] -- i.e. allocate a new array of the given size, with the
|
||||
* initial segment equal to this int[].
|
||||
*/
|
||||
public static int[] realloc(int[] data_, int newSize_) {
|
||||
if (data_.length < newSize_) {
|
||||
int[] newData = new int[newSize_];
|
||||
System.arraycopy(data_, 0, newData, 0, data_.length);
|
||||
public static int[] realloc(int[] data, int newSize) {
|
||||
if (data.length < newSize) {
|
||||
int[] newData = new int[newSize];
|
||||
System.arraycopy(data, 0, newData, 0, data.length);
|
||||
return newData;
|
||||
} else
|
||||
return data_;
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Clear a {@link BitSet}. */
|
||||
public static void clear(BitSet bitSet_) {
|
||||
bitSet_.and(EMPTY_BITSET);
|
||||
public static void clear(BitSet bitSet) {
|
||||
bitSet.and(EMPTY_BITSET);
|
||||
}
|
||||
|
||||
/** Replace all occurrences of a given substring in a given {@link String}. */
|
||||
public static String replaceAll(String str_, String sub_, String newSub_) {
|
||||
if (str_.indexOf(sub_) == -1)
|
||||
return str_;
|
||||
int subLen = sub_.length();
|
||||
public static String replaceAll(String str, String sub, String newSub) {
|
||||
if (str.indexOf(sub) == -1)
|
||||
return str;
|
||||
int subLen = sub.length();
|
||||
int idx;
|
||||
StringBuffer result = new StringBuffer(str_);
|
||||
while ((idx = result.toString().indexOf(sub_)) >= 0)
|
||||
result.replace(idx, idx + subLen, newSub_);
|
||||
StringBuffer result = new StringBuffer(str);
|
||||
while ((idx = result.toString().indexOf(sub)) >= 0)
|
||||
result.replace(idx, idx + subLen, newSub);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/** Remove all occurrences of a given substring in a given {@link String} */
|
||||
public static String removeAll(String str_, String sub_) {
|
||||
return replaceAll(str_, sub_, "");
|
||||
public static String removeAll(String str, String sub) {
|
||||
return replaceAll(str, sub, "");
|
||||
}
|
||||
|
||||
/** Generate strings with fully qualified names or not */
|
||||
public static final boolean FULLY_QUALIFIED_NAMES = false;
|
||||
|
||||
/** Write object fields to string
|
||||
* @throws IllegalArgumentException if obj == null*/
|
||||
/**
|
||||
* Write object fields to string
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if obj == null
|
||||
*/
|
||||
public static String objectFieldsToString(Object obj) throws IllegalArgumentException {
|
||||
if (obj == null) {
|
||||
throw new IllegalArgumentException("obj == null");
|
||||
|
@ -402,8 +413,13 @@ public class Util {
|
|||
|
||||
/**
|
||||
* @return a hash code for the array
|
||||
* @throws IllegalArgumentException
|
||||
* if objs == null
|
||||
*/
|
||||
public static int hashArray(Object[] objs) {
|
||||
public static int hashArray(Object[] objs) throws IllegalArgumentException {
|
||||
if (objs == null) {
|
||||
throw new IllegalArgumentException("objs == null");
|
||||
}
|
||||
// stolen from java.util.AbstractList
|
||||
int ret = 1;
|
||||
for (int i = 0; i < objs.length; i++) {
|
||||
|
@ -469,8 +485,11 @@ public class Util {
|
|||
vals.add(val);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> List<T> pickNAtRandom(List<T> vals, int n, long seed) {
|
||||
|
||||
public static <T> List<T> pickNAtRandom(List<T> vals, int n, long seed) throws IllegalArgumentException {
|
||||
if (vals == null) {
|
||||
throw new IllegalArgumentException("vals == null");
|
||||
}
|
||||
if (vals.size() <= n) {
|
||||
return vals;
|
||||
}
|
||||
|
@ -479,11 +498,11 @@ public class Util {
|
|||
for (int i = 0; i < n; i++) {
|
||||
boolean added = true;
|
||||
do {
|
||||
int randIndex = rand.nextInt(n);
|
||||
added = elems.add(vals.get(randIndex));
|
||||
int randIndex = rand.nextInt(n);
|
||||
added = elems.add(vals.get(randIndex));
|
||||
} while (!added);
|
||||
|
||||
|
||||
}
|
||||
return new ArrayList<T>(elems);
|
||||
return new ArrayList<T>(elems);
|
||||
}
|
||||
} // class Util
|
||||
|
|
|
@ -72,13 +72,14 @@ public class CallGraphMapUtil {
|
|||
* the method, i.e., the only context for the method should be
|
||||
* Everywhere.EVERYWHERE.
|
||||
*
|
||||
* @param orig
|
||||
* @param fromCG
|
||||
* @param toCG
|
||||
* @return the corresponding node, or <code>null</code> if the method is not
|
||||
* in the target call graph
|
||||
* @throws IllegalArgumentException if fromCG == null
|
||||
*/
|
||||
public static CGNode mapCGNode(CGNode orig, CallGraph fromCG, CallGraph toCG) {
|
||||
public static CGNode mapCGNode(CGNode orig, CallGraph fromCG, CallGraph toCG) throws IllegalArgumentException {
|
||||
if (fromCG == null) {
|
||||
throw new IllegalArgumentException("fromCG == null");
|
||||
}
|
||||
if (orig == fromCG.getFakeRootNode()) {
|
||||
return toCG.getFakeRootNode();
|
||||
} else {
|
||||
|
|
|
@ -64,7 +64,10 @@ public class PointerParamValueNumIterator implements Iterator<Integer> {
|
|||
|
||||
int nextParameter;
|
||||
|
||||
public PointerParamValueNumIterator(CGNode node) {
|
||||
public PointerParamValueNumIterator(CGNode node) throws IllegalArgumentException {
|
||||
if (node == null) {
|
||||
throw new IllegalArgumentException("node == null");
|
||||
}
|
||||
IR ir = node.getIR();
|
||||
ti = new TypeInference(ir);
|
||||
symbolTable = ir.getSymbolTable();
|
||||
|
|
|
@ -213,9 +213,12 @@ public class JdtUtil {
|
|||
* TODO: this is too slow. find a better way.
|
||||
*
|
||||
* @return null if not found
|
||||
* @throws IllegalArgumentException if projects == null
|
||||
*/
|
||||
public static IType findJavaClassInProjects(String className, Collection<IJavaProject> projects) {
|
||||
|
||||
public static IType findJavaClassInProjects(String className, Collection<IJavaProject> projects) throws IllegalArgumentException {
|
||||
if (projects == null) {
|
||||
throw new IllegalArgumentException("projects == null");
|
||||
}
|
||||
IJavaElement[] arr = new IJavaElement[projects.size()];
|
||||
projects.toArray(arr);
|
||||
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(arr, false);
|
||||
|
@ -224,7 +227,6 @@ public class JdtUtil {
|
|||
}
|
||||
|
||||
public static IType findJavaClassInResources(String className, Collection<IResource> resources) {
|
||||
|
||||
Collection<IJavaProject> projects = HashSetFactory.make();
|
||||
for (IResource r : resources) {
|
||||
projects.add(JavaCore.create(r).getJavaProject());
|
||||
|
@ -324,7 +326,10 @@ public class JdtUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static Collection<String> getTypeParameterNames(IType type) throws JavaModelException {
|
||||
public static Collection<String> getTypeParameterNames(IType type) throws IllegalArgumentException, JavaModelException {
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException("type == null");
|
||||
}
|
||||
ITypeParameter[] tp = type.getTypeParameters();
|
||||
Collection<String> typeParameterNames = HashSetFactory.make(tp.length);
|
||||
for (ITypeParameter p : tp) {
|
||||
|
|
|
@ -289,10 +289,15 @@ public class Util {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Entryponts for a set of J2SE Main classes
|
||||
* @return Entrypoints for a set of J2SE Main classes
|
||||
* @throws IllegalArgumentException
|
||||
* if classNames == null
|
||||
*/
|
||||
public static Iterable<Entrypoint> makeMainEntrypoints(final ClassLoaderReference loaderRef, final IClassHierarchy cha,
|
||||
final String[] classNames) {
|
||||
final String[] classNames) throws IllegalArgumentException {
|
||||
if (classNames == null) {
|
||||
throw new IllegalArgumentException("classNames == null");
|
||||
}
|
||||
for (int i = 0; i < classNames.length; i++) {
|
||||
if (classNames[i].indexOf("L") != 0) {
|
||||
Assertions.productionAssertion(false, "Expected class name to start with L " + classNames[i]);
|
||||
|
@ -554,7 +559,8 @@ public class Util {
|
|||
* @param scope
|
||||
* representation of the analysis scope
|
||||
*/
|
||||
public static CallGraphBuilder makeRTABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope) {
|
||||
public static CallGraphBuilder makeRTABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope) {
|
||||
|
||||
addDefaultSelectors(options, cha);
|
||||
addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
|
||||
|
@ -590,8 +596,8 @@ public class Util {
|
|||
* @throws IllegalArgumentException
|
||||
* if options is null
|
||||
*/
|
||||
public static CFABuilder makeZeroCFABuilder(AnalysisOptions options,AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope,
|
||||
ContextSelector customSelector, SSAContextInterpreter customInterpreter) {
|
||||
public static CFABuilder makeZeroCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope, ContextSelector customSelector, SSAContextInterpreter customInterpreter) {
|
||||
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException("options is null");
|
||||
|
@ -599,7 +605,8 @@ public class Util {
|
|||
addDefaultSelectors(options, cha);
|
||||
addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
|
||||
|
||||
return new ZeroXCFABuilder(cha, options, cache, customSelector, customInterpreter, options.getReflectionSpec(), ZeroXInstanceKeys.NONE);
|
||||
return new ZeroXCFABuilder(cha, options, cache, customSelector, customInterpreter, options.getReflectionSpec(),
|
||||
ZeroXInstanceKeys.NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -615,7 +622,8 @@ public class Util {
|
|||
* @throws IllegalArgumentException
|
||||
* if options is null
|
||||
*/
|
||||
public static CallGraphBuilder makeOneCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope) {
|
||||
public static CallGraphBuilder makeOneCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
ClassLoader cl, AnalysisScope scope) {
|
||||
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException("options is null");
|
||||
|
@ -625,7 +633,7 @@ public class Util {
|
|||
ContextSelector appSelector = null;
|
||||
SSAContextInterpreter appInterpreter = null;
|
||||
|
||||
CallGraphBuilder builder = new OneCFABuilder(cha, options,cache, appSelector, appInterpreter, options.getReflectionSpec());
|
||||
CallGraphBuilder builder = new OneCFABuilder(cha, options, cache, appSelector, appInterpreter, options.getReflectionSpec());
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
@ -642,7 +650,8 @@ public class Util {
|
|||
* @param scope
|
||||
* representation of the analysis scope
|
||||
*/
|
||||
public static CFABuilder makeZeroOneCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope) {
|
||||
public static CFABuilder makeZeroOneCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope) {
|
||||
return makeZeroOneCFABuilder(options, cache, cha, scope, null, null);
|
||||
}
|
||||
|
||||
|
@ -661,8 +670,8 @@ public class Util {
|
|||
* @throws IllegalArgumentException
|
||||
* if options is null
|
||||
*/
|
||||
public static CFABuilder makeVanillaZeroOneCFABuilder(AnalysisOptions options, AnalysisCache cache,IClassHierarchy cha, AnalysisScope scope,
|
||||
ContextSelector customSelector, SSAContextInterpreter customInterpreter) {
|
||||
public static CFABuilder makeVanillaZeroOneCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope, ContextSelector customSelector, SSAContextInterpreter customInterpreter) {
|
||||
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException("options is null");
|
||||
|
@ -670,7 +679,7 @@ public class Util {
|
|||
addDefaultSelectors(options, cha);
|
||||
addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
|
||||
|
||||
return new ZeroXCFABuilder(cha, options,cache, customSelector, customInterpreter, options.getReflectionSpec(),
|
||||
return new ZeroXCFABuilder(cha, options, cache, customSelector, customInterpreter, options.getReflectionSpec(),
|
||||
ZeroXInstanceKeys.ALLOCATIONS);
|
||||
}
|
||||
|
||||
|
@ -687,7 +696,8 @@ public class Util {
|
|||
* @param scope
|
||||
* representation of the analysis scope
|
||||
*/
|
||||
public static CFABuilder makeVanillaZeroOneCFABuilder(AnalysisOptions options,AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope) {
|
||||
public static CFABuilder makeVanillaZeroOneCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope) {
|
||||
return makeVanillaZeroOneCFABuilder(options, cache, cha, scope, null, null);
|
||||
}
|
||||
|
||||
|
@ -706,8 +716,8 @@ public class Util {
|
|||
* @throws IllegalArgumentException
|
||||
* if options is null
|
||||
*/
|
||||
public static CFABuilder makeZeroOneCFABuilder(AnalysisOptions options, AnalysisCache cache,IClassHierarchy cha, AnalysisScope scope,
|
||||
ContextSelector customSelector, SSAContextInterpreter customInterpreter) {
|
||||
public static CFABuilder makeZeroOneCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope, ContextSelector customSelector, SSAContextInterpreter customInterpreter) {
|
||||
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException("options is null");
|
||||
|
@ -732,7 +742,8 @@ public class Util {
|
|||
* @throws IllegalArgumentException
|
||||
* if options is null
|
||||
*/
|
||||
public static CFABuilder makeZeroContainerCFABuilder(AnalysisOptions options,AnalysisCache cache,IClassHierarchy cha, AnalysisScope scope) {
|
||||
public static CFABuilder makeZeroContainerCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope) {
|
||||
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException("options is null");
|
||||
|
@ -757,7 +768,8 @@ public class Util {
|
|||
* @throws IllegalArgumentException
|
||||
* if options is null
|
||||
*/
|
||||
public static CFABuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, AnalysisCache cache,IClassHierarchy cha, AnalysisScope scope ) {
|
||||
public static CFABuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope) {
|
||||
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException("options is null");
|
||||
|
@ -767,7 +779,7 @@ public class Util {
|
|||
ContextSelector appSelector = null;
|
||||
SSAContextInterpreter appInterpreter = null;
|
||||
|
||||
return new ZeroOneContainerCFABuilder(cha, options,cache, appSelector, appInterpreter, options.getReflectionSpec());
|
||||
return new ZeroOneContainerCFABuilder(cha, options, cache, appSelector, appInterpreter, options.getReflectionSpec());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -782,7 +794,8 @@ public class Util {
|
|||
* @throws IllegalArgumentException
|
||||
* if options is null
|
||||
*/
|
||||
public static CFABuilder makeVanillaZeroOneContainerCFABuilder(AnalysisOptions options,AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope) {
|
||||
public static CFABuilder makeVanillaZeroOneContainerCFABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
|
||||
AnalysisScope scope) {
|
||||
|
||||
if (options == null) {
|
||||
throw new IllegalArgumentException("options is null");
|
||||
|
@ -794,8 +807,7 @@ public class Util {
|
|||
|
||||
return new ZeroOneContainerCFABuilder(cha, options, cache, appSelector, appInterpreter, options.getReflectionSpec()) {
|
||||
@Override
|
||||
protected ZeroXInstanceKeys makeInstanceKeys(IClassHierarchy c, AnalysisOptions o,
|
||||
SSAContextInterpreter contextInterpreter) {
|
||||
protected ZeroXInstanceKeys makeInstanceKeys(IClassHierarchy c, AnalysisOptions o, SSAContextInterpreter contextInterpreter) {
|
||||
ZeroXInstanceKeys zik = new ZeroXInstanceKeys(o, c, contextInterpreter, ZeroXInstanceKeys.ALLOCATIONS);
|
||||
return zik;
|
||||
}
|
||||
|
|
|
@ -660,7 +660,10 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean representsNullType(InstanceKey key) {
|
||||
public static boolean representsNullType(InstanceKey key) throws IllegalArgumentException {
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("key == null");
|
||||
}
|
||||
IClass cls = key.getConcreteType();
|
||||
Language L = cls.getClassLoader().getLanguage();
|
||||
return L.isNullType(cls.getReference());
|
||||
|
|
|
@ -190,8 +190,12 @@ public class InterproceduralCFG implements NumberedGraph<BasicBlockInContext> {
|
|||
/**
|
||||
* @param n
|
||||
* @return the cfg for n, or null if none found
|
||||
* @throws IllegalArgumentException if n == null
|
||||
*/
|
||||
public ControlFlowGraph getCFG(CGNode n) {
|
||||
public ControlFlowGraph getCFG(CGNode n) throws IllegalArgumentException {
|
||||
if (n == null) {
|
||||
throw new IllegalArgumentException("n == null");
|
||||
}
|
||||
ControlFlowGraph cfg = n.getCFG();
|
||||
if (cfg == null) {
|
||||
return null;
|
||||
|
|
|
@ -1152,7 +1152,10 @@ public class ClassHierarchy implements IClassHierarchy {
|
|||
return root.getJavaClass();
|
||||
}
|
||||
|
||||
public boolean isRootClass(IClass c) {
|
||||
public boolean isRootClass(IClass c) throws IllegalArgumentException {
|
||||
if (c == null) {
|
||||
throw new IllegalArgumentException("c == null");
|
||||
}
|
||||
return c.equals(root.getJavaClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,10 @@ public class CISlicer {
|
|||
}
|
||||
|
||||
public CISlicer(CallGraph cg, PointerAnalysis pa, ModRef modRef,
|
||||
DataDependenceOptions dOptions, ControlDependenceOptions cOptions) {
|
||||
DataDependenceOptions dOptions, ControlDependenceOptions cOptions) throws IllegalArgumentException {
|
||||
if (dOptions == null) {
|
||||
throw new IllegalArgumentException("dOptions == null");
|
||||
}
|
||||
if (dOptions.equals(DataDependenceOptions.NO_BASE_PTRS) ||
|
||||
dOptions.equals(DataDependenceOptions.FULL)) {
|
||||
throw new IllegalArgumentException("Heap data dependences requested in CISlicer!");
|
||||
|
|
|
@ -65,7 +65,10 @@ public class BinaryFormula extends AbstractBinaryFormula {
|
|||
return new BinaryFormula(connective, f1, f2);
|
||||
}
|
||||
|
||||
public static IFormula or(IFormula f1, IFormula f2) {
|
||||
public static IFormula or(IFormula f1, IFormula f2) throws IllegalArgumentException {
|
||||
if (f1 == null) {
|
||||
throw new IllegalArgumentException("f1 == null");
|
||||
}
|
||||
if (f1.equals(BooleanConstantFormula.FALSE)) {
|
||||
return f2;
|
||||
} else if (f2.equals(BooleanConstantFormula.FALSE)) {
|
||||
|
|
|
@ -47,7 +47,10 @@ public class BooleanConstantFormula implements IMaxTerm {
|
|||
return prettyPrint(DefaultDecorator.instance());
|
||||
}
|
||||
|
||||
public String prettyPrint(ILogicDecorator d) {
|
||||
public String prettyPrint(ILogicDecorator d) throws IllegalArgumentException {
|
||||
if (d == null) {
|
||||
throw new IllegalArgumentException("d == null");
|
||||
}
|
||||
return d.prettyPrint(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,10 @@ public class CNFFormula extends AbstractBinaryFormula implements ICNFFormula {
|
|||
return result;
|
||||
}
|
||||
|
||||
public String prettyPrint(ILogicDecorator d) {
|
||||
public String prettyPrint(ILogicDecorator d) throws IllegalArgumentException {
|
||||
if (d == null) {
|
||||
throw new IllegalArgumentException("d == null");
|
||||
}
|
||||
return d.prettyPrint(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,17 @@ public class DefaultDecorator implements ILogicDecorator {
|
|||
return c.toString();
|
||||
}
|
||||
|
||||
public String prettyPrint(AbstractVariable v) {
|
||||
public String prettyPrint(AbstractVariable v) throws IllegalArgumentException {
|
||||
if (v == null) {
|
||||
throw new IllegalArgumentException("v == null");
|
||||
}
|
||||
return v.toString();
|
||||
}
|
||||
|
||||
public String prettyPrint(Quantifier q) {
|
||||
public String prettyPrint(Quantifier q) throws IllegalArgumentException {
|
||||
if (q == null) {
|
||||
throw new IllegalArgumentException("q == null");
|
||||
}
|
||||
return q.toString();
|
||||
}
|
||||
|
||||
|
@ -53,7 +59,10 @@ public class DefaultDecorator implements ILogicDecorator {
|
|||
return constant.toString();
|
||||
}
|
||||
|
||||
public String prettyPrint(FunctionTerm term) {
|
||||
public String prettyPrint(FunctionTerm term) throws IllegalArgumentException {
|
||||
if (term == null) {
|
||||
throw new IllegalArgumentException("term == null");
|
||||
}
|
||||
StringBuffer result = new StringBuffer(term.getFunction().getSymbol());
|
||||
result.append("(");
|
||||
for (int i = 0; i < term.getFunction().getNumberOfParameters() - 1; i++) {
|
||||
|
@ -67,7 +76,10 @@ public class DefaultDecorator implements ILogicDecorator {
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
public String prettyPrint(RelationFormula r) {
|
||||
public String prettyPrint(RelationFormula r) throws IllegalArgumentException {
|
||||
if (r == null) {
|
||||
throw new IllegalArgumentException("r == null");
|
||||
}
|
||||
if (r.getRelation().getValence() == 2) {
|
||||
return infixNotation(r);
|
||||
} else {
|
||||
|
@ -100,7 +112,10 @@ public class DefaultDecorator implements ILogicDecorator {
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
public String prettyPrint(IRelation r) {
|
||||
public String prettyPrint(IRelation r) throws IllegalArgumentException {
|
||||
if (r == null) {
|
||||
throw new IllegalArgumentException("r == null");
|
||||
}
|
||||
return r.getSymbol();
|
||||
}
|
||||
|
||||
|
@ -116,7 +131,10 @@ public class DefaultDecorator implements ILogicDecorator {
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
public String prettyPrint(NotFormula n) {
|
||||
public String prettyPrint(NotFormula n) throws IllegalArgumentException {
|
||||
if (n == null) {
|
||||
throw new IllegalArgumentException("n == null");
|
||||
}
|
||||
StringBuffer result = new StringBuffer();
|
||||
result.append("not ( ");
|
||||
result.append(n.getFormula().prettyPrint(this));
|
||||
|
|
|
@ -29,7 +29,10 @@ public class NotFormula implements IFormula {
|
|||
}
|
||||
}
|
||||
|
||||
public static IFormula make(IFormula f) {
|
||||
public static IFormula make(IFormula f) throws IllegalArgumentException {
|
||||
if (f == null) {
|
||||
throw new IllegalArgumentException("f == null");
|
||||
}
|
||||
switch (f.getKind()) {
|
||||
case RELATION:
|
||||
RelationFormula r = (RelationFormula) f;
|
||||
|
@ -92,7 +95,10 @@ public class NotFormula implements IFormula {
|
|||
return prettyPrint(DefaultDecorator.instance());
|
||||
}
|
||||
|
||||
public String prettyPrint(ILogicDecorator d) {
|
||||
public String prettyPrint(ILogicDecorator d) throws IllegalArgumentException {
|
||||
if (d == null) {
|
||||
throw new IllegalArgumentException("d == null");
|
||||
}
|
||||
return d.prettyPrint(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,10 @@ public class RelationFormula implements IMaxTerm {
|
|||
return prettyPrint(DefaultDecorator.instance());
|
||||
}
|
||||
|
||||
public String prettyPrint(ILogicDecorator d) {
|
||||
public String prettyPrint(ILogicDecorator d) throws IllegalArgumentException {
|
||||
if (d == null) {
|
||||
throw new IllegalArgumentException("d == null");
|
||||
}
|
||||
return d.prettyPrint(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -211,8 +211,12 @@ public class Simplifier {
|
|||
* @param facts
|
||||
* formulae that can be treated as axioms
|
||||
* @return true if we can easily prove f is a contradiction
|
||||
* @throws IllegalArgumentException if facts == null
|
||||
*/
|
||||
public static boolean isContradiction(IFormula f, Collection<IMaxTerm> facts) {
|
||||
public static boolean isContradiction(IFormula f, Collection<IMaxTerm> facts) throws IllegalArgumentException {
|
||||
if (facts == null) {
|
||||
throw new IllegalArgumentException("facts == null");
|
||||
}
|
||||
for (IMaxTerm d : facts) {
|
||||
if (contradicts(d, f)) {
|
||||
return true;
|
||||
|
@ -379,7 +383,10 @@ public class Simplifier {
|
|||
// some ad-hoc formula normalization
|
||||
// 1) change >, >= to <, <=
|
||||
// TODO: do normalization in a principled manner
|
||||
public static IFormula normalize(IFormula f) {
|
||||
public static IFormula normalize(IFormula f) throws IllegalArgumentException {
|
||||
if (f == null) {
|
||||
throw new IllegalArgumentException("f == null");
|
||||
}
|
||||
switch (f.getKind()) {
|
||||
case RELATION:
|
||||
RelationFormula r = (RelationFormula) f;
|
||||
|
@ -397,8 +404,12 @@ public class Simplifier {
|
|||
* @param facts
|
||||
* formulae that can be treated as axioms
|
||||
* @return true if we can easily prove f is a tautology
|
||||
* @throws IllegalArgumentException if facts == null
|
||||
*/
|
||||
public static boolean isTautology(IFormula f, Collection<IMaxTerm> facts) {
|
||||
public static boolean isTautology(IFormula f, Collection<IMaxTerm> facts) throws IllegalArgumentException {
|
||||
if (facts == null) {
|
||||
throw new IllegalArgumentException("facts == null");
|
||||
}
|
||||
for (IMaxTerm d : facts) {
|
||||
if (implies(d, f)) {
|
||||
return true;
|
||||
|
@ -717,8 +728,12 @@ public class Simplifier {
|
|||
* Attempt to distribute the NOT from a NotFormula
|
||||
*
|
||||
* @return the original formula if the distribution is unsuccessful
|
||||
* @throws IllegalArgumentException if f == null
|
||||
*/
|
||||
public static IFormula distributeNot(NotFormula f) {
|
||||
public static IFormula distributeNot(NotFormula f) throws IllegalArgumentException {
|
||||
if (f == null) {
|
||||
throw new IllegalArgumentException("f == null");
|
||||
}
|
||||
IFormula f1 = f.getFormula();
|
||||
if (f1 instanceof RelationFormula) {
|
||||
RelationFormula r = (RelationFormula) f1;
|
||||
|
|
|
@ -793,7 +793,10 @@ public class SSACFG implements ControlFlowGraph {
|
|||
/*
|
||||
* @see com.ibm.wala.util.graph.Graph#getPredNodeCount(com.ibm.wala.util.graph.Node)
|
||||
*/
|
||||
public int getPredNodeCount(IBasicBlock b) {
|
||||
public int getPredNodeCount(IBasicBlock b) throws IllegalArgumentException {
|
||||
if (b == null) {
|
||||
throw new IllegalArgumentException("b == null");
|
||||
}
|
||||
IBasicBlock n = cfg.getNode(b.getNumber());
|
||||
return cfg.getPredNodeCount(n);
|
||||
}
|
||||
|
@ -827,7 +830,10 @@ public class SSACFG implements ControlFlowGraph {
|
|||
/*
|
||||
* @see com.ibm.wala.util.graph.Graph#getSuccNodeCount(com.ibm.wala.util.graph.Node)
|
||||
*/
|
||||
public int getSuccNodeCount(IBasicBlock b) {
|
||||
public int getSuccNodeCount(IBasicBlock b) throws IllegalArgumentException {
|
||||
if (b == null) {
|
||||
throw new IllegalArgumentException("b == null");
|
||||
}
|
||||
IBasicBlock n = cfg.getNode(b.getNumber());
|
||||
return cfg.getSuccNodeCount(n);
|
||||
}
|
||||
|
|
|
@ -343,7 +343,10 @@ public class ExplodedControlFlowGraph implements ControlFlowGraph {
|
|||
}
|
||||
}
|
||||
|
||||
public int getNumber(IBasicBlock n) {
|
||||
public int getNumber(IBasicBlock n) throws IllegalArgumentException {
|
||||
if (n == null) {
|
||||
throw new IllegalArgumentException("n == null");
|
||||
}
|
||||
return n.getNumber();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class IntMapIterator<T> implements Iterator<T> {
|
|||
return i.hasNext();
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
public void remove() throws UnsupportedOperationException {
|
||||
throw new java.lang.UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -288,9 +288,6 @@ public class StringStuff {
|
|||
* Given that name[start:start+length] is a Type name in JVM format, parse it
|
||||
* for the package
|
||||
*
|
||||
* @param name
|
||||
* @param start
|
||||
* @param length
|
||||
* @return an ImmutableByteArray that represents the package, or null if it's
|
||||
* the unnamed package
|
||||
*/
|
||||
|
|
|
@ -71,9 +71,13 @@ public class FifoQueueNoDuplicates<T> extends FifoQueue<T> {
|
|||
* @param elements
|
||||
* an Iterator of Objects to be added to the queue if never already
|
||||
* queued.
|
||||
* @throws IllegalArgumentException if elements == null
|
||||
*/
|
||||
@Override
|
||||
public void push(Iterator<? extends T> elements) {
|
||||
public void push(Iterator<? extends T> elements) throws IllegalArgumentException {
|
||||
if (elements == null) {
|
||||
throw new IllegalArgumentException("elements == null");
|
||||
}
|
||||
while (elements.hasNext()) {
|
||||
T element = elements.next();
|
||||
if (wasInQueue.add(element)) {
|
||||
|
|
|
@ -21,8 +21,6 @@ import java.util.Iterator;
|
|||
public class IteratorUtil {
|
||||
|
||||
/**
|
||||
* @param it
|
||||
* @param o
|
||||
* @return true iff the Iterator returns some elements which equals() the
|
||||
* object o
|
||||
*/
|
||||
|
@ -35,7 +33,10 @@ public class IteratorUtil {
|
|||
return false;
|
||||
}
|
||||
|
||||
public final static <T> int count(Iterator<T> it) {
|
||||
public final static <T> int count(Iterator<T> it) throws IllegalArgumentException {
|
||||
if (it == null) {
|
||||
throw new IllegalArgumentException("it == null");
|
||||
}
|
||||
int count = 0;
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
|
|
|
@ -31,10 +31,9 @@ public class Assertions {
|
|||
}
|
||||
|
||||
/**
|
||||
* Method _assert.
|
||||
* @param b
|
||||
* @throws UnimplementedError if b == false
|
||||
*/
|
||||
public static void _assert(boolean b) {
|
||||
public static void _assert(boolean b) throws UnimplementedError {
|
||||
checkGuard();
|
||||
if (!b)
|
||||
throw new UnimplementedError();
|
||||
|
@ -67,8 +66,9 @@ public class Assertions {
|
|||
* An assertion which does not need to be guarded by verifyAssertions.
|
||||
* These assertions will be enabled in production!
|
||||
* @param b
|
||||
* @throws UnimplementedError if b == false
|
||||
*/
|
||||
public static void productionAssertion(boolean b) {
|
||||
public static void productionAssertion(boolean b) throws UnimplementedError {
|
||||
if (!b)
|
||||
throw new UnimplementedError();
|
||||
}
|
||||
|
@ -97,9 +97,9 @@ public class Assertions {
|
|||
/**
|
||||
* This is only a convenience method, identical to _assert.
|
||||
* Allows the programmer to distinguish preconditions from other assertions.
|
||||
* @param b
|
||||
* @throws UnimplementedError if b == false
|
||||
*/
|
||||
public static void precondition(boolean b) {
|
||||
public static void precondition(boolean b) throws UnimplementedError {
|
||||
checkGuard();
|
||||
if (!b)
|
||||
throw new UnimplementedError();
|
||||
|
@ -108,10 +108,9 @@ public class Assertions {
|
|||
/**
|
||||
* This is only a convenience method, identical to _assert.
|
||||
* It allows the programmer to distinguish preconditions from other assertions.
|
||||
* @param b
|
||||
* @param string
|
||||
* @throws UnimplementedError if b == false
|
||||
*/
|
||||
public static void precondition(boolean b, String string) {
|
||||
public static void precondition(boolean b, String string) throws UnimplementedError {
|
||||
checkGuard();
|
||||
if (!b)
|
||||
throw new UnimplementedError(string);
|
||||
|
@ -120,9 +119,9 @@ public class Assertions {
|
|||
/**
|
||||
* This is only a convenience method, identical to _assert.
|
||||
* Allows the programmer to distinguish postconditions from other assertions.
|
||||
* @param b
|
||||
* @throws UnimplementedError if b == false
|
||||
*/
|
||||
public static void postcondition(boolean b) {
|
||||
public static void postcondition(boolean b) throws UnimplementedError {
|
||||
checkGuard();
|
||||
if (!b)
|
||||
throw new UnimplementedError();
|
||||
|
@ -131,10 +130,9 @@ public class Assertions {
|
|||
/**
|
||||
* This is only a convenience method, identical to _assert.
|
||||
* It allows the programmer to distinguish postconditions from other assertions.
|
||||
* @param b
|
||||
* @param string
|
||||
* @throws UnimplementedError if b == false
|
||||
*/
|
||||
public static void postcondition(boolean b, String string) {
|
||||
public static void postcondition(boolean b, String string) throws UnimplementedError {
|
||||
checkGuard();
|
||||
if (!b)
|
||||
throw new UnimplementedError(string);
|
||||
|
|
|
@ -424,7 +424,10 @@ public class SparseLongSet implements LongSet {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean containsAny(SparseLongSet set) {
|
||||
public boolean containsAny(SparseLongSet set) throws IllegalArgumentException {
|
||||
if (set == null) {
|
||||
throw new IllegalArgumentException("set == null");
|
||||
}
|
||||
int i = 0;
|
||||
for (int j = 0; j < set.size; j++) {
|
||||
long x = set.elements[j];
|
||||
|
|
|
@ -27,9 +27,12 @@ public class CommandLine {
|
|||
* line args. if args[i] is "-foo" and args[i+1] is "bar", then the result
|
||||
* will define a property with key "foo" and value "bar"
|
||||
*
|
||||
* @throws WalaException
|
||||
* @throws IllegalArgumentException if args == null
|
||||
*/
|
||||
public static Properties parse(String[] args) throws WalaException {
|
||||
public static Properties parse(String[] args) throws IllegalArgumentException, WalaException {
|
||||
if (args == null) {
|
||||
throw new IllegalArgumentException("args == null");
|
||||
}
|
||||
Properties result = new Properties();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
String key = parseForKey(args[i]);
|
||||
|
|
|
@ -36,8 +36,12 @@ public class Table<T> implements Cloneable {
|
|||
|
||||
/**
|
||||
* create an empty table with the same column headings as t
|
||||
* @throws IllegalArgumentException if t == null
|
||||
*/
|
||||
public Table(Table<T> t) {
|
||||
public Table(Table<T> t) throws IllegalArgumentException {
|
||||
if (t == null) {
|
||||
throw new IllegalArgumentException("t == null");
|
||||
}
|
||||
for (int i = 0; i < t.getNumberOfColumns(); i++) {
|
||||
columnHeadings.set(i, t.getColumnHeading(i));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue