fix bug 2491971 : enforce that first delegate to DelegatingSSAContextInterpreter is non-null.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3156 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2009-01-07 15:37:30 +00:00
parent 552e754506
commit 4b5795575a
3 changed files with 8 additions and 6 deletions

View File

@ -32,14 +32,17 @@ public class DelegatingSSAContextInterpreter extends DelegatingRTAContextInterpr
private final SSAContextInterpreter B;
/**
* TODO: really shouldn't allow A to be null.
* neither A nor B should be null.
*/
public DelegatingSSAContextInterpreter(SSAContextInterpreter A, SSAContextInterpreter B) {
super(A, B);
this.A = A;
this.B = B;
if (Assertions.verifyAssertions) {
Assertions._assert(B != null, "B is null");
if (A == null) {
throw new IllegalArgumentException("A cannot be null");
}
if (B == null) {
throw new IllegalArgumentException("B cannot be null");
}
}

View File

@ -42,7 +42,7 @@ public class ZeroXCFABuilder extends SSAPropagationCallGraphBuilder {
SSAContextInterpreter c = new DefaultSSAInterpreter(options, cache);
c = new DelegatingSSAContextInterpreter(ReflectionContextInterpreter.createReflectionContextInterpreter(cha, options, getAnalysisCache(), reflect), c);
SSAContextInterpreter contextInterpreter = new DelegatingSSAContextInterpreter(appContextInterpreter, c);
SSAContextInterpreter contextInterpreter = appContextInterpreter == null ? c : new DelegatingSSAContextInterpreter(appContextInterpreter, c);
setContextInterpreter(contextInterpreter);
ZeroXInstanceKeys zik = makeInstanceKeys(cha, options, contextInterpreter, instancePolicy);

View File

@ -398,13 +398,12 @@ public abstract class AbstractRTABuilder extends PropagationCallGraphBuilder {
SSAContextInterpreter defI = new DefaultSSAInterpreter(getOptions(), getAnalysisCache());
defI = new DelegatingSSAContextInterpreter(ReflectionContextInterpreter.createReflectionContextInterpreter(cha, getOptions(), getAnalysisCache(), reflect),
defI);
SSAContextInterpreter contextInterpreter = new DelegatingSSAContextInterpreter(appContextInterpreter, defI);
SSAContextInterpreter contextInterpreter = appContextInterpreter == null ? defI : new DelegatingSSAContextInterpreter(appContextInterpreter, defI);
return contextInterpreter;
}
@Override
protected boolean unconditionallyAddConstraintsFromNode(CGNode node) {
// add all relevant constraints
addNewConstraints(node);
addCallConstraints(node);