more IllegalArgumentExceptions and declared exceptions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1665 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
a11e72931b
commit
19a0c8a5ad
|
@ -634,7 +634,7 @@ public abstract class AbstractCFG implements ControlFlowGraph, Constants {
|
||||||
return Iterator2Collection.toCollection(iterateNormalPredecessors(b));
|
return Iterator2Collection.toCollection(iterateNormalPredecessors(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntSet getPredNodeNumbers(IBasicBlock node) {
|
public IntSet getPredNodeNumbers(IBasicBlock node) throws UnimplementedError {
|
||||||
Assertions.UNREACHABLE();
|
Assertions.UNREACHABLE();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -543,11 +543,11 @@ public class TwoExitCFG implements ControlFlowGraph {
|
||||||
return new NumberedNodeIterator<IBasicBlock>(s, this);
|
return new NumberedNodeIterator<IBasicBlock>(s, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeIncomingEdges(IBasicBlock node) {
|
public void removeIncomingEdges(IBasicBlock node) throws UnsupportedOperationException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeOutgoingEdges(IBasicBlock node) {
|
public void removeOutgoingEdges(IBasicBlock node) throws UnsupportedOperationException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class SyntheticMethod implements IMethod {
|
||||||
return new InducedCFG(getStatements(), this, Everywhere.EVERYWHERE);
|
return new InducedCFG(getStatements(), this, Everywhere.EVERYWHERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BytecodeStream getBytecodeStream() {
|
public BytecodeStream getBytecodeStream() throws UnsupportedOperationException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class ExplodedSupergraph<T> implements Graph<ExplodedSupergraphNode<T>> {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEdge(ExplodedSupergraphNode src, ExplodedSupergraphNode dst) {
|
public void addEdge(ExplodedSupergraphNode src, ExplodedSupergraphNode dst) throws UnsupportedOperationException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,8 +264,8 @@ public class PartiallyCollapsedSupergraph extends AbstractGraph<Object> implemen
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"(n instanceof com.ibm.wala.cfg.IBasicBlock) and (not ( n instanceof com.ibm.wala.ipa.cfg.BasicBlockInContext ) )");
|
"(n instanceof com.ibm.wala.cfg.IBasicBlock) and (not ( n instanceof com.ibm.wala.ipa.cfg.BasicBlockInContext ) )");
|
||||||
}
|
}
|
||||||
if (n instanceof IBasicBlock) {
|
if (n instanceof BasicBlockInContext) {
|
||||||
return partialIPFG.getCGNode((IBasicBlock) n);
|
return partialIPFG.getCGNode((BasicBlockInContext) n);
|
||||||
} else {
|
} else {
|
||||||
return nodeManager.getProcOfCollapsedNode(n);
|
return nodeManager.getProcOfCollapsedNode(n);
|
||||||
}
|
}
|
||||||
|
@ -294,9 +294,8 @@ public class PartiallyCollapsedSupergraph extends AbstractGraph<Object> implemen
|
||||||
*/
|
*/
|
||||||
private void computeTransverseEdges() {
|
private void computeTransverseEdges() {
|
||||||
// compute transverse edges that originate from basic blocks
|
// compute transverse edges that originate from basic blocks
|
||||||
for (Iterator it = partialIPFG.iterator(); it.hasNext();) {
|
for (BasicBlockInContext bb: partialIPFG) {
|
||||||
IBasicBlock bb = (IBasicBlock) it.next();
|
if (partialIPFG.hasCall(bb)) {
|
||||||
if (partialIPFG.hasCall((BasicBlockInContext) bb)) {
|
|
||||||
Set targets = partialIPFG.getCallTargets(bb);
|
Set targets = partialIPFG.getCallTargets(bb);
|
||||||
for (Iterator it2 = targets.iterator(); it2.hasNext();) {
|
for (Iterator it2 = targets.iterator(); it2.hasNext();) {
|
||||||
CGNode n = (CGNode) it2.next();
|
CGNode n = (CGNode) it2.next();
|
||||||
|
@ -851,8 +850,8 @@ public class PartiallyCollapsedSupergraph extends AbstractGraph<Object> implemen
|
||||||
* @see com.ibm.wala.dataflow.IFDS.ISupergraph#isReturn(java.lang.Object)
|
* @see com.ibm.wala.dataflow.IFDS.ISupergraph#isReturn(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public boolean isReturn(Object object) {
|
public boolean isReturn(Object object) {
|
||||||
if (object instanceof IBasicBlock) {
|
if (object instanceof BasicBlockInContext) {
|
||||||
return partialIPFG.isReturn(object);
|
return partialIPFG.isReturn((BasicBlockInContext)object);
|
||||||
} else {
|
} else {
|
||||||
if (nodeManager.isCollapsedExit(object)) {
|
if (nodeManager.isCollapsedExit(object)) {
|
||||||
CGNode node = getProcOf(object);
|
CGNode node = getProcOf(object);
|
||||||
|
|
|
@ -56,6 +56,7 @@ import com.ibm.wala.util.collections.FilterIterator;
|
||||||
import com.ibm.wala.util.collections.Iterator2Collection;
|
import com.ibm.wala.util.collections.Iterator2Collection;
|
||||||
import com.ibm.wala.util.debug.Assertions;
|
import com.ibm.wala.util.debug.Assertions;
|
||||||
import com.ibm.wala.util.debug.Trace;
|
import com.ibm.wala.util.debug.Trace;
|
||||||
|
import com.ibm.wala.util.debug.UnimplementedError;
|
||||||
import com.ibm.wala.util.graph.traverse.SlowDFSDiscoverTimeIterator;
|
import com.ibm.wala.util.graph.traverse.SlowDFSDiscoverTimeIterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +75,7 @@ public class SimpleDemandPointsTo extends AbstractDemandPointsTo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Collection<InstanceKey> getPointsTo(PointerKey pk) {
|
public Collection<InstanceKey> getPointsTo(PointerKey pk) throws UnimplementedError {
|
||||||
|
|
||||||
Assertions._assert(pk instanceof LocalPointerKey, "we only handle locals");
|
Assertions._assert(pk instanceof LocalPointerKey, "we only handle locals");
|
||||||
LocalPointerKey lpk = (LocalPointerKey) pk;
|
LocalPointerKey lpk = (LocalPointerKey) pk;
|
||||||
|
|
|
@ -158,7 +158,7 @@ public abstract class UnaryStatement extends AbstractStatement {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IVariable[] getRHS() {
|
public IVariable[] getRHS() throws UnsupportedOperationException {
|
||||||
// This should never be called ...use the more efficient getRightHandSide instead
|
// This should never be called ...use the more efficient getRightHandSide instead
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,10 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||||
public class OneCFABuilder extends CFABuilder {
|
public class OneCFABuilder extends CFABuilder {
|
||||||
|
|
||||||
public static OneCFABuilder make(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
public static OneCFABuilder make(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||||
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, ReflectionSpecification reflect) {
|
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, ReflectionSpecification reflect) throws IllegalArgumentException {
|
||||||
|
if (options == null) {
|
||||||
|
throw new IllegalArgumentException("options == null");
|
||||||
|
}
|
||||||
return new OneCFABuilder(cha, options, cache, appContextSelector, appContextInterpreter, reflect);
|
return new OneCFABuilder(cha, options, cache, appContextSelector, appContextInterpreter, reflect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,10 @@ public class ZeroXCFABuilder extends CFABuilder {
|
||||||
|
|
||||||
public static ZeroXCFABuilder make(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
public static ZeroXCFABuilder make(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||||
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, ReflectionSpecification reflect,
|
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, ReflectionSpecification reflect,
|
||||||
int instancePolicy) {
|
int instancePolicy) throws IllegalArgumentException {
|
||||||
|
if (options == null) {
|
||||||
|
throw new IllegalArgumentException("options == null");
|
||||||
|
}
|
||||||
return new ZeroXCFABuilder(cha, options, cache, appContextSelector, appContextInterpreter, reflect, instancePolicy);
|
return new ZeroXCFABuilder(cha, options, cache, appContextSelector, appContextInterpreter, reflect, instancePolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -526,32 +526,32 @@ public class InterproceduralCFG implements NumberedGraph<BasicBlockInContext> {
|
||||||
}
|
}
|
||||||
BasicBlockInContext b = new BasicBlockInContext(N, bb);
|
BasicBlockInContext b = new BasicBlockInContext(N, bb);
|
||||||
G.addNode(b);
|
G.addNode(b);
|
||||||
if (hasCall(bb, cfg)) {
|
if (hasCall(b, cfg)) {
|
||||||
hasCallVector.set(getNumber(b));
|
hasCallVector.set(getNumber(b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param B
|
|
||||||
* @return the original CFG from whence B came
|
* @return the original CFG from whence B came
|
||||||
|
* @throws IllegalArgumentException if B == null
|
||||||
*/
|
*/
|
||||||
public ControlFlowGraph getCFG(IBasicBlock B) {
|
public ControlFlowGraph getCFG(BasicBlockInContext B) throws IllegalArgumentException {
|
||||||
if (Assertions.verifyAssertions) {
|
if (B == null) {
|
||||||
Assertions._assert(B instanceof BasicBlockInContext);
|
throw new IllegalArgumentException("B == null");
|
||||||
}
|
}
|
||||||
return getCFG(getCGNode(B));
|
return getCFG(getCGNode(B));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param B
|
|
||||||
* @return the original CGNode from whence B came
|
* @return the original CGNode from whence B came
|
||||||
|
* @throws IllegalArgumentException if B == null
|
||||||
*/
|
*/
|
||||||
public CGNode getCGNode(IBasicBlock B) {
|
public CGNode getCGNode(BasicBlockInContext B) throws IllegalArgumentException {
|
||||||
if (Assertions.verifyAssertions) {
|
if (B == null) {
|
||||||
Assertions._assert(B instanceof BasicBlockInContext);
|
throw new IllegalArgumentException("B == null");
|
||||||
}
|
}
|
||||||
return ((BasicBlockInContext) B).getNode();
|
return B.getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -662,10 +662,9 @@ public class InterproceduralCFG implements NumberedGraph<BasicBlockInContext> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param B
|
|
||||||
* @return true iff basic block B ends in a call instuction
|
* @return true iff basic block B ends in a call instuction
|
||||||
*/
|
*/
|
||||||
private boolean hasCall(IBasicBlock B, ControlFlowGraph cfg) {
|
private boolean hasCall(BasicBlockInContext B, ControlFlowGraph cfg) {
|
||||||
IInstruction[] statements = cfg.getInstructions();
|
IInstruction[] statements = cfg.getInstructions();
|
||||||
|
|
||||||
int lastIndex = B.getLastInstructionIndex();
|
int lastIndex = B.getLastInstructionIndex();
|
||||||
|
@ -692,13 +691,10 @@ public class InterproceduralCFG implements NumberedGraph<BasicBlockInContext> {
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if B is null
|
* if B is null
|
||||||
*/
|
*/
|
||||||
public Set<CGNode> getCallTargets(IBasicBlock B) {
|
public Set<CGNode> getCallTargets(BasicBlockInContext B) {
|
||||||
if (B == null) {
|
if (B == null) {
|
||||||
throw new IllegalArgumentException("B is null");
|
throw new IllegalArgumentException("B is null");
|
||||||
}
|
}
|
||||||
if (Assertions.verifyAssertions) {
|
|
||||||
Assertions._assert(B instanceof BasicBlockInContext);
|
|
||||||
}
|
|
||||||
ControlFlowGraph cfg = getCFG(B);
|
ControlFlowGraph cfg = getCFG(B);
|
||||||
return getCallTargets(B, cfg, getCGNode(B));
|
return getCallTargets(B, cfg, getCGNode(B));
|
||||||
}
|
}
|
||||||
|
@ -814,11 +810,10 @@ public class InterproceduralCFG implements NumberedGraph<BasicBlockInContext> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public boolean isReturn(Object object) {
|
public boolean isReturn(BasicBlockInContext bb) throws IllegalArgumentException {
|
||||||
if (Assertions.verifyAssertions) {
|
if (bb == null) {
|
||||||
Assertions._assert(object instanceof BasicBlockInContext);
|
throw new IllegalArgumentException("bb == null");
|
||||||
}
|
}
|
||||||
BasicBlockInContext bb = (BasicBlockInContext) object;
|
|
||||||
ControlFlowGraph cfg = getCFG(bb);
|
ControlFlowGraph cfg = getCFG(bb);
|
||||||
for (Iterator it = cfg.getPredNodes(bb.getDelegate()); it.hasNext();) {
|
for (Iterator it = cfg.getPredNodes(bb.getDelegate()); it.hasNext();) {
|
||||||
IBasicBlock b = (IBasicBlock) it.next();
|
IBasicBlock b = (IBasicBlock) it.next();
|
||||||
|
|
|
@ -207,6 +207,7 @@ public class HeapReachingDefs {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return delegate.toString();
|
return delegate.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,10 @@ import com.ibm.wala.util.intset.IntPair;
|
||||||
public class SSABuilder extends AbstractIntStackMachine {
|
public class SSABuilder extends AbstractIntStackMachine {
|
||||||
|
|
||||||
public static SSABuilder make(ShrikeCTMethod method, SSACFG cfg, ShrikeCFG scfg, SSAInstruction[] instructions,
|
public static SSABuilder make(ShrikeCTMethod method, SSACFG cfg, ShrikeCFG scfg, SSAInstruction[] instructions,
|
||||||
SymbolTable symbolTable, boolean buildLocalMap, boolean addPiNodes) {
|
SymbolTable symbolTable, boolean buildLocalMap, boolean addPiNodes) throws IllegalArgumentException {
|
||||||
|
if (scfg == null) {
|
||||||
|
throw new IllegalArgumentException("scfg == null");
|
||||||
|
}
|
||||||
return new SSABuilder(method, cfg, scfg, instructions, symbolTable, buildLocalMap, addPiNodes);
|
return new SSABuilder(method, cfg, scfg, instructions, symbolTable, buildLocalMap, addPiNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,8 +81,8 @@ public class SSABuilder extends AbstractIntStackMachine {
|
||||||
*/
|
*/
|
||||||
private final SSA2LocalMap localMap;
|
private final SSA2LocalMap localMap;
|
||||||
|
|
||||||
private SSABuilder(ShrikeCTMethod method, SSACFG cfg, ShrikeCFG scfg, SSAInstruction[] instructions,
|
private SSABuilder(ShrikeCTMethod method, SSACFG cfg, ShrikeCFG scfg, SSAInstruction[] instructions, SymbolTable symbolTable,
|
||||||
SymbolTable symbolTable, boolean buildLocalMap, boolean addPiNodes) {
|
boolean buildLocalMap, boolean addPiNodes) {
|
||||||
super(scfg);
|
super(scfg);
|
||||||
localMap = buildLocalMap ? new SSA2LocalMap(scfg, instructions.length, cfg.getNumberOfNodes(), maxLocals) : null;
|
localMap = buildLocalMap ? new SSA2LocalMap(scfg, instructions.length, cfg.getNumberOfNodes(), maxLocals) : null;
|
||||||
init(new SymbolTableMeeter(symbolTable, cfg, instructions, scfg), new SymbolicPropagator(scfg, instructions, symbolTable,
|
init(new SymbolTableMeeter(symbolTable, cfg, instructions, scfg), new SymbolicPropagator(scfg, instructions, symbolTable,
|
||||||
|
@ -604,10 +607,10 @@ public class SSABuilder extends AbstractIntStackMachine {
|
||||||
NewSiteReference ref = NewSiteReference.make(getCurrentProgramCounter(), t);
|
NewSiteReference ref = NewSiteReference.make(getCurrentProgramCounter(), t);
|
||||||
if (t.isArrayType()) {
|
if (t.isArrayType()) {
|
||||||
int[] sizes = new int[t.getDimensionality()];
|
int[] sizes = new int[t.getDimensionality()];
|
||||||
for (int i = 0; i<instruction.getArrayBoundsCount(); i++) {
|
for (int i = 0; i < instruction.getArrayBoundsCount(); i++) {
|
||||||
sizes[i] = workingState.pop();
|
sizes[i] = workingState.pop();
|
||||||
}
|
}
|
||||||
for (int i = instruction.getArrayBoundsCount(); i< sizes.length; i++) {
|
for (int i = instruction.getArrayBoundsCount(); i < sizes.length; i++) {
|
||||||
sizes[i] = symbolTable.getConstant(0);
|
sizes[i] = symbolTable.getConstant(0);
|
||||||
}
|
}
|
||||||
emitInstruction(new SSANewInstruction(result, ref, sizes));
|
emitInstruction(new SSANewInstruction(result, ref, sizes));
|
||||||
|
@ -815,9 +818,9 @@ public class SSABuilder extends AbstractIntStackMachine {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nInstructions
|
* @param nInstructions
|
||||||
* number of instructions in the bytecode for this method
|
* number of instructions in the bytecode for this method
|
||||||
* @param nBlocks
|
* @param nBlocks
|
||||||
* number of basic blocks in the CFG
|
* number of basic blocks in the CFG
|
||||||
*/
|
*/
|
||||||
SSA2LocalMap(ShrikeCFG shrikeCfg, int nInstructions, int nBlocks, int maxLocals) {
|
SSA2LocalMap(ShrikeCFG shrikeCfg, int nInstructions, int nBlocks, int maxLocals) {
|
||||||
shrikeCFG = shrikeCfg;
|
shrikeCFG = shrikeCfg;
|
||||||
|
@ -862,9 +865,9 @@ public class SSABuilder extends AbstractIntStackMachine {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param index -
|
* @param index -
|
||||||
* index into IR instruction array
|
* index into IR instruction array
|
||||||
* @param vn -
|
* @param vn -
|
||||||
* value number
|
* value number
|
||||||
*/
|
*/
|
||||||
public String[] getLocalNames(int index, int vn) {
|
public String[] getLocalNames(int index, int vn) {
|
||||||
try {
|
try {
|
||||||
|
@ -892,9 +895,9 @@ public class SSABuilder extends AbstractIntStackMachine {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pc
|
* @param pc
|
||||||
* a program counter (index into ShrikeBT instruction array)
|
* a program counter (index into ShrikeBT instruction array)
|
||||||
* @param vn
|
* @param vn
|
||||||
* a value number
|
* a value number
|
||||||
* @return if we know that immediately after the given program counter, v_vn
|
* @return if we know that immediately after the given program counter, v_vn
|
||||||
* corresponds to some set of locals, then return an array of the
|
* corresponds to some set of locals, then return an array of the
|
||||||
* local numbers. else return null.
|
* local numbers. else return null.
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class ExplodedControlFlowGraph implements ControlFlowGraph {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNode(IBasicBlock n) {
|
public void addNode(IBasicBlock n) throws UnsupportedOperationException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class DelegatingNumberedEdgeManager<T extends INodeWithNumberedEdges> imp
|
||||||
/*
|
/*
|
||||||
* @see com.ibm.wala.util.graph.EdgeManager#removeEdges(com.ibm.wala.util.graph.Node)
|
* @see com.ibm.wala.util.graph.EdgeManager#removeEdges(com.ibm.wala.util.graph.Node)
|
||||||
*/
|
*/
|
||||||
public void removeAllIncidentEdges(T node) {
|
public void removeAllIncidentEdges(T node) throws UnimplementedError {
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
throw new IllegalArgumentException("node is null");
|
throw new IllegalArgumentException("node is null");
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ public class DelegatingNumberedEdgeManager<T extends INodeWithNumberedEdges> imp
|
||||||
/*
|
/*
|
||||||
* @see com.ibm.wala.util.graph.EdgeManager#removeEdges(com.ibm.wala.util.graph.Node)
|
* @see com.ibm.wala.util.graph.EdgeManager#removeEdges(com.ibm.wala.util.graph.Node)
|
||||||
*/
|
*/
|
||||||
public void removeIncomingEdges(T node) {
|
public void removeIncomingEdges(T node) throws UnimplementedError {
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
throw new IllegalArgumentException("node cannot be null");
|
throw new IllegalArgumentException("node cannot be null");
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public class DelegatingNumberedEdgeManager<T extends INodeWithNumberedEdges> imp
|
||||||
/*
|
/*
|
||||||
* @see com.ibm.wala.util.graph.EdgeManager#removeEdges(com.ibm.wala.util.graph.Node)
|
* @see com.ibm.wala.util.graph.EdgeManager#removeEdges(com.ibm.wala.util.graph.Node)
|
||||||
*/
|
*/
|
||||||
public void removeOutgoingEdges(T node) {
|
public void removeOutgoingEdges(T node) throws UnimplementedError {
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
throw new IllegalArgumentException("node cannot be null");
|
throw new IllegalArgumentException("node cannot be null");
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,12 @@ public final class SparseNumberedEdgeManager<T> implements NumberedEdgeManager<T
|
||||||
* an object to track nodes
|
* an object to track nodes
|
||||||
* @param normalCase
|
* @param normalCase
|
||||||
* what is the "normal" number of out edges for a node?
|
* what is the "normal" number of out edges for a node?
|
||||||
|
* @throws IllegalArgumentException if normalCase < 0
|
||||||
*/
|
*/
|
||||||
public SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager, int normalCase, byte delegateImpl) {
|
public SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager, int normalCase, byte delegateImpl) throws IllegalArgumentException {
|
||||||
|
if (normalCase < 0) {
|
||||||
|
throw new IllegalArgumentException("normalCase < 0");
|
||||||
|
}
|
||||||
this.nodeManager = nodeManager;
|
this.nodeManager = nodeManager;
|
||||||
if (normalCase == 0) {
|
if (normalCase == 0) {
|
||||||
successors = new BasicNaturalRelation(defaultImpl, delegateImpl);
|
successors = new BasicNaturalRelation(defaultImpl, delegateImpl);
|
||||||
|
|
|
@ -74,11 +74,16 @@ public final class BasicNaturalRelation implements IBinaryNaturalRelation {
|
||||||
* implemented with a SimpleIntVector, and the 2nd and 3rd are implemented
|
* implemented with a SimpleIntVector, and the 2nd and 3rd are implemented
|
||||||
* with TwoLevelIntVector
|
* with TwoLevelIntVector
|
||||||
* @throws IllegalArgumentException if implementation is null
|
* @throws IllegalArgumentException if implementation is null
|
||||||
|
* @throws IllegalArgumentException if implementation.length == 0
|
||||||
*/
|
*/
|
||||||
public BasicNaturalRelation(byte[] implementation, byte vectorImpl) {
|
public BasicNaturalRelation(byte[] implementation, byte vectorImpl) throws IllegalArgumentException {
|
||||||
|
|
||||||
if (implementation == null) {
|
if (implementation == null) {
|
||||||
throw new IllegalArgumentException("implementation is null");
|
throw new IllegalArgumentException("implementation is null");
|
||||||
}
|
}
|
||||||
|
if (implementation.length == 0) {
|
||||||
|
throw new IllegalArgumentException("implementation.length == 0");
|
||||||
|
}
|
||||||
smallStore = new IntVector[implementation.length];
|
smallStore = new IntVector[implementation.length];
|
||||||
for (int i = 0; i < implementation.length; i++) {
|
for (int i = 0; i < implementation.length; i++) {
|
||||||
switch (implementation[i]) {
|
switch (implementation[i]) {
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class BimodalMutableIntSet implements MutableIntSet {
|
||||||
return impl.max();
|
return impl.max();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BimodalMutableIntSet makeCopy(IntSet B) throws IllegalArgumentException {
|
public static BimodalMutableIntSet makeCopy(IntSet B) throws UnimplementedError, IllegalArgumentException {
|
||||||
if (B == null) {
|
if (B == null) {
|
||||||
throw new IllegalArgumentException("B == null");
|
throw new IllegalArgumentException("B == null");
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.ibm.wala.util.intset;
|
package com.ibm.wala.util.intset;
|
||||||
|
|
||||||
|
import com.ibm.wala.util.debug.UnimplementedError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* An object that creates some bimodal mutable int sets.
|
* An object that creates some bimodal mutable int sets.
|
||||||
|
@ -41,7 +43,7 @@ public class BimodalMutableIntSetFactory implements MutableIntSetFactory {
|
||||||
/*
|
/*
|
||||||
* @see com.ibm.wala.util.intset.MutableIntSetFactory#make(com.ibm.wala.util.intset.IntSet)
|
* @see com.ibm.wala.util.intset.MutableIntSetFactory#make(com.ibm.wala.util.intset.IntSet)
|
||||||
*/
|
*/
|
||||||
public MutableIntSet makeCopy(IntSet x) throws IllegalArgumentException {
|
public MutableIntSet makeCopy(IntSet x) throws UnimplementedError, IllegalArgumentException {
|
||||||
if (x == null) {
|
if (x == null) {
|
||||||
throw new IllegalArgumentException("x == null");
|
throw new IllegalArgumentException("x == null");
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,12 @@ public final class MutableSparseLongSet extends SparseLongSet implements Mutable
|
||||||
*/
|
*/
|
||||||
private final static int INITIAL_NONEMPTY_SIZE = 2;
|
private final static int INITIAL_NONEMPTY_SIZE = 2;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param set
|
public static MutableSparseLongSet make(LongSet set) {
|
||||||
*/
|
return new MutableSparseLongSet(set);
|
||||||
public MutableSparseLongSet(LongSet set) {
|
}
|
||||||
|
|
||||||
|
private MutableSparseLongSet(LongSet set) {
|
||||||
super();
|
super();
|
||||||
copySet(set);
|
copySet(set);
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ public class SparseLongSet implements LongSet {
|
||||||
throw new IllegalArgumentException("that == null");
|
throw new IllegalArgumentException("that == null");
|
||||||
}
|
}
|
||||||
if (that instanceof SparseLongSet) {
|
if (that instanceof SparseLongSet) {
|
||||||
MutableSparseLongSet temp = new MutableSparseLongSet(this);
|
MutableSparseLongSet temp = MutableSparseLongSet.make(this);
|
||||||
temp.intersectWith((SparseLongSet) that);
|
temp.intersectWith((SparseLongSet) that);
|
||||||
return temp;
|
return temp;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue