massive overhaul of Warnings management

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1388 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2007-07-06 22:08:55 +00:00
parent 3afac56df2
commit 90512ffb4e
15 changed files with 152 additions and 273 deletions

View File

@ -34,7 +34,7 @@ import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.util.warnings.Warnings;
/**
*
@ -62,8 +62,6 @@ public class AppClientEntrypoints implements Iterable<Entrypoint> {
*/
private final AnalysisScope scope;
private final WarningSet warnings;
/**
* @param scope
* scope of analysis
@ -71,13 +69,12 @@ public class AppClientEntrypoints implements Iterable<Entrypoint> {
* loaded class hierarchy
* @throws IllegalArgumentException if scope is null
*/
public AppClientEntrypoints(J2EEAnalysisScope scope, IClassHierarchy cha, WarningSet warnings) {
public AppClientEntrypoints(J2EEAnalysisScope scope, IClassHierarchy cha) {
if (scope == null) {
throw new IllegalArgumentException("scope is null");
}
this.cha = cha;
this.scope = scope;
this.warnings = warnings;
ClassLoaderReference loader = scope.getApplicationLoader();
for (Iterator<Module> it = scope.getModules(loader).iterator(); it.hasNext();) {
Module M = (Module) it.next();
@ -113,9 +110,6 @@ public class AppClientEntrypoints implements Iterable<Entrypoint> {
}
}
/**
* @param file
*/
@SuppressWarnings("restriction")
private void addEntrypoints(ApplicationClientFile file) {
ArchiveManifest manifest = file.getManifest();
@ -138,12 +132,12 @@ public class AppClientEntrypoints implements Iterable<Entrypoint> {
}
IClass klass = cha.lookupClass(T);
if (klass == null) {
warnings.add(LoadFailure.create(T));
Warnings.add(LoadFailure.create(T));
return;
}
IMethod m = cha.resolveMethod(klass,Main.getSelector());
if (m == null) {
warnings.add(LoadFailure.create(Main));
Warnings.add(LoadFailure.create(Main));
return;
}
entrypoints.put(Main, new DefaultEntrypoint(m, cha));

View File

@ -52,10 +52,9 @@ import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.Warning;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.util.warnings.Warnings;
/**
*
* Logic to interpret dynacache commands in context
*
* @author sfink
@ -77,20 +76,14 @@ public class CommandInterpreter implements SSAContextInterpreter {
*/
private final IClassHierarchy cha;
/**
* Keep track of analysis warnings
*/
private WarningSet warnings;
/**
* @param cha
* governing class hierarchy
* @param warnings
* object to track analysis warnings
*/
public CommandInterpreter(IClassHierarchy cha, WarningSet warnings) {
public CommandInterpreter(IClassHierarchy cha) {
this.cha = cha;
this.warnings = warnings;
}
/*
@ -100,29 +93,16 @@ public class CommandInterpreter implements SSAContextInterpreter {
* com.ibm.wala.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public IR getIR(CGNode node, WarningSet warnings) {
public IR getIR(CGNode node) {
SpecializedExecuteMethod m = findOrCreateSpecializedMethod(node);
return m.getIR(warnings);
return m.getIR();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.cfa.CFAContextInterpreter#getNumberOfStatements(com.ibm.wala.classLoader.IMethod,
* com.ibm.wala.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public int getNumberOfStatements(CGNode node, WarningSet warnings) {
public int getNumberOfStatements(CGNode node) {
SpecializedExecuteMethod m = findOrCreateSpecializedMethod(node);
return m.calls.size();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#understands(com.ibm.wala.classLoader.IMethod,
* com.ibm.wala.ipa.callgraph.Context)
*/
public boolean understands(CGNode node) {
if (!(node.getContext() instanceof JavaTypeContext)) {
@ -181,7 +161,7 @@ public class CommandInterpreter implements SSAContextInterpreter {
if (DEBUG) {
Trace.println("Found no implementors of type " + T);
}
warnings.add(NoSubtypesWarning.create(T));
Warnings.add(NoSubtypesWarning.create(T));
}
addStatementsForSetOfTypes(implementors.iterator());
@ -191,7 +171,7 @@ public class CommandInterpreter implements SSAContextInterpreter {
if (DEBUG) {
Trace.println("Found no subclasses of type " + T);
}
warnings.add(NoSubtypesWarning.create(T));
Warnings.add(NoSubtypesWarning.create(T));
}
addStatementsForSetOfTypes(subclasses.iterator());
}
@ -267,7 +247,7 @@ public class CommandInterpreter implements SSAContextInterpreter {
*
* @see com.ibm.wala.classLoader.IMethod#getStatements(com.ibm.wala.util.warnings.WarningSet)
*/
public SSAInstruction[] getStatements(WarningSet warnings) {
public SSAInstruction[] getStatements() {
SSAInstruction[] result = new SSAInstruction[calls.size()];
int i = 0;
for (Iterator<SSAInstruction> it = calls.iterator(); it.hasNext();) {
@ -276,14 +256,9 @@ public class CommandInterpreter implements SSAContextInterpreter {
return result;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IMethod#getIR(com.ibm.wala.util.warnings.WarningSet)
*/
public IR getIR(WarningSet warnings) {
SSAInstruction[] instrs = getStatements(warnings);
return new SyntheticIR(this, Everywhere.EVERYWHERE, new InducedCFG(instrs, this, Everywhere.EVERYWHERE), instrs, SSAOptions.defaultOptions(), null, warnings);
public IR getIR() {
SSAInstruction[] instrs = getStatements();
return new SyntheticIR(this, Everywhere.EVERYWHERE, new InducedCFG(instrs, this, Everywhere.EVERYWHERE), instrs, SSAOptions.defaultOptions(), null);
}
}
@ -313,78 +288,32 @@ public class CommandInterpreter implements SSAContextInterpreter {
return m;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#getCaughtExceptions(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Set<Object> getCaughtExceptions(CGNode node, WarningSet warnings) {
public Set<Object> getCaughtExceptions(CGNode node) {
return Collections.emptySet();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#hasObjectArrayLoad(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public boolean hasObjectArrayLoad(CGNode node, WarningSet warnings) {
public boolean hasObjectArrayLoad(CGNode node) {
return false;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#hasObjectArrayStore(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public boolean hasObjectArrayStore(CGNode node, WarningSet warnings) {
public boolean hasObjectArrayStore(CGNode node) {
return false;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#iterateCastTypes(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator<IClass> iterateCastTypes(CGNode node, WarningSet warnings) {
public Iterator<IClass> iterateCastTypes(CGNode node ) {
return EmptyIterator.instance();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#recordFactoryType(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.classLoader.IClass)
*/
public boolean recordFactoryType(CGNode node, IClass klass) {
// this class does not observe factories
return false;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#setWarnings(com.ibm.wala.util.warnings.WarningSet)
*/
public void setWarnings(WarningSet newWarnings) {
this.warnings = newWarnings;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.cfg.CFGProvider#getCFG(com.ibm.wala.ipa.callgraph.CGNode)
*/
public ControlFlowGraph getCFG(CGNode N, WarningSet warnings) {
return getIR(N, warnings).getControlFlowGraph();
public ControlFlowGraph getCFG(CGNode N) {
return getIR(N).getControlFlowGraph();
}
/**
* @author sfink
*
* A waring when we fail to find subtypes for a command method
* A warning when we fail to find subtypes for a command method
*/
private static class NoSubtypesWarning extends Warning {
@ -400,10 +329,7 @@ public class CommandInterpreter implements SSAContextInterpreter {
return new NoSubtypesWarning(T);
}
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter#getDU(com.ibm.wala.ipa.callgraph.CGNode, com.ibm.wala.util.warnings.WarningSet)
*/
public DefUse getDU(CGNode node, WarningSet warnings) {
return new DefUse(getIR(node,warnings));
public DefUse getDU(CGNode node) {
return new DefUse(getIR(node));
}
}

View File

@ -43,7 +43,7 @@ import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.util.warnings.Warnings;
/**
*
@ -105,8 +105,6 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
private final J2EEClassTargetSelector classTargetSelector;
private final WarningSet warnings;
/**
* Create the set of EJB entrypoints that are defined in an analysis scope
*
@ -115,11 +113,10 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
*/
@SuppressWarnings({ "restriction", "unchecked" })
public EJBEntrypoints(IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData deployment, boolean justMDBs,
J2EEClassTargetSelector classTargetSelector, WarningSet warnings) {
J2EEClassTargetSelector classTargetSelector) {
this.cha = cha;
this.deployment = deployment;
this.JUST_MDBS = justMDBs;
this.warnings = warnings;
this.classTargetSelector = classTargetSelector;
ClassLoaderReference loader = scope.getApplicationLoader();
@ -206,7 +203,7 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
}
IMethod m = cha.resolveMethod(e);
if (m == null) {
warnings.add(LoadFailure.create(e));
Warnings.add(LoadFailure.create(e));
return;
}
entrypoints.add(new MDBEntrypoint(m, cha, T));
@ -285,7 +282,7 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
}
IMethod m = cha.resolveMethod(e);
if (m == null) {
warnings.add(LoadFailure.create(m));
Warnings.add(LoadFailure.create(m));
continue;
}
entrypoints.add(new EJBLifecycleEntrypoint(m, cha, type));
@ -313,12 +310,12 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
}
final IClass klass = cha.lookupClass(interfaceType);
if (klass == null) {
warnings.add(LoadFailure.create(interfaceType));
Warnings.add(LoadFailure.create(interfaceType));
continue;
}
IMethod m = cha.resolveMethod(klass, target.getSelector());
if (m == null) {
warnings.add(LoadFailure.create(target));
Warnings.add(LoadFailure.create(target));
continue;
}
entrypoints.add(new DefaultEntrypoint(m, cha) {

View File

@ -28,10 +28,9 @@ import com.ibm.wala.types.TypeName;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.warnings.ResolutionFailure;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.util.warnings.Warnings;
/**
*
* This class provides context selection logic for special J2EE methods.
*
* @author sfink
@ -52,11 +51,8 @@ public class J2EEContextSelector implements ContextSelector {
private final ReceiverTypeInferenceCache typeInference;
private final WarningSet warnings;
public J2EEContextSelector(ReceiverTypeInferenceCache typeInference, WarningSet warnings) {
public J2EEContextSelector(ReceiverTypeInferenceCache typeInference) {
this.typeInference = typeInference;
this.warnings = warnings;
}
/**
@ -75,7 +71,7 @@ public class J2EEContextSelector implements ContextSelector {
TypeAbstraction type = R.getReceiverType(site);
if (type == null) {
// Type inference failed; raise a severe warning
warnings.add(ResolutionFailure.create(caller, site));
Warnings.add(ResolutionFailure.create(caller, site));
return null;
}
return new JavaTypeContext(type);
@ -101,17 +97,6 @@ public class J2EEContextSelector implements ContextSelector {
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#setWarnings(com.ibm.wala.util.warnings.WarningSet)
*/
public void setWarnings(WarningSet newWarnings) {
// this object is not bound to a WarningSet
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.ContextSelector#contextIsIrrelevant(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.classLoader.CallSiteReference)
*/

View File

@ -16,7 +16,6 @@ import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.ComposedEntrypoints;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
@ -42,7 +41,7 @@ public class J2EEEntrypoints implements Iterable<Entrypoint> {
* @param useEjbEntrypoints
* should the analysis assume external callers on the EJB interfaces?
*/
public J2EEEntrypoints(J2EEAnalysisScope scope, DeploymentMetaData dmd, IClassHierarchy cha, WarningSet warnings,
public J2EEEntrypoints(J2EEAnalysisScope scope, DeploymentMetaData dmd, IClassHierarchy cha,
boolean useEjbEntrypoints) {
ServletEntrypoints servletEntrypoints = new ServletEntrypoints(scope, cha);
J2EEClassTargetSelector classTargetSelector = new J2EEClassTargetSelector(null, dmd, cha, cha.getLoader(scope.getLoader(Atom
@ -51,14 +50,14 @@ public class J2EEEntrypoints implements Iterable<Entrypoint> {
EJBEntrypoints ejbEntrypoints = null;
if (useEjbEntrypoints) {
// pick up all ejb entrypoints
ejbEntrypoints = new EJBEntrypoints(cha, scope, dmd, false, classTargetSelector, warnings);
ejbEntrypoints = new EJBEntrypoints(cha, scope, dmd, false, classTargetSelector);
} else {
// pick up only MDB EJB entrypoints
ejbEntrypoints = new EJBEntrypoints(cha, scope, dmd, true, classTargetSelector, warnings);
ejbEntrypoints = new EJBEntrypoints(cha, scope, dmd, true, classTargetSelector);
}
entrypoints = new ComposedEntrypoints(servletEntrypoints, ejbEntrypoints);
appClientEntrypoints = new AppClientEntrypoints(scope, cha, warnings);
appClientEntrypoints = new AppClientEntrypoints(scope, cha);
entrypoints = new ComposedEntrypoints(entrypoints, appClientEntrypoints);
if (USE_STRUTS_ACTIONS) {

View File

@ -51,7 +51,7 @@ import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.ResolutionFailure;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.util.warnings.Warnings;
/**
*
@ -107,11 +107,6 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
*/
private final ReceiverTypeInferenceCache typeInference;
/**
* An object which tracks warnings from analysis
*/
private final WarningSet warnings;
/**
* Governing analysis scope
*/
@ -149,10 +144,9 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
}
public J2EEMethodTargetSelector(AnalysisScope scope, MethodTargetSelector parent, DeploymentMetaData deployment,
IClassHierarchy cha, ReceiverTypeInferenceCache typeInference, WarningSet warnings) {
IClassHierarchy cha, ReceiverTypeInferenceCache typeInference) {
this.scope = scope;
this.deployment = deployment;
this.warnings = warnings;
this.parent = parent;
this.cha = cha;
this.typeInference = typeInference;
@ -179,7 +173,7 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
// resolve the method via the class hierarchy first
IMethod resolved = cha.resolveMethod(m);
if (resolved == null) {
warnings.add(LoadFailure.create(m));
Warnings.add(LoadFailure.create(m));
return null;
}
m = resolved.getReference();
@ -264,7 +258,7 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
// resolve the method via the class hierarchy first
IMethod resolved = cha.resolveMethod(m);
if (resolved == null) {
warnings.add(LoadFailure.create(m));
Warnings.add(LoadFailure.create(m));
return null;
}
m = resolved.getReference();
@ -809,7 +803,7 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
// this is a problem ... the field is not navigable .... need to do
// something better, like
// create a synthetic field.
warnings.add(LoadFailure.create(field));
Warnings.add(LoadFailure.create(field));
return;
}
TypeReference otherT = oppField.getFieldType();
@ -1105,7 +1099,7 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
}
if (type == null) {
// Type inference failed; raise a severe warning
warnings.add(ResolutionFailure.create(N, site));
Warnings.add(ResolutionFailure.create(N, site));
return null;
} else {
// Type inference succeeded; modify m to reflect the more specific

View File

@ -15,7 +15,6 @@ import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
@ -52,12 +51,10 @@ public interface CallGraphBuilderFactory extends com.ibm.wala.client.CallGraphBu
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* @param keepPointsTo
* preserve PointsTo graph for posterity?
*
*/
CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData dmd,
WarningSet warnings, boolean keepPointsTo);
boolean keepPointsTo);
}

View File

@ -53,11 +53,12 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
*/
private boolean dependentJars = true;
protected J2EEAbstractAnalysisEngine() {}
protected J2EEAbstractAnalysisEngine() {
}
protected CallGraphBuilder getCallGraphBuilder(ClassHierarchy cha, AnalysisOptions options) {
return ((CallGraphBuilderFactory) getCallGraphBuilderFactory()).make(options, cha, (J2EEAnalysisScope) getScope(), getDmd(),
getWarnings(), false);
false);
}
/**
@ -66,6 +67,7 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
protected void buildAnalysisScope() {
buildAnalysisScope(null);
}
/**
* Set up the AnalysisScope object
*/
@ -86,7 +88,7 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
/**
* Add the application modules to the analyis scope.
*/
@SuppressWarnings({ "restriction", "unchecked" })
@SuppressWarnings( { "restriction", "unchecked" })
protected void addApplicationModulesToScope() {
ClassLoaderReference app = scope.getApplicationLoader();
for (Iterator<Archive> it = moduleFiles.iterator(); it.hasNext();) {
@ -134,7 +136,7 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
/**
* @param dmd
* The dmd to set.
* The dmd to set.
*/
protected void setDmd(DeploymentMetaData dmd) {
this.dmd = dmd;
@ -149,7 +151,7 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
/**
* @param dependentJars
* The dependentJars to set.
* The dependentJars to set.
*/
public void setDependentJars(boolean dependentJars) {
this.dependentJars = dependentJars;

View File

@ -17,7 +17,6 @@ import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
@ -31,8 +30,8 @@ public class RTABuilderFactory
{
public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings, boolean keepPointsTo) {
return Util.makeRTABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings);
DeploymentMetaData dmd, boolean keepPointsTo) {
return Util.makeRTABuilder(options, cha, getClass().getClassLoader(), scope, dmd);
}
}

View File

@ -17,7 +17,6 @@ import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util;
import com.ibm.wala.util.warnings.WarningSet;
/**
* @author sfink
@ -28,8 +27,8 @@ public class ZeroCFABuilderFactory
{
public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings, boolean keepPointsTo) {
return Util.makeZeroCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings);
DeploymentMetaData dmd, boolean keepPointsTo) {
return Util.makeZeroCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd);
}
}

View File

@ -17,7 +17,6 @@ import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
@ -31,8 +30,8 @@ public class ZeroContainerCFABuilderFactory
{
public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData dmd,
WarningSet warnings, boolean keepPointsTo) {
return Util.makeZeroContainerCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings);
boolean keepPointsTo) {
return Util.makeZeroContainerCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd);
}
}

View File

@ -17,7 +17,6 @@ import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util;
import com.ibm.wala.util.warnings.WarningSet;
/**
* A factory to create J2EE call graph builders using 0-1-container-CFA
@ -30,8 +29,8 @@ public class ZeroOneCFABuilderFactory
{
public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings, boolean keepPointsTo) {
return Util.makeZeroOneCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings);
DeploymentMetaData dmd, boolean keepPointsTo) {
return Util.makeZeroOneCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd);
}
}

View File

@ -17,7 +17,6 @@ import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
@ -31,8 +30,8 @@ public class ZeroOneContainerCFABuilderFactory
public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData dmd,
WarningSet warnings, boolean keepPointsTo) {
return Util.makeZeroOneContainerCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings);
boolean keepPointsTo) {
return Util.makeZeroOneContainerCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd);
}
}

View File

@ -38,7 +38,6 @@ import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.warnings.WarningSet;
/**
* @author sfink
@ -49,246 +48,237 @@ public class Util {
* @return an RTA Call Graph builder.
*
* @param options
* options that govern call graph construction
* options that govern call graph construction
* @param cha
* governing class hierarchy
* governing class hierarchy
* @param cl
* classloader that can find WALA resources
* classloader that can find WALA resources
* @param scope
* representation of the analysis scope
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* deployment descriptor abstraction
*/
public static CallGraphBuilder makeRTABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings) {
DeploymentMetaData dmd) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha, warnings);
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null;
if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings);
appSelector = new J2EEContextSelector(typeInference, warnings);
appInterpreter = new CommandInterpreter(cha, warnings);
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha);
}
return new BasicRTABuilder(cha, warnings, options, appSelector, appInterpreter);
return new BasicRTABuilder(cha, options, appSelector, appInterpreter);
}
/**
* @param options
* options that govern call graph construction
* options that govern call graph construction
* @param cha
* governing class hierarchy
* governing class hierarchy
* @param cl
* classloader that can find WALA resources
* classloader that can find WALA resources
* @param scope
* representation of the analysis scope
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* an object which tracks analysis warnings
* @return a 0-CFA Call Graph Builder.
*/
public static CFABuilder makeZeroCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings) {
DeploymentMetaData dmd) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha, warnings);
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null;
if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings);
appSelector = new J2EEContextSelector(typeInference, warnings);
appInterpreter = new CommandInterpreter(cha, warnings);
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha);
}
return new ZeroXCFABuilder(cha, warnings, options, appSelector, appInterpreter, options.getReflectionSpec(),
ZeroXInstanceKeys.NONE);
return new ZeroXCFABuilder(cha, options, appSelector, appInterpreter, options.getReflectionSpec(), ZeroXInstanceKeys.NONE);
}
/**
* @param options
* options that govern call graph construction
* options that govern call graph construction
* @param cha
* governing class hierarchy
* governing class hierarchy
* @param cl
* classloader that can find WALA resources
* classloader that can find WALA resources
* @param scope
* representation of the analysis scope
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* an object which tracks analysis warnings
* @return a 1-CFA Call Graph Builder.
*/
public static CallGraphBuilder makeOneCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl,
AnalysisScope scope, DeploymentMetaData dmd, WarningSet warnings) {
AnalysisScope scope, DeploymentMetaData dmd) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha, warnings);
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null;
if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings);
appSelector = new J2EEContextSelector(typeInference, warnings);
appInterpreter = new CommandInterpreter(cha, warnings);
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha);
}
CallGraphBuilder builder = new OneCFABuilder(cha, warnings, options, appSelector, appInterpreter, options.getReflectionSpec());
CallGraphBuilder builder = new OneCFABuilder(cha, options, appSelector, appInterpreter, options.getReflectionSpec());
return builder;
}
/**
* @param options
* options that govern call graph construction
* options that govern call graph construction
* @param cha
* governing class hierarchy
* governing class hierarchy
* @param cl
* classloader that can find WALA resources
* classloader that can find WALA resources
* @param scope
* representation of the analysis scope
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* deployment descriptor abstraction
* @return a 0-1-CFA Call Graph Builder.
*
* This version uses the DEDUCED_PLUS_STRINGSTUFF policy to avoid
* disambiguating uninteresting types.
*/
public static CFABuilder makeZeroOneCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings) {
DeploymentMetaData dmd) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha, warnings);
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null;
if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings);
appSelector = new J2EEContextSelector(typeInference, warnings);
appInterpreter = new CommandInterpreter(cha, warnings);
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha);
}
return new ZeroXCFABuilder(cha, warnings, options, appSelector, appInterpreter, options.getReflectionSpec(),
return new ZeroXCFABuilder(cha, options, appSelector, appInterpreter, options.getReflectionSpec(),
ZeroXInstanceKeys.ALLOCATIONS | ZeroXInstanceKeys.SMUSH_MANY | ZeroXInstanceKeys.SMUSH_PRIMITIVE_HOLDERS
| ZeroXInstanceKeys.SMUSH_STRINGS | ZeroXInstanceKeys.SMUSH_THROWABLES);
}
/**
* @param options
* options that govern call graph construction
* options that govern call graph construction
* @param cha
* governing class hierarchy
* governing class hierarchy
* @param cl
* classloader that can find WALA resources
* classloader that can find WALA resources
* @param scope
* representation of the analysis scope
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* deployment descriptor abstraction
* @return a 0-1-CFA Call Graph Builder.
*
* This version uses the ALL policy to disambiguate all allocation sites
*/
public static CFABuilder makeZeroOneUnoptCFABuilder(AnalysisOptions options, ClassHierarchy cha, ClassLoader cl,
AnalysisScope scope, DeploymentMetaData dmd, WarningSet warnings) {
AnalysisScope scope, DeploymentMetaData dmd) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha, warnings);
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null;
if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings);
appSelector = new J2EEContextSelector(typeInference, warnings);
appInterpreter = new CommandInterpreter(cha, warnings);
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha);
}
return new ZeroXCFABuilder(cha, warnings, options, appSelector, appInterpreter, options.getReflectionSpec(),
return new ZeroXCFABuilder(cha, options, appSelector, appInterpreter, options.getReflectionSpec(),
ZeroXInstanceKeys.ALLOCATIONS);
}
/**
* @param options
* options that govern call graph construction
* options that govern call graph construction
* @param cha
* governing class hierarchy
* governing class hierarchy
* @param cl
* classloader that can find WALA resources
* classloader that can find WALA resources
* @param scope
* representation of the analysis scope
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* an object which tracks analysis warnings
* @return a 0-CFA Call Graph Builder augmented with extra logic for
* containers
*/
public static CFABuilder makeZeroContainerCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl,
AnalysisScope scope, DeploymentMetaData dmd, WarningSet warnings) {
AnalysisScope scope, DeploymentMetaData dmd) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha, warnings);
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null;
if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings);
appSelector = new J2EEContextSelector(typeInference, warnings);
appInterpreter = new CommandInterpreter(cha, warnings);
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha);
}
return new ZeroContainerCFABuilder(cha, warnings, options, appSelector, appInterpreter, options.getReflectionSpec());
return new ZeroContainerCFABuilder(cha, options, appSelector, appInterpreter, options.getReflectionSpec());
}
/**
* @param options
* options that govern call graph construction
* options that govern call graph construction
* @param cha
* governing class hierarchy
* governing class hierarchy
* @param cl
* classloader that can find WALA resources
* classloader that can find WALA resources
* @param scope
* representation of the analysis scope
* representation of the analysis scope
* @param dmd
* deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* deployment descriptor abstraction
* @return a 0-1-CFA Call Graph Builder augmented with extra logic for
* containers
*/
public static CFABuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl,
AnalysisScope scope, DeploymentMetaData dmd, WarningSet warnings) {
AnalysisScope scope, DeploymentMetaData dmd) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha, warnings);
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null;
if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings);
appSelector = new J2EEContextSelector(typeInference, warnings);
appInterpreter = new CommandInterpreter(cha, warnings);
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha);
}
return new ZeroOneContainerCFABuilder(cha, warnings, options, appSelector, appInterpreter, options.getReflectionSpec());
return new ZeroOneContainerCFABuilder(cha, options, appSelector, appInterpreter, options.getReflectionSpec());
}
public static void addJ2EEBypassLogic(AnalysisOptions options, AnalysisScope scope, DeploymentMetaData dmd, IClassHierarchy cha,
ReceiverTypeInferenceCache typeInference, WarningSet warn) {
ReceiverTypeInferenceCache typeInference) {
if (cha == null) {
throw new IllegalArgumentException("cha is null");
}
MethodTargetSelector ms = new J2EEMethodTargetSelector(scope, options.getMethodTargetSelector(), dmd, cha, typeInference, warn);
MethodTargetSelector ms = new J2EEMethodTargetSelector(scope, options.getMethodTargetSelector(), dmd, cha, typeInference);
options.setSelector(ms);
ClassTargetSelector cs = new J2EEClassTargetSelector(options.getClassTargetSelector(), dmd, cha, cha.getLoader(scope
@ -299,7 +289,7 @@ public class Util {
/**
* @param bean
* @param cha
* governing class hierarchy
* governing class hierarchy
* @return the Set of CMR fields for this bean, including inherited CMRs
*/
public static Set<Object> getCMRFields(BeanMetaData bean, DeploymentMetaData dmd, ClassHierarchy cha) {

View File

@ -1,6 +1,6 @@
package com.ibm.wala.model.javax.servlet;
import javax.servlet.*;
import javax.servlet.ServletOutputStream;
public class ServletResponse implements javax.servlet.ServletResponse {
private java.util.Locale locale = java.util.Locale.getDefault();;