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.Atom;
import com.ibm.wala.util.collections.HashMapFactory; import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.debug.Trace; 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 AnalysisScope scope;
private final WarningSet warnings;
/** /**
* @param scope * @param scope
* scope of analysis * scope of analysis
@ -71,13 +69,12 @@ public class AppClientEntrypoints implements Iterable<Entrypoint> {
* loaded class hierarchy * loaded class hierarchy
* @throws IllegalArgumentException if scope is null * @throws IllegalArgumentException if scope is null
*/ */
public AppClientEntrypoints(J2EEAnalysisScope scope, IClassHierarchy cha, WarningSet warnings) { public AppClientEntrypoints(J2EEAnalysisScope scope, IClassHierarchy cha) {
if (scope == null) { if (scope == null) {
throw new IllegalArgumentException("scope is null"); throw new IllegalArgumentException("scope is null");
} }
this.cha = cha; this.cha = cha;
this.scope = scope; this.scope = scope;
this.warnings = warnings;
ClassLoaderReference loader = scope.getApplicationLoader(); ClassLoaderReference loader = scope.getApplicationLoader();
for (Iterator<Module> it = scope.getModules(loader).iterator(); it.hasNext();) { for (Iterator<Module> it = scope.getModules(loader).iterator(); it.hasNext();) {
Module M = (Module) it.next(); Module M = (Module) it.next();
@ -113,9 +110,6 @@ public class AppClientEntrypoints implements Iterable<Entrypoint> {
} }
} }
/**
* @param file
*/
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
private void addEntrypoints(ApplicationClientFile file) { private void addEntrypoints(ApplicationClientFile file) {
ArchiveManifest manifest = file.getManifest(); ArchiveManifest manifest = file.getManifest();
@ -138,12 +132,12 @@ public class AppClientEntrypoints implements Iterable<Entrypoint> {
} }
IClass klass = cha.lookupClass(T); IClass klass = cha.lookupClass(T);
if (klass == null) { if (klass == null) {
warnings.add(LoadFailure.create(T)); Warnings.add(LoadFailure.create(T));
return; return;
} }
IMethod m = cha.resolveMethod(klass,Main.getSelector()); IMethod m = cha.resolveMethod(klass,Main.getSelector());
if (m == null) { if (m == null) {
warnings.add(LoadFailure.create(Main)); Warnings.add(LoadFailure.create(Main));
return; return;
} }
entrypoints.put(Main, new DefaultEntrypoint(m, cha)); 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.Assertions;
import com.ibm.wala.util.debug.Trace; import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.Warning; 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 * Logic to interpret dynacache commands in context
* *
* @author sfink * @author sfink
@ -77,20 +76,14 @@ public class CommandInterpreter implements SSAContextInterpreter {
*/ */
private final IClassHierarchy cha; private final IClassHierarchy cha;
/**
* Keep track of analysis warnings
*/
private WarningSet warnings;
/** /**
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param warnings * @param warnings
* object to track analysis warnings * object to track analysis warnings
*/ */
public CommandInterpreter(IClassHierarchy cha, WarningSet warnings) { public CommandInterpreter(IClassHierarchy cha) {
this.cha = 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.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet) * com.ibm.wala.util.warnings.WarningSet)
*/ */
public IR getIR(CGNode node, WarningSet warnings) { public IR getIR(CGNode node) {
SpecializedExecuteMethod m = findOrCreateSpecializedMethod(node); SpecializedExecuteMethod m = findOrCreateSpecializedMethod(node);
return m.getIR(warnings); return m.getIR();
} }
/* public int getNumberOfStatements(CGNode node) {
* (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) {
SpecializedExecuteMethod m = findOrCreateSpecializedMethod(node); SpecializedExecuteMethod m = findOrCreateSpecializedMethod(node);
return m.calls.size(); 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) { public boolean understands(CGNode node) {
if (!(node.getContext() instanceof JavaTypeContext)) { if (!(node.getContext() instanceof JavaTypeContext)) {
@ -181,7 +161,7 @@ public class CommandInterpreter implements SSAContextInterpreter {
if (DEBUG) { if (DEBUG) {
Trace.println("Found no implementors of type " + T); Trace.println("Found no implementors of type " + T);
} }
warnings.add(NoSubtypesWarning.create(T)); Warnings.add(NoSubtypesWarning.create(T));
} }
addStatementsForSetOfTypes(implementors.iterator()); addStatementsForSetOfTypes(implementors.iterator());
@ -191,7 +171,7 @@ public class CommandInterpreter implements SSAContextInterpreter {
if (DEBUG) { if (DEBUG) {
Trace.println("Found no subclasses of type " + T); Trace.println("Found no subclasses of type " + T);
} }
warnings.add(NoSubtypesWarning.create(T)); Warnings.add(NoSubtypesWarning.create(T));
} }
addStatementsForSetOfTypes(subclasses.iterator()); 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) * @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()]; SSAInstruction[] result = new SSAInstruction[calls.size()];
int i = 0; int i = 0;
for (Iterator<SSAInstruction> it = calls.iterator(); it.hasNext();) { for (Iterator<SSAInstruction> it = calls.iterator(); it.hasNext();) {
@ -276,14 +256,9 @@ public class CommandInterpreter implements SSAContextInterpreter {
return result; return result;
} }
/* public IR getIR() {
* (non-Javadoc) SSAInstruction[] instrs = getStatements();
* return new SyntheticIR(this, Everywhere.EVERYWHERE, new InducedCFG(instrs, this, Everywhere.EVERYWHERE), instrs, SSAOptions.defaultOptions(), null);
* @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);
} }
} }
@ -313,78 +288,32 @@ public class CommandInterpreter implements SSAContextInterpreter {
return m; return m;
} }
/* public Set<Object> getCaughtExceptions(CGNode node) {
* (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) {
return Collections.emptySet(); return Collections.emptySet();
} }
/* public boolean hasObjectArrayLoad(CGNode node) {
* (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) {
return false; return false;
} }
/* public boolean hasObjectArrayStore(CGNode node) {
* (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) {
return false; return false;
} }
/* public Iterator<IClass> iterateCastTypes(CGNode node ) {
* (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) {
return EmptyIterator.instance(); 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) { public boolean recordFactoryType(CGNode node, IClass klass) {
// this class does not observe factories // this class does not observe factories
return false; return false;
} }
/* public ControlFlowGraph getCFG(CGNode N) {
* (non-Javadoc) return getIR(N).getControlFlowGraph();
*
* @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();
} }
/** /**
* @author sfink * A warning when we fail to find subtypes for a command method
*
* A waring when we fail to find subtypes for a command method
*/ */
private static class NoSubtypesWarning extends Warning { private static class NoSubtypesWarning extends Warning {
@ -400,10 +329,7 @@ public class CommandInterpreter implements SSAContextInterpreter {
return new NoSubtypesWarning(T); return new NoSubtypesWarning(T);
} }
} }
/* (non-Javadoc) public DefUse getDU(CGNode node) {
* @see com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter#getDU(com.ibm.wala.ipa.callgraph.CGNode, com.ibm.wala.util.warnings.WarningSet) return new DefUse(getIR(node));
*/
public DefUse getDU(CGNode node, WarningSet warnings) {
return new DefUse(getIR(node,warnings));
} }
} }

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.collections.HashSetFactory;
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.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 J2EEClassTargetSelector classTargetSelector;
private final WarningSet warnings;
/** /**
* Create the set of EJB entrypoints that are defined in an analysis scope * 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" }) @SuppressWarnings({ "restriction", "unchecked" })
public EJBEntrypoints(IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData deployment, boolean justMDBs, public EJBEntrypoints(IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData deployment, boolean justMDBs,
J2EEClassTargetSelector classTargetSelector, WarningSet warnings) { J2EEClassTargetSelector classTargetSelector) {
this.cha = cha; this.cha = cha;
this.deployment = deployment; this.deployment = deployment;
this.JUST_MDBS = justMDBs; this.JUST_MDBS = justMDBs;
this.warnings = warnings;
this.classTargetSelector = classTargetSelector; this.classTargetSelector = classTargetSelector;
ClassLoaderReference loader = scope.getApplicationLoader(); ClassLoaderReference loader = scope.getApplicationLoader();
@ -206,7 +203,7 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
} }
IMethod m = cha.resolveMethod(e); IMethod m = cha.resolveMethod(e);
if (m == null) { if (m == null) {
warnings.add(LoadFailure.create(e)); Warnings.add(LoadFailure.create(e));
return; return;
} }
entrypoints.add(new MDBEntrypoint(m, cha, T)); entrypoints.add(new MDBEntrypoint(m, cha, T));
@ -285,7 +282,7 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
} }
IMethod m = cha.resolveMethod(e); IMethod m = cha.resolveMethod(e);
if (m == null) { if (m == null) {
warnings.add(LoadFailure.create(m)); Warnings.add(LoadFailure.create(m));
continue; continue;
} }
entrypoints.add(new EJBLifecycleEntrypoint(m, cha, type)); entrypoints.add(new EJBLifecycleEntrypoint(m, cha, type));
@ -313,12 +310,12 @@ public class EJBEntrypoints implements Iterable<Entrypoint>, EJBConstants {
} }
final IClass klass = cha.lookupClass(interfaceType); final IClass klass = cha.lookupClass(interfaceType);
if (klass == null) { if (klass == null) {
warnings.add(LoadFailure.create(interfaceType)); Warnings.add(LoadFailure.create(interfaceType));
continue; continue;
} }
IMethod m = cha.resolveMethod(klass, target.getSelector()); IMethod m = cha.resolveMethod(klass, target.getSelector());
if (m == null) { if (m == null) {
warnings.add(LoadFailure.create(target)); Warnings.add(LoadFailure.create(target));
continue; continue;
} }
entrypoints.add(new DefaultEntrypoint(m, cha) { 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.types.TypeReference;
import com.ibm.wala.util.Atom; import com.ibm.wala.util.Atom;
import com.ibm.wala.util.warnings.ResolutionFailure; 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. * This class provides context selection logic for special J2EE methods.
* *
* @author sfink * @author sfink
@ -52,11 +51,8 @@ public class J2EEContextSelector implements ContextSelector {
private final ReceiverTypeInferenceCache typeInference; private final ReceiverTypeInferenceCache typeInference;
private final WarningSet warnings; public J2EEContextSelector(ReceiverTypeInferenceCache typeInference) {
public J2EEContextSelector(ReceiverTypeInferenceCache typeInference, WarningSet warnings) {
this.typeInference = typeInference; this.typeInference = typeInference;
this.warnings = warnings;
} }
/** /**
@ -75,7 +71,7 @@ public class J2EEContextSelector implements ContextSelector {
TypeAbstraction type = R.getReceiverType(site); TypeAbstraction type = R.getReceiverType(site);
if (type == null) { if (type == null) {
// Type inference failed; raise a severe warning // Type inference failed; raise a severe warning
warnings.add(ResolutionFailure.create(caller, site)); Warnings.add(ResolutionFailure.create(caller, site));
return null; return null;
} }
return new JavaTypeContext(type); 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, * @see com.ibm.wala.ipa.callgraph.ContextSelector#contextIsIrrelevant(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.classLoader.CallSiteReference) * 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.callgraph.impl.ComposedEntrypoints;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.util.Atom; 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 * @param useEjbEntrypoints
* should the analysis assume external callers on the EJB interfaces? * 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) { boolean useEjbEntrypoints) {
ServletEntrypoints servletEntrypoints = new ServletEntrypoints(scope, cha); ServletEntrypoints servletEntrypoints = new ServletEntrypoints(scope, cha);
J2EEClassTargetSelector classTargetSelector = new J2EEClassTargetSelector(null, dmd, cha, cha.getLoader(scope.getLoader(Atom 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; EJBEntrypoints ejbEntrypoints = null;
if (useEjbEntrypoints) { if (useEjbEntrypoints) {
// pick up all ejb entrypoints // pick up all ejb entrypoints
ejbEntrypoints = new EJBEntrypoints(cha, scope, dmd, false, classTargetSelector, warnings); ejbEntrypoints = new EJBEntrypoints(cha, scope, dmd, false, classTargetSelector);
} else { } else {
// pick up only MDB EJB entrypoints // 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); entrypoints = new ComposedEntrypoints(servletEntrypoints, ejbEntrypoints);
appClientEntrypoints = new AppClientEntrypoints(scope, cha, warnings); appClientEntrypoints = new AppClientEntrypoints(scope, cha);
entrypoints = new ComposedEntrypoints(entrypoints, appClientEntrypoints); entrypoints = new ComposedEntrypoints(entrypoints, appClientEntrypoints);
if (USE_STRUTS_ACTIONS) { 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.Assertions;
import com.ibm.wala.util.debug.Trace; import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.ResolutionFailure; 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; private final ReceiverTypeInferenceCache typeInference;
/**
* An object which tracks warnings from analysis
*/
private final WarningSet warnings;
/** /**
* Governing analysis scope * Governing analysis scope
*/ */
@ -149,10 +144,9 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
} }
public J2EEMethodTargetSelector(AnalysisScope scope, MethodTargetSelector parent, DeploymentMetaData deployment, public J2EEMethodTargetSelector(AnalysisScope scope, MethodTargetSelector parent, DeploymentMetaData deployment,
IClassHierarchy cha, ReceiverTypeInferenceCache typeInference, WarningSet warnings) { IClassHierarchy cha, ReceiverTypeInferenceCache typeInference) {
this.scope = scope; this.scope = scope;
this.deployment = deployment; this.deployment = deployment;
this.warnings = warnings;
this.parent = parent; this.parent = parent;
this.cha = cha; this.cha = cha;
this.typeInference = typeInference; this.typeInference = typeInference;
@ -179,7 +173,7 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
// resolve the method via the class hierarchy first // resolve the method via the class hierarchy first
IMethod resolved = cha.resolveMethod(m); IMethod resolved = cha.resolveMethod(m);
if (resolved == null) { if (resolved == null) {
warnings.add(LoadFailure.create(m)); Warnings.add(LoadFailure.create(m));
return null; return null;
} }
m = resolved.getReference(); m = resolved.getReference();
@ -264,7 +258,7 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
// resolve the method via the class hierarchy first // resolve the method via the class hierarchy first
IMethod resolved = cha.resolveMethod(m); IMethod resolved = cha.resolveMethod(m);
if (resolved == null) { if (resolved == null) {
warnings.add(LoadFailure.create(m)); Warnings.add(LoadFailure.create(m));
return null; return null;
} }
m = resolved.getReference(); 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 // this is a problem ... the field is not navigable .... need to do
// something better, like // something better, like
// create a synthetic field. // create a synthetic field.
warnings.add(LoadFailure.create(field)); Warnings.add(LoadFailure.create(field));
return; return;
} }
TypeReference otherT = oppField.getFieldType(); TypeReference otherT = oppField.getFieldType();
@ -1105,7 +1099,7 @@ public class J2EEMethodTargetSelector implements MethodTargetSelector, BytecodeC
} }
if (type == null) { if (type == null) {
// Type inference failed; raise a severe warning // Type inference failed; raise a severe warning
warnings.add(ResolutionFailure.create(N, site)); Warnings.add(ResolutionFailure.create(N, site));
return null; return null;
} else { } else {
// Type inference succeeded; modify m to reflect the more specific // 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.ipa.cha.IClassHierarchy;
import com.ibm.wala.j2ee.DeploymentMetaData; import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope; 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 * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* @param keepPointsTo * @param keepPointsTo
* preserve PointsTo graph for posterity? * preserve PointsTo graph for posterity?
* *
*/ */
CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData dmd, 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; private boolean dependentJars = true;
protected J2EEAbstractAnalysisEngine() {} protected J2EEAbstractAnalysisEngine() {
}
protected CallGraphBuilder getCallGraphBuilder(ClassHierarchy cha, AnalysisOptions options) { protected CallGraphBuilder getCallGraphBuilder(ClassHierarchy cha, AnalysisOptions options) {
return ((CallGraphBuilderFactory) getCallGraphBuilderFactory()).make(options, cha, (J2EEAnalysisScope) getScope(), getDmd(), 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() { protected void buildAnalysisScope() {
buildAnalysisScope(null); buildAnalysisScope(null);
} }
/** /**
* Set up the AnalysisScope object * Set up the AnalysisScope object
*/ */
@ -86,7 +88,7 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
/** /**
* Add the application modules to the analyis scope. * Add the application modules to the analyis scope.
*/ */
@SuppressWarnings({ "restriction", "unchecked" }) @SuppressWarnings( { "restriction", "unchecked" })
protected void addApplicationModulesToScope() { protected void addApplicationModulesToScope() {
ClassLoaderReference app = scope.getApplicationLoader(); ClassLoaderReference app = scope.getApplicationLoader();
for (Iterator<Archive> it = moduleFiles.iterator(); it.hasNext();) { for (Iterator<Archive> it = moduleFiles.iterator(); it.hasNext();) {
@ -134,7 +136,7 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
/** /**
* @param dmd * @param dmd
* The dmd to set. * The dmd to set.
*/ */
protected void setDmd(DeploymentMetaData dmd) { protected void setDmd(DeploymentMetaData dmd) {
this.dmd = dmd; this.dmd = dmd;
@ -149,7 +151,7 @@ public abstract class J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine
/** /**
* @param dependentJars * @param dependentJars
* The dependentJars to set. * The dependentJars to set.
*/ */
public void setDependentJars(boolean dependentJars) { public void setDependentJars(boolean dependentJars) {
this.dependentJars = 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.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory; import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util; 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, public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings, boolean keepPointsTo) { DeploymentMetaData dmd, boolean keepPointsTo) {
return Util.makeRTABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings); 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.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory; import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util; import com.ibm.wala.j2ee.util.Util;
import com.ibm.wala.util.warnings.WarningSet;
/** /**
* @author sfink * @author sfink
@ -28,8 +27,8 @@ public class ZeroCFABuilderFactory
{ {
public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope, public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings, boolean keepPointsTo) { DeploymentMetaData dmd, boolean keepPointsTo) {
return Util.makeZeroCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings); 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.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory; import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util; 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, public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData dmd,
WarningSet warnings, boolean keepPointsTo) { boolean keepPointsTo) {
return Util.makeZeroContainerCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings); 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.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory; import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util; 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 * 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, public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope,
DeploymentMetaData dmd, WarningSet warnings, boolean keepPointsTo) { DeploymentMetaData dmd, boolean keepPointsTo) {
return Util.makeZeroOneCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings); 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.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory; import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.Util; 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, public CallGraphBuilder make(AnalysisOptions options, IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData dmd,
WarningSet warnings, boolean keepPointsTo) { boolean keepPointsTo) {
return Util.makeZeroOneContainerCFABuilder(options, cha, getClass().getClassLoader(), scope, dmd, warnings); 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.Atom;
import com.ibm.wala.util.collections.HashSetFactory; import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions; import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.warnings.WarningSet;
/** /**
* @author sfink * @author sfink
@ -49,246 +48,237 @@ public class Util {
* @return an RTA Call Graph builder. * @return an RTA Call Graph builder.
* *
* @param options * @param options
* options that govern call graph construction * options that govern call graph construction
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param cl * @param cl
* classloader that can find WALA resources * classloader that can find WALA resources
* @param scope * @param scope
* representation of the analysis scope * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
*/ */
public static CallGraphBuilder makeRTABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope, 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); addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null; ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null; SSAContextInterpreter appInterpreter = null;
if (dmd != null) { if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings); ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings); addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference, warnings); appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha, warnings); appInterpreter = new CommandInterpreter(cha);
} }
return new BasicRTABuilder(cha, warnings, options, appSelector, appInterpreter); return new BasicRTABuilder(cha, options, appSelector, appInterpreter);
} }
/** /**
* @param options * @param options
* options that govern call graph construction * options that govern call graph construction
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param cl * @param cl
* classloader that can find WALA resources * classloader that can find WALA resources
* @param scope * @param scope
* representation of the analysis scope * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings * @param warnings
* an object which tracks analysis warnings * an object which tracks analysis warnings
* @return a 0-CFA Call Graph Builder. * @return a 0-CFA Call Graph Builder.
*/ */
public static CFABuilder makeZeroCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope, 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); addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null; ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null; SSAContextInterpreter appInterpreter = null;
if (dmd != null) { if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings); ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings); addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference, warnings); appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha, warnings); appInterpreter = new CommandInterpreter(cha);
} }
return new ZeroXCFABuilder(cha, warnings, options, appSelector, appInterpreter, options.getReflectionSpec(), return new ZeroXCFABuilder(cha, options, appSelector, appInterpreter, options.getReflectionSpec(), ZeroXInstanceKeys.NONE);
ZeroXInstanceKeys.NONE);
} }
/** /**
* @param options * @param options
* options that govern call graph construction * options that govern call graph construction
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param cl * @param cl
* classloader that can find WALA resources * classloader that can find WALA resources
* @param scope * @param scope
* representation of the analysis scope * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings * @param warnings
* an object which tracks analysis warnings * an object which tracks analysis warnings
* @return a 1-CFA Call Graph Builder. * @return a 1-CFA Call Graph Builder.
*/ */
public static CallGraphBuilder makeOneCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, 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); addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null; ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null; SSAContextInterpreter appInterpreter = null;
if (dmd != null) { if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings); ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings); addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference, warnings); appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha, warnings); 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; return builder;
} }
/** /**
* @param options * @param options
* options that govern call graph construction * options that govern call graph construction
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param cl * @param cl
* classloader that can find WALA resources * classloader that can find WALA resources
* @param scope * @param scope
* representation of the analysis scope * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* @return a 0-1-CFA Call Graph Builder. * @return a 0-1-CFA Call Graph Builder.
* *
* This version uses the DEDUCED_PLUS_STRINGSTUFF policy to avoid * This version uses the DEDUCED_PLUS_STRINGSTUFF policy to avoid
* disambiguating uninteresting types. * disambiguating uninteresting types.
*/ */
public static CFABuilder makeZeroOneCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, AnalysisScope scope, 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); addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null; ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null; SSAContextInterpreter appInterpreter = null;
if (dmd != null) { if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings); ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings); addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference, warnings); appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha, warnings); 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.ALLOCATIONS | ZeroXInstanceKeys.SMUSH_MANY | ZeroXInstanceKeys.SMUSH_PRIMITIVE_HOLDERS
| ZeroXInstanceKeys.SMUSH_STRINGS | ZeroXInstanceKeys.SMUSH_THROWABLES); | ZeroXInstanceKeys.SMUSH_STRINGS | ZeroXInstanceKeys.SMUSH_THROWABLES);
} }
/** /**
* @param options * @param options
* options that govern call graph construction * options that govern call graph construction
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param cl * @param cl
* classloader that can find WALA resources * classloader that can find WALA resources
* @param scope * @param scope
* representation of the analysis scope * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* @return a 0-1-CFA Call Graph Builder. * @return a 0-1-CFA Call Graph Builder.
* *
* This version uses the ALL policy to disambiguate all allocation sites * This version uses the ALL policy to disambiguate all allocation sites
*/ */
public static CFABuilder makeZeroOneUnoptCFABuilder(AnalysisOptions options, ClassHierarchy cha, ClassLoader cl, 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); addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null; ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null; SSAContextInterpreter appInterpreter = null;
if (dmd != null) { if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings); ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings); addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference, warnings); appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha, warnings); 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.ALLOCATIONS);
} }
/** /**
* @param options * @param options
* options that govern call graph construction * options that govern call graph construction
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param cl * @param cl
* classloader that can find WALA resources * classloader that can find WALA resources
* @param scope * @param scope
* representation of the analysis scope * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings * @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 * @return a 0-CFA Call Graph Builder augmented with extra logic for
* containers * containers
*/ */
public static CFABuilder makeZeroContainerCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, 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); addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null; ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null; SSAContextInterpreter appInterpreter = null;
if (dmd != null) { if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings); ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings); addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference, warnings); appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha, warnings); 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 * @param options
* options that govern call graph construction * options that govern call graph construction
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @param cl * @param cl
* classloader that can find WALA resources * classloader that can find WALA resources
* @param scope * @param scope
* representation of the analysis scope * representation of the analysis scope
* @param dmd * @param dmd
* deployment descriptor abstraction * deployment descriptor abstraction
* @param warnings
* an object which tracks analysis warnings
* @return a 0-1-CFA Call Graph Builder augmented with extra logic for * @return a 0-1-CFA Call Graph Builder augmented with extra logic for
* containers * containers
*/ */
public static CFABuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, IClassHierarchy cha, ClassLoader cl, 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); addDefaultJ2EEBypassLogic(options, scope, cl, cha);
ContextSelector appSelector = null; ContextSelector appSelector = null;
SSAContextInterpreter appInterpreter = null; SSAContextInterpreter appInterpreter = null;
if (dmd != null) { if (dmd != null) {
ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options, warnings); ReceiverTypeInferenceCache typeInference = new ReceiverTypeInferenceCache(options);
addJ2EEBypassLogic(options, scope, dmd, cha, typeInference, warnings); addJ2EEBypassLogic(options, scope, dmd, cha, typeInference);
appSelector = new J2EEContextSelector(typeInference, warnings); appSelector = new J2EEContextSelector(typeInference);
appInterpreter = new CommandInterpreter(cha, warnings); 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, public static void addJ2EEBypassLogic(AnalysisOptions options, AnalysisScope scope, DeploymentMetaData dmd, IClassHierarchy cha,
ReceiverTypeInferenceCache typeInference, WarningSet warn) { ReceiverTypeInferenceCache typeInference) {
if (cha == null) { if (cha == null) {
throw new IllegalArgumentException("cha is 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); options.setSelector(ms);
ClassTargetSelector cs = new J2EEClassTargetSelector(options.getClassTargetSelector(), dmd, cha, cha.getLoader(scope ClassTargetSelector cs = new J2EEClassTargetSelector(options.getClassTargetSelector(), dmd, cha, cha.getLoader(scope
@ -299,7 +289,7 @@ public class Util {
/** /**
* @param bean * @param bean
* @param cha * @param cha
* governing class hierarchy * governing class hierarchy
* @return the Set of CMR fields for this bean, including inherited CMRs * @return the Set of CMR fields for this bean, including inherited CMRs
*/ */
public static Set<Object> getCMRFields(BeanMetaData bean, DeploymentMetaData dmd, ClassHierarchy cha) { public static Set<Object> getCMRFields(BeanMetaData bean, DeploymentMetaData dmd, ClassHierarchy cha) {

View File

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