Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Achim D. Brucker 2017-08-01 23:50:46 +01:00
commit 409ab78e36
121 changed files with 298 additions and 364 deletions

View File

@ -70,7 +70,7 @@ public class SourceDirCallGraph {
// options.setReflectionOptions(ReflectionOptions.NONE); // options.setReflectionOptions(ReflectionOptions.NONE);
AnalysisCache cache = new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory()); AnalysisCache cache = new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory());
//CallGraphBuilder builder = new ZeroCFABuilderFactory().make(options, cache, cha, scope, false); //CallGraphBuilder builder = new ZeroCFABuilderFactory().make(options, cache, cha, scope, false);
CallGraphBuilder<?> builder = new ZeroOneContainerCFABuilderFactory().make(options, cache, cha, scope, false); CallGraphBuilder<?> builder = new ZeroOneContainerCFABuilderFactory().make(options, cache, cha, scope);
System.out.println("building call graph..."); System.out.println("building call graph...");
CallGraph cg = builder.makeCallGraph(options, null); CallGraph cg = builder.makeCallGraph(options, null);
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();

View File

@ -33,7 +33,7 @@ public class ECJClassLoaderFactory extends ClassLoaderFactoryImpl {
} }
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent) { protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent) {
return new ECJSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha, false); return new ECJSourceLoaderImpl(classLoaderReference, parent, cha, false);
} }
} }

View File

@ -42,17 +42,16 @@ import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.classLoader.IClassLoader; import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class ECJSourceLoaderImpl extends JavaSourceLoaderImpl { public class ECJSourceLoaderImpl extends JavaSourceLoaderImpl {
private final boolean dump; private final boolean dump;
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) { public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
this(loaderRef, parent, exclusions, cha, false); this(loaderRef, parent, cha, false);
} }
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) { public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, exclusions, cha); super(loaderRef, parent, cha);
this.dump = dump; this.dump = dump;
} }

View File

@ -111,7 +111,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -23,7 +23,6 @@ import com.ibm.wala.cast.java.ssa.AstJavaInvokeInstruction;
import com.ibm.wala.cast.java.ssa.EnclosingObjectReference; import com.ibm.wala.cast.java.ssa.EnclosingObjectReference;
import com.ibm.wala.classLoader.IClass; import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.fixpoint.IVariable; import com.ibm.wala.fixpoint.IVariable;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.shrikeBT.IBinaryOpInstruction; import com.ibm.wala.shrikeBT.IBinaryOpInstruction;
import com.ibm.wala.ssa.IR; import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSABinaryOpInstruction; import com.ibm.wala.ssa.SSABinaryOpInstruction;
@ -98,8 +97,8 @@ public class AstJavaTypeInference extends AstTypeInference {
} }
public AstJavaTypeInference(IR ir, IClassHierarchy cha, boolean doPrimitives) { public AstJavaTypeInference(IR ir, boolean doPrimitives) {
super(ir, cha, JavaPrimitiveType.BOOLEAN, doPrimitives); super(ir, JavaPrimitiveType.BOOLEAN, doPrimitives);
} }
IClass getStringClass() { IClass getStringClass() {

View File

@ -173,6 +173,6 @@ public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends Ab
@Override @Override
protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) { protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make(options, cache, cha, scope, false); return new ZeroCFABuilderFactory().make(options, cache, cha, scope);
} }
} }

View File

@ -26,7 +26,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/ */
public class ZeroCFABuilderFactory { public class ZeroCFABuilderFactory {
public CallGraphBuilder make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope, boolean keepPointsTo) { public CallGraphBuilder make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) {
Util.addDefaultSelectors(options, cha); Util.addDefaultSelectors(options, cha);
Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha); Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
return new AstJavaZeroXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.NONE); return new AstJavaZeroXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.NONE);

View File

@ -25,7 +25,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/ */
public class ZeroOneContainerCFABuilderFactory { public class ZeroOneContainerCFABuilderFactory {
public CallGraphBuilder make(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope, boolean keepPointsTo) { public CallGraphBuilder make(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope) {
Util.addDefaultSelectors(options, cha); Util.addDefaultSelectors(options, cha);
Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha); Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
return new AstJavaZeroOneContainerCFABuilder(cha, options, cache, null, null); return new AstJavaZeroOneContainerCFABuilder(cha, options, cache, null, null);

View File

@ -96,8 +96,8 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
// //
// /////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////
protected TypeInference makeTypeInference(IR ir, IClassHierarchy cha) { protected TypeInference makeTypeInference(IR ir) {
TypeInference ti = new AstJavaTypeInference(ir, cha, false); TypeInference ti = new AstJavaTypeInference(ir, false);
if (DEBUG_TYPE_INFERENCE) { if (DEBUG_TYPE_INFERENCE) {
System.err.println(("IR of " + ir.getMethod())); System.err.println(("IR of " + ir.getMethod()));

View File

@ -46,7 +46,7 @@ public class AstJavaZeroOneContainerCFABuilder extends AstJavaCFABuilder {
setContextInterpreter(contextInterpreter); setContextInterpreter(contextInterpreter);
ZeroXInstanceKeys zik = makeInstanceKeys(cha, options, contextInterpreter); ZeroXInstanceKeys zik = makeInstanceKeys(cha, options, contextInterpreter);
setInstanceKeys(new JavaScopeMappingInstanceKeys(cha, this, zik)); setInstanceKeys(new JavaScopeMappingInstanceKeys(this, zik));
ContextSelector CCS = makeContainerContextSelector(cha, zik); ContextSelector CCS = makeContainerContextSelector(cha, zik);
DelegatingContextSelector DCS = new DelegatingContextSelector(CCS, contextSelector); DelegatingContextSelector DCS = new DelegatingContextSelector(CCS, contextSelector);

View File

@ -38,7 +38,7 @@ public class AstJavaZeroXCFABuilder extends AstJavaCFABuilder {
setContextSelector(contextSelector); setContextSelector(contextSelector);
setInstanceKeys(new JavaScopeMappingInstanceKeys(cha, this, new ZeroXInstanceKeys(options, cha, contextInterpreter, setInstanceKeys(new JavaScopeMappingInstanceKeys(this, new ZeroXInstanceKeys(options, cha, contextInterpreter,
instancePolicy))); instancePolicy)));
} }

View File

@ -25,13 +25,12 @@ import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey; import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKeyFactory; import com.ibm.wala.ipa.callgraph.propagation.InstanceKeyFactory;
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder; import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.util.collections.HashSetFactory; import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.collections.Pair; import com.ibm.wala.util.collections.Pair;
public class JavaScopeMappingInstanceKeys extends ScopeMappingInstanceKeys { public class JavaScopeMappingInstanceKeys extends ScopeMappingInstanceKeys {
public JavaScopeMappingInstanceKeys(IClassHierarchy cha, PropagationCallGraphBuilder builder, InstanceKeyFactory basic) { public JavaScopeMappingInstanceKeys(PropagationCallGraphBuilder builder, InstanceKeyFactory basic) {
super(builder, basic); super(builder, basic);
} }

View File

@ -66,7 +66,6 @@ import com.ibm.wala.shrikeCT.AnnotationsReader.ConstantElementValue;
import com.ibm.wala.shrikeCT.AnnotationsReader.ElementValue; import com.ibm.wala.shrikeCT.AnnotationsReader.ElementValue;
import com.ibm.wala.shrikeCT.ClassConstants; import com.ibm.wala.shrikeCT.ClassConstants;
import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAThrowInstruction;
import com.ibm.wala.ssa.SymbolTable; import com.ibm.wala.ssa.SymbolTable;
import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.Descriptor; import com.ibm.wala.types.Descriptor;
@ -78,7 +77,6 @@ import com.ibm.wala.types.TypeReference;
import com.ibm.wala.types.annotations.Annotation; import com.ibm.wala.types.annotations.Annotation;
import com.ibm.wala.util.collections.HashMapFactory; 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.config.SetOfClasses;
import com.ibm.wala.util.debug.Assertions; import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.strings.Atom; import com.ibm.wala.util.strings.Atom;
@ -483,14 +481,14 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/** BEGIN Custom change: Common superclass is optional */ /** BEGIN Custom change: Common superclass is optional */
public JavaSourceLoaderImpl(boolean existsCommonSuperClass, ClassLoaderReference loaderRef, IClassLoader parent, public JavaSourceLoaderImpl(boolean existsCommonSuperClass, ClassLoaderReference loaderRef, IClassLoader parent,
SetOfClasses exclusions, IClassHierarchy cha) { IClassHierarchy cha) {
super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha); super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha);
this.existsCommonSuperclass = existsCommonSuperClass; this.existsCommonSuperclass = existsCommonSuperClass;
} }
public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) { public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
// standard case: we have a common super class // standard case: we have a common super class
this(true, loaderRef, parent, exclusions, cha); this(true, loaderRef, parent, cha);
} }
/** END Custom change: Common superclass is optional */ /** END Custom change: Common superclass is optional */
@ -661,10 +659,6 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
public AstLexicalWrite LexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs) { public AstLexicalWrite LexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs) {
return new AstLexicalWrite(iindex, definer, globalName, type, rhs); return new AstLexicalWrite(iindex, definer, globalName, type, rhs);
} }
public SSAThrowInstruction NonExceptingThrowInstruction(int iindex, int exception) {
throw new UnsupportedOperationException();
}
} }
private static final InstructionFactory insts = new InstructionFactory(); private static final InstructionFactory insts = new InstructionFactory();

View File

@ -202,10 +202,6 @@ public class JavaCAst2IRTranslator extends AstTranslator {
processExceptions(call, context); processExceptions(call, context);
} }
protected void doGlobalRead(WalkContext context, int result, String name) {
Assertions.UNREACHABLE("doGlobalRead() called for Java code???");
}
@Override @Override
protected void doGlobalWrite(WalkContext context, String name, TypeReference type, int rval) { protected void doGlobalWrite(WalkContext context, String name, TypeReference type, int rval) {
Assertions.UNREACHABLE("doGlobalWrite() called for Java code???"); Assertions.UNREACHABLE("doGlobalWrite() called for Java code???");

View File

@ -111,7 +111,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -16,12 +16,7 @@ import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
import com.ibm.wala.classLoader.IMethod; import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.Language; import com.ibm.wala.classLoader.Language;
import com.ibm.wala.classLoader.SourceURLModule; import com.ibm.wala.classLoader.SourceURLModule;
import com.ibm.wala.ipa.callgraph.AnalysisCache; import com.ibm.wala.ipa.callgraph.*;
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
import com.ibm.wala.ipa.callgraph.impl.ComposedEntrypoints; import com.ibm.wala.ipa.callgraph.impl.ComposedEntrypoints;
import com.ibm.wala.ipa.cha.ClassHierarchyException; import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
@ -34,7 +29,7 @@ import com.ibm.wala.util.strings.Atom;
public class Driver { public class Driver {
public static void addDefaultDispatchLogic(AnalysisOptions options, AnalysisScope scope, IClassHierarchy cha, AnalysisCache cache) { public static void addDefaultDispatchLogic(AnalysisOptions options, IClassHierarchy cha) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha); com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
Map<Atom,MethodTargetSelector> methodTargetSelectors = HashMapFactory.make(); Map<Atom,MethodTargetSelector> methodTargetSelectors = HashMapFactory.make();
@ -52,7 +47,7 @@ public class Driver {
HybridAnalysisScope scope = new HybridAnalysisScope(); HybridAnalysisScope scope = new HybridAnalysisScope();
FileProvider files = new FileProvider(); FileProvider files = new FileProvider();
AnalysisScopeReader.read(scope, args[0], files.getFile("Java60RegressionExclusions.txt"), Driver.class.getClassLoader(), files); AnalysisScopeReader.read(scope, args[0], files.getFile("Java60RegressionExclusions.txt"), Driver.class.getClassLoader());
scope.addToScope( scope.addToScope(
scope.getJavaScriptLoader(), scope.getJavaScriptLoader(),
@ -81,7 +76,7 @@ public class Driver {
AnalysisCache cache = new AnalysisCacheImpl(factory); AnalysisCache cache = new AnalysisCacheImpl(factory);
addDefaultDispatchLogic(options, scope, cha, cache); addDefaultDispatchLogic(options, cha);
JavaJavaScriptHybridCallGraphBuilder b = new JavaJavaScriptHybridCallGraphBuilder(cha, options, cache); JavaJavaScriptHybridCallGraphBuilder b = new JavaJavaScriptHybridCallGraphBuilder(cha, options, cache);

View File

@ -86,7 +86,7 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
@ -111,7 +111,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -16,7 +16,6 @@ import com.ibm.wala.types.TypeReference;
public class JSPrimitiveType extends PrimitiveType { public class JSPrimitiveType extends PrimitiveType {
@SuppressWarnings("unused")
public static void init() { public static void init() {
new JSPrimitiveType(JavaScriptTypes.Undefined, -1); new JSPrimitiveType(JavaScriptTypes.Undefined, -1);

View File

@ -34,7 +34,7 @@ import com.ibm.wala.types.TypeReference;
public class JSTypeInference extends AstTypeInference { public class JSTypeInference extends AstTypeInference {
public JSTypeInference(IR ir, IClassHierarchy cha) { public JSTypeInference(IR ir, IClassHierarchy cha) {
super(ir, cha, new PointType(cha.lookupClass(JavaScriptTypes.Boolean)), true); super(ir, new PointType(cha.lookupClass(JavaScriptTypes.Boolean)), true);
} }
@Override @Override

View File

@ -83,11 +83,11 @@ public abstract class FieldBasedCallGraphBuilder {
this.options = options; this.options = options;
this.cache = iAnalysisCacheView; this.cache = iAnalysisCacheView;
this.constructors = new JavaScriptConstructorFunctions(cha); this.constructors = new JavaScriptConstructorFunctions(cha);
this.targetSelector = setupMethodTargetSelector(cha, constructors, options); this.targetSelector = setupMethodTargetSelector(constructors, options);
this.supportFullPointerAnalysis = supportFullPointerAnalysis; this.supportFullPointerAnalysis = supportFullPointerAnalysis;
} }
private static MethodTargetSelector setupMethodTargetSelector(IClassHierarchy cha, JavaScriptConstructorFunctions constructors2, AnalysisOptions options) { private static MethodTargetSelector setupMethodTargetSelector(JavaScriptConstructorFunctions constructors2, AnalysisOptions options) {
MethodTargetSelector result = new JavaScriptConstructTargetSelector(constructors2, options.getMethodTargetSelector()); MethodTargetSelector result = new JavaScriptConstructTargetSelector(constructors2, options.getMethodTargetSelector());
if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) { if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) {
result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result)); result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result));

View File

@ -75,7 +75,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
if(newEdge) { if(newEdge) {
// handle it // handle it
addEdge(flowgraph, edge.fst, edge.snd, monitor); addEdge(flowgraph, edge.fst, edge.snd);
// special handling of invocations of Function.prototype.call // special handling of invocations of Function.prototype.call
// TODO: since we've just added some edges to the flow graph, its transitive closure will be // TODO: since we've just added some edges to the flow graph, its transitive closure will be
@ -93,7 +93,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
} }
// add flow corresponding to a new call edge // add flow corresponding to a new call edge
private static void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, IProgressMonitor monitor) { private static void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee) {
VertexFactory factory = flowgraph.getVertexFactory(); VertexFactory factory = flowgraph.getVertexFactory();
JavaScriptInvoke invk = c.getInstruction(); JavaScriptInvoke invk = c.getInstruction();
FuncVertex caller = c.getCaller(); FuncVertex caller = c.getCaller();

View File

@ -111,7 +111,7 @@ public class FlowGraph implements Iterable<Vertex> {
public boolean test(Vertex t) { public boolean test(Vertex t) {
return t.accept(new AbstractVertexVisitor<Boolean>() { return t.accept(new AbstractVertexVisitor<Boolean>() {
@Override @Override
public Boolean visitVertex(Vertex vertex) { public Boolean visitVertex() {
return true; return true;
} }

View File

@ -16,67 +16,67 @@ package com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices;
* @author mschaefer * @author mschaefer
*/ */
public class AbstractVertexVisitor<T> implements VertexVisitor<T> { public class AbstractVertexVisitor<T> implements VertexVisitor<T> {
public T visitVertex(Vertex vertex) { public T visitVertex() {
return null; return null;
} }
@Override @Override
public T visitVarVertex(VarVertex varVertex) { public T visitVarVertex(VarVertex varVertex) {
return visitVertex(varVertex); return visitVertex();
} }
@Override @Override
public T visitPropVertex(PropVertex propVertex) { public T visitPropVertex(PropVertex propVertex) {
return visitVertex(propVertex); return visitVertex();
} }
@Override @Override
public T visitUnknownVertex(UnknownVertex unknownVertex) { public T visitUnknownVertex(UnknownVertex unknownVertex) {
return visitVertex(unknownVertex); return visitVertex();
} }
@Override @Override
public T visitFuncVertex(FuncVertex funcVertex) { public T visitFuncVertex(FuncVertex funcVertex) {
return visitVertex(funcVertex); return visitVertex();
} }
@Override @Override
public T visitCreationSiteVertex(CreationSiteVertex csVertex) { public T visitCreationSiteVertex(CreationSiteVertex csVertex) {
return visitVertex(csVertex); return visitVertex();
} }
@Override @Override
public T visitParamVertex(ParamVertex paramVertex) { public T visitParamVertex(ParamVertex paramVertex) {
return visitVertex(paramVertex); return visitVertex();
} }
@Override @Override
public T visitRetVertex(RetVertex retVertex) { public T visitRetVertex(RetVertex retVertex) {
return visitVertex(retVertex); return visitVertex();
} }
@Override @Override
public T visitArgVertex(ArgVertex argVertex) { public T visitArgVertex(ArgVertex argVertex) {
return visitVertex(argVertex); return visitVertex();
} }
@Override @Override
public T visitCalleeVertex(CallVertex calleeVertex) { public T visitCalleeVertex(CallVertex calleeVertex) {
return visitVertex(calleeVertex); return visitVertex();
} }
@Override @Override
public T visitLexicalAccessVertex(LexicalVarVertex lexicalAccessVertex) { public T visitLexicalAccessVertex(LexicalVarVertex lexicalAccessVertex) {
return visitVertex(lexicalAccessVertex); return visitVertex();
} }
@Override @Override
public T visitGlobalVertex(GlobalVertex globalVertex) { public T visitGlobalVertex(GlobalVertex globalVertex) {
return visitVertex(globalVertex); return visitVertex();
} }
@Override @Override
public T visitPrototypeVertex(PrototypeFieldVertex protoVertex) { public T visitPrototypeVertex(PrototypeFieldVertex protoVertex) {
return visitVertex(protoVertex); return visitVertex();
} }
} }

View File

@ -189,7 +189,7 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
@Override @Override
protected CallGraphBuilder<InstanceKey> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) { protected CallGraphBuilder<InstanceKey> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make((JSAnalysisOptions) options, cache, cha, scope, false); return new ZeroCFABuilderFactory().make((JSAnalysisOptions) options, cache, cha);
} }
} }

View File

@ -14,7 +14,6 @@ import com.ibm.wala.cast.ipa.callgraph.StandardFunctionTargetSelector;
import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions; import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder; import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder;
import com.ibm.wala.ipa.callgraph.AnalysisCache; import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder; import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey; import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys; import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
@ -27,8 +26,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/ */
public class OneCFABuilderFactory { public class OneCFABuilderFactory {
public CallGraphBuilder<InstanceKey> make(JSAnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope, public CallGraphBuilder<InstanceKey> make(JSAnalysisOptions options, AnalysisCache cache, IClassHierarchy cha) {
boolean keepPointsTo) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha); com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector())); options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()));

View File

@ -13,7 +13,6 @@ package com.ibm.wala.cast.js.client.impl;
import com.ibm.wala.cast.ipa.callgraph.StandardFunctionTargetSelector; import com.ibm.wala.cast.ipa.callgraph.StandardFunctionTargetSelector;
import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions; import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder; import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder; import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView; import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys; import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
@ -26,8 +25,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/ */
public class ZeroCFABuilderFactory { public class ZeroCFABuilderFactory {
public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope, public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha) {
boolean keepPointsTo) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha); com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector())); options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()));

View File

@ -116,7 +116,7 @@ public class DefaultSourceExtractor extends DomLessSourceExtractor{
for (Map.Entry<String, Pair<String, Position>> e : attrs.entrySet()){ for (Map.Entry<String, Pair<String, Position>> e : attrs.entrySet()){
String attr = e.getKey(); String attr = e.getKey();
String value = e.getValue().fst; String value = e.getValue().fst;
writeAttribute(tag, e.getValue().snd, attr, value, "this", varName); writeAttribute(tag, attr, value, "this", varName);
} }
if (tag.getName().equalsIgnoreCase("FORM")) { if (tag.getName().equalsIgnoreCase("FORM")) {
@ -143,7 +143,7 @@ public class DefaultSourceExtractor extends DomLessSourceExtractor{
} }
} }
inputElementCallback(tag); inputElementCallback();
} }
assert varName != null && !"".equals(varName); assert varName != null && !"".equals(varName);
@ -152,16 +152,16 @@ public class DefaultSourceExtractor extends DomLessSourceExtractor{
printlnIndented("parent.appendChild(this);", tag); printlnIndented("parent.appendChild(this);", tag);
} }
protected void inputElementCallback(ITag tag) { protected void inputElementCallback() {
// this space intentionally left blank // this space intentionally left blank
} }
protected void writeAttribute(ITag tag, Position pos, String attr, String value, String varName, String varName2) { protected void writeAttribute(ITag tag, String attr, String value, String varName, String varName2) {
writePortletAttribute(tag, attr, value, varName); writePortletAttribute(tag, attr, value, varName);
writeEventAttribute(tag, pos, attr, value, varName, varName2); writeEventAttribute(tag, attr, value, varName, varName2);
} }
protected void writeEventAttribute(ITag tag, Position pos, String attr, String value, String varName, String varName2){ protected void writeEventAttribute(ITag tag, String attr, String value, String varName, String varName2){
//There should probably be more checking to see what the attributes are since we allow things like: ; to be used as attributes now. //There should probably be more checking to see what the attributes are since we allow things like: ; to be used as attributes now.
if(attr.length() >= 2 && attr.substring(0,2).equals("on")) { if(attr.length() >= 2 && attr.substring(0,2).equals("on")) {
printlnIndented(varName + "." + attr + " = function " + tag.getName().toLowerCase() + "_" + attr + "(event) {" + value + "};", tag); printlnIndented(varName + "." + attr + " = function " + tag.getName().toLowerCase() + "_" + attr + "(event) {" + value + "};", tag);

View File

@ -88,11 +88,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
writeEntrypoint("window.onload();"); writeEntrypoint("window.onload();");
} }
protected Position makePos(int lineNumber, ITag governingTag) { protected Position makePos(ITag governingTag) {
return makePos(entrypointUrl, lineNumber, governingTag);
}
protected Position makePos(final URL url, final int lineNumber, ITag governingTag) {
return governingTag.getElementPosition(); return governingTag.getElementPosition();
} }

View File

@ -20,7 +20,6 @@ import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IR; import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAAbstractInvokeInstruction; import com.ibm.wala.ssa.SSAAbstractInvokeInstruction;
import com.ibm.wala.types.MethodReference;
/** /**
* generates instructions to simulate the semantics of JS constructor invocations * generates instructions to simulate the semantics of JS constructor invocations
@ -54,11 +53,7 @@ public class JavaScriptConstructTargetSelector implements MethodTargetSelector {
} }
} }
public boolean mightReturnSyntheticMethod(CGNode caller, CallSiteReference site) { public boolean mightReturnSyntheticMethod() {
return true;
}
public boolean mightReturnSyntheticMethod(MethodReference declaredTarget) {
return true; return true;
} }
} }

View File

@ -135,7 +135,7 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
return callModels.get(key); return callModels.get(key);
} }
JSInstructionFactory insts = (JSInstructionFactory) receiver.getClassLoader().getInstructionFactory(); JSInstructionFactory insts = (JSInstructionFactory) receiver.getClassLoader().getInstructionFactory();
MethodReference ref = genSyntheticMethodRef(receiver, nargs, key); MethodReference ref = genSyntheticMethodRef(receiver, key);
JavaScriptSummary S = new JavaScriptSummary(ref, nargs); JavaScriptSummary S = new JavaScriptSummary(ref, nargs);
if(WARN_ABOUT_IMPRECISE_CALLGRAPH && caller.getMethod().getName().toString().contains(SYNTHETIC_CALL_METHOD_PREFIX)) if(WARN_ABOUT_IMPRECISE_CALLGRAPH && caller.getMethod().getName().toString().contains(SYNTHETIC_CALL_METHOD_PREFIX))
@ -175,7 +175,7 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
public static final String SYNTHETIC_CALL_METHOD_PREFIX = "$$ call_"; public static final String SYNTHETIC_CALL_METHOD_PREFIX = "$$ call_";
private static MethodReference genSyntheticMethodRef(IClass receiver, int nargs, String key) { private static MethodReference genSyntheticMethodRef(IClass receiver, String key) {
Atom atom = Atom.findOrCreateUnicodeAtom(SYNTHETIC_CALL_METHOD_PREFIX + key); Atom atom = Atom.findOrCreateUnicodeAtom(SYNTHETIC_CALL_METHOD_PREFIX + key);
Descriptor desc = Descriptor.findOrCreateUTF8(JavaScriptLoader.JS, "()LRoot;"); Descriptor desc = Descriptor.findOrCreateUTF8(JavaScriptLoader.JS, "()LRoot;");
MethodReference ref = MethodReference.findOrCreate(receiver.getReference(), atom, desc); MethodReference ref = MethodReference.findOrCreate(receiver.getReference(), atom, desc);

View File

@ -229,14 +229,14 @@ public abstract class CAstRewriterExt extends CAstRewriter<NodePos, NoKey> {
enterEntity(root); enterEntity(root);
CAstEntity entity = super.rewrite(root); CAstEntity entity = super.rewrite(root);
rewrite_cache.put(root, entity); rewrite_cache.put(root, entity);
leaveEntity(root); leaveEntity();
entities.pop(); entities.pop();
return entity; return entity;
} }
} }
protected void enterEntity(CAstEntity entity) {} protected void enterEntity(@SuppressWarnings("unused") CAstEntity entity) {}
protected void leaveEntity(CAstEntity entity) {} protected void leaveEntity() {}
public CAstRewriterExt(CAst Ast, boolean recursive, NodePos rootContext) { public CAstRewriterExt(CAst Ast, boolean recursive, NodePos rootContext) {
super(Ast, recursive, rootContext); super(Ast, recursive, rootContext);

View File

@ -200,7 +200,7 @@ public class ClosureExtractor extends CAstRewriterExt {
} }
@Override @Override
protected void leaveEntity(CAstEntity entity) { protected void leaveEntity() {
policies.pop(); policies.pop();
} }
@ -210,7 +210,7 @@ public class ClosureExtractor extends CAstRewriterExt {
case OPERATOR: case OPERATOR:
return root; return root;
case CONSTANT: case CONSTANT:
return copyConstant(root, cfg, context, nodeMap); return copyConstant(root, context, nodeMap);
case BLOCK_STMT: case BLOCK_STMT:
return copyBlock(root, cfg, context, nodeMap); return copyBlock(root, cfg, context, nodeMap);
case RETURN: case RETURN:
@ -225,7 +225,7 @@ public class ClosureExtractor extends CAstRewriterExt {
} }
/* Constants are not affected by the rewriting, they are just copied. */ /* Constants are not affected by the rewriting, they are just copied. */
private CAstNode copyConstant(CAstNode root, CAstControlFlowMap cfg, NodePos context, Map<Pair<CAstNode, NoKey>, CAstNode> nodeMap) { private CAstNode copyConstant(CAstNode root, NodePos context, Map<Pair<CAstNode, NoKey>, CAstNode> nodeMap) {
CAstNode newNode = Ast.makeConstant(root.getValue()); CAstNode newNode = Ast.makeConstant(root.getValue());
nodeMap.put(Pair.make(root, context.key()), newNode); nodeMap.put(Pair.make(root, context.key()), newNode);
return newNode; return newNode;

View File

@ -89,12 +89,12 @@ public class CallGraph2JSON {
public static void serializeCallSite(AstMethod method, CallSiteReference callsite, Set<IMethod> targets, public static void serializeCallSite(AstMethod method, CallSiteReference callsite, Set<IMethod> targets,
Map<String, Set<String>> edges) { Map<String, Set<String>> edges) {
Set<String> targetNames = MapUtil.findOrCreateSet(edges, ppPos(method, method.getSourcePosition(callsite.getProgramCounter()))); Set<String> targetNames = MapUtil.findOrCreateSet(edges, ppPos(method.getSourcePosition(callsite.getProgramCounter())));
for(IMethod target : targets) { for(IMethod target : targets) {
target = getCallTargetMethod(target); target = getCallTargetMethod(target);
if(!isRealFunction(target)) if(!isRealFunction(target))
continue; continue;
targetNames.add(ppPos((AstMethod)target, ((AstMethod)target).getSourcePosition())); targetNames.add(ppPos(((AstMethod)target).getSourcePosition()));
} }
} }
@ -126,7 +126,7 @@ public class CallGraph2JSON {
return false; return false;
} }
private static String ppPos(AstMethod method, Position pos) { private static String ppPos(Position pos) {
String file = pos.getURL().getFile(); String file = pos.getURL().getFile();
file = file.substring(file.lastIndexOf('/')+1); file = file.substring(file.lastIndexOf('/')+1);

View File

@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
@ -112,7 +112,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -23,7 +23,6 @@ import com.ibm.wala.cast.ir.ssa.AstLexicalRead;
import com.ibm.wala.cast.ir.ssa.AstLexicalWrite; import com.ibm.wala.cast.ir.ssa.AstLexicalWrite;
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction; import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction; import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IR; import com.ibm.wala.ssa.IR;
public abstract class AstTypeInference extends TypeInference { public abstract class AstTypeInference extends TypeInference {
@ -75,7 +74,7 @@ public abstract class AstTypeInference extends TypeInference {
} }
} }
public AstTypeInference(IR ir, IClassHierarchy cha, TypeAbstraction booleanType, boolean doPrimitives) { public AstTypeInference(IR ir, TypeAbstraction booleanType, boolean doPrimitives) {
super(ir, doPrimitives); super(ir, doPrimitives);
this.booleanType = booleanType; this.booleanType = booleanType;
} }

View File

@ -17,10 +17,7 @@ import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.classLoader.CodeScanner; import com.ibm.wala.classLoader.CodeScanner;
import com.ibm.wala.classLoader.IMethod; import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference; import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.AnalysisOptions; import com.ibm.wala.ipa.callgraph.*;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ContextInsensitiveSSAInterpreter; import com.ibm.wala.ipa.callgraph.propagation.cfa.ContextInsensitiveSSAInterpreter;
import com.ibm.wala.ssa.IR; import com.ibm.wala.ssa.IR;
import com.ibm.wala.util.collections.EmptyIterator; import com.ibm.wala.util.collections.EmptyIterator;
@ -37,7 +34,7 @@ public class AstContextInsensitiveSSAContextInterpreter extends ContextInsensiti
super(options, cache); super(options, cache);
} }
public boolean understands(IMethod method, Context context) { public boolean understands(IMethod method) {
return method instanceof AstMethod; return method instanceof AstMethod;
} }

View File

@ -18,19 +18,8 @@ import java.util.Set;
import com.ibm.wala.analysis.reflection.ReflectionContextInterpreter; import com.ibm.wala.analysis.reflection.ReflectionContextInterpreter;
import com.ibm.wala.cast.ipa.callgraph.AstCallGraph.AstCGNode; import com.ibm.wala.cast.ipa.callgraph.AstCallGraph.AstCGNode;
import com.ibm.wala.cast.ipa.callgraph.ScopeMappingInstanceKeys.ScopeMappingInstanceKey; import com.ibm.wala.cast.ipa.callgraph.ScopeMappingInstanceKeys.ScopeMappingInstanceKey;
import com.ibm.wala.cast.ir.ssa.AstAssertInstruction; import com.ibm.wala.cast.ir.ssa.*;
import com.ibm.wala.cast.ir.ssa.AstEchoInstruction;
import com.ibm.wala.cast.ir.ssa.AstGlobalRead;
import com.ibm.wala.cast.ir.ssa.AstGlobalWrite;
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
import com.ibm.wala.cast.ir.ssa.AstInstructionVisitor;
import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction;
import com.ibm.wala.cast.ir.ssa.AstLexicalAccess;
import com.ibm.wala.cast.ir.ssa.AstLexicalAccess.Access; import com.ibm.wala.cast.ir.ssa.AstLexicalAccess.Access;
import com.ibm.wala.cast.ir.ssa.AstLexicalRead;
import com.ibm.wala.cast.ir.ssa.AstLexicalWrite;
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.cast.ir.translator.AstTranslator; import com.ibm.wala.cast.ir.translator.AstTranslator;
import com.ibm.wala.cast.loader.AstMethod; import com.ibm.wala.cast.loader.AstMethod;
import com.ibm.wala.cast.loader.AstMethod.LexicalInformation; import com.ibm.wala.cast.loader.AstMethod.LexicalInformation;
@ -102,6 +91,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
* each language can specify whether a particular field name should be stored * each language can specify whether a particular field name should be stored
* in object catalogs or not. By default, always return false. * in object catalogs or not. By default, always return false.
*/ */
@SuppressWarnings("unused")
protected boolean isUncataloguedField(IClass type, String fieldName) { protected boolean isUncataloguedField(IClass type, String fieldName) {
return false; return false;
} }
@ -357,8 +347,8 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
return ((AstPointerKeyFactory) getBuilder().getPointerKeyFactory()).getPointerKeysForReflectedFieldWrite(I, F); return ((AstPointerKeyFactory) getBuilder().getPointerKeyFactory()).getPointerKeysForReflectedFieldWrite(I, F);
} }
private static void visitLexical(AstLexicalAccess instruction, final LexicalOperator op) { private static void visitLexical(final LexicalOperator op) {
op.doLexicalPointerKeys(false); op.doLexicalPointerKeys();
// I have no idea what the code below does, but commenting it out doesn't // I have no idea what the code below does, but commenting it out doesn't
// break any regression tests. --MS // break any regression tests. --MS
// if (! checkLexicalInstruction(instruction)) { // if (! checkLexicalInstruction(instruction)) {
@ -370,7 +360,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
@Override @Override
public void visitAstLexicalRead(AstLexicalRead instruction) { public void visitAstLexicalRead(AstLexicalRead instruction) {
visitLexical(instruction, new LexicalOperator((AstCGNode) node, instruction.getAccesses(), true) { visitLexical(new LexicalOperator((AstCGNode) node, instruction.getAccesses(), true) {
@Override @Override
protected void action(PointerKey lexicalKey, int vn) { protected void action(PointerKey lexicalKey, int vn) {
PointerKey lval = getPointerKeyForLocal(vn); PointerKey lval = getPointerKeyForLocal(vn);
@ -400,7 +390,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
@Override @Override
public void visitAstLexicalWrite(AstLexicalWrite instruction) { public void visitAstLexicalWrite(AstLexicalWrite instruction) {
visitLexical(instruction, new LexicalOperator((AstCGNode) node, instruction.getAccesses(), false) { visitLexical(new LexicalOperator((AstCGNode) node, instruction.getAccesses(), false) {
@Override @Override
protected void action(PointerKey lexicalKey, int vn) { protected void action(PointerKey lexicalKey, int vn) {
PointerKey rval = getPointerKeyForLocal(vn); PointerKey rval = getPointerKeyForLocal(vn);
@ -618,7 +608,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
* {@link AstConstraintVisitor#handleRootLexicalReference(String, String, CGNode)} * {@link AstConstraintVisitor#handleRootLexicalReference(String, String, CGNode)}
* . * .
*/ */
private void doLexicalPointerKeys(boolean funargsOnly) { private void doLexicalPointerKeys() {
for (int i = 0; i < accesses.length; i++) { for (int i = 0; i < accesses.length; i++) {
final String name = accesses[i].variableName; final String name = accesses[i].variableName;
final String definer = accesses[i].variableDefiner; final String definer = accesses[i].variableDefiner;
@ -640,7 +630,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
@Override @Override
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
doLexicalPointerKeys(true); doLexicalPointerKeys();
return NOT_CHANGED; return NOT_CHANGED;
} }

View File

@ -81,7 +81,7 @@ public abstract class ScriptEntryPoints implements Iterable<Entrypoint> {
protected abstract CallSiteReference makeScriptSite(IMethod m, int pc); protected abstract CallSiteReference makeScriptSite(IMethod m, int pc);
protected boolean keep(IMethod method) { protected boolean keep() {
return true; return true;
} }
@ -93,7 +93,7 @@ public abstract class ScriptEntryPoints implements Iterable<Entrypoint> {
IClass cls = classes.next(); IClass cls = classes.next();
if (cha.isSubclassOf(cls, scriptType) && !cls.isAbstract()) { if (cha.isSubclassOf(cls, scriptType) && !cls.isAbstract()) {
for (IMethod method : cls.getDeclaredMethods()) { for (IMethod method : cls.getDeclaredMethods()) {
if (keep(method)) { if (keep()) {
ES.add(new ScriptEntryPoint(method)); ES.add(new ScriptEntryPoint(method));
} }
} }
@ -107,7 +107,7 @@ public abstract class ScriptEntryPoints implements Iterable<Entrypoint> {
IClass cls = cha.lookupClass(TypeReference.findOrCreate(scriptType.getClassLoader().getReference(), scriptName)); IClass cls = cha.lookupClass(TypeReference.findOrCreate(scriptType.getClassLoader().getReference(), scriptName));
assert cls != null && cha.isSubclassOf(cls, scriptType) && !cls.isAbstract() : String.valueOf(cls) + " for " + scriptName; assert cls != null && cha.isSubclassOf(cls, scriptType) && !cls.isAbstract() : String.valueOf(cls) + " for " + scriptName;
for (IMethod method : cls.getDeclaredMethods()) { for (IMethod method : cls.getDeclaredMethods()) {
if (keep(method)) { if (keep()) {
return new ScriptEntryPoint(method); return new ScriptEntryPoint(method);
} }
} }

View File

@ -19,7 +19,6 @@ import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.MethodTargetSelector; import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference; import com.ibm.wala.types.TypeReference;
public class StandardFunctionTargetSelector implements MethodTargetSelector { public class StandardFunctionTargetSelector implements MethodTargetSelector {
@ -67,11 +66,7 @@ public class StandardFunctionTargetSelector implements MethodTargetSelector {
} }
} }
public boolean mightReturnSyntheticMethod(CGNode caller, CallSiteReference site) { public boolean mightReturnSyntheticMethod() {
return true;
}
public boolean mightReturnSyntheticMethod(MethodReference declaredTarget) {
return true; return true;
} }
} }

View File

@ -426,7 +426,7 @@ public abstract class AbstractSSAConversion {
return newDefs; return newDefs;
} }
protected boolean skipRepair(SSAInstruction inst, int index) { protected boolean skipRepair(SSAInstruction inst, @SuppressWarnings("unused") int index) {
if (inst == null) if (inst == null)
return true; return true;
for (int i = 0; i < getNumberOfDefs(inst); i++) for (int i = 0; i < getNumberOfDefs(inst); i++)

View File

@ -36,7 +36,7 @@ import com.ibm.wala.types.TypeReference;
public class AstIRFactory<T extends IMethod> implements IRFactory<T> { public class AstIRFactory<T extends IMethod> implements IRFactory<T> {
public ControlFlowGraph<?, ?> makeCFG(final IMethod method, final Context context) { public ControlFlowGraph<?, ?> makeCFG(final IMethod method) {
return ((AstMethod) method).getControlFlowGraph(); return ((AstMethod) method).getControlFlowGraph();
} }
@ -63,7 +63,7 @@ public class AstIRFactory<T extends IMethod> implements IRFactory<T> {
@Override @Override
public ControlFlowGraph makeCFG(IMethod method, Context context) { public ControlFlowGraph makeCFG(IMethod method, Context context) {
if (method instanceof AstMethod) { if (method instanceof AstMethod) {
return astFactory.makeCFG(method, context); return astFactory.makeCFG(method);
} else { } else {
return super.makeCFG(method, context); return super.makeCFG(method, context);
} }

View File

@ -245,8 +245,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
* an object literal (e.g., PHP). This method should be overridden to handle * an object literal (e.g., PHP). This method should be overridden to handle
* such cases. * such cases.
*/ */
protected void handleUnspecifiedLiteralKey(WalkContext context, CAstNode objectLiteralNode, int unspecifiedLiteralIndex, protected void handleUnspecifiedLiteralKey() {
CAstVisitor<WalkContext> visitor) {
Assertions.UNREACHABLE(); Assertions.UNREACHABLE();
} }
@ -409,7 +408,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
/** /**
* generate instructions for a read of a global * generate instructions for a read of a global
*/ */
protected int doGlobalRead(CAstNode node, WalkContext context, String name, TypeReference type) { protected int doGlobalRead(@SuppressWarnings("unused") CAstNode node, WalkContext context, String name, TypeReference type) {
// Global variables can be treated as lexicals defined in the CG root, or // Global variables can be treated as lexicals defined in the CG root, or
if (treatGlobalsAsLexicallyScoped()) { if (treatGlobalsAsLexicallyScoped()) {
@ -450,6 +449,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
/** /**
* generate instructions to check if ref has field, storing answer in result * generate instructions to check if ref has field, storing answer in result
*/ */
@SuppressWarnings("unused")
protected void doIsFieldDefined(WalkContext context, int result, int ref, CAstNode field) { protected void doIsFieldDefined(WalkContext context, int result, int ref, CAstNode field) {
Assertions.UNREACHABLE(); Assertions.UNREACHABLE();
} }
@ -1945,7 +1945,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
}; };
} }
private Scope makeLocalScope(CAstNode s, final Scope parent) { private Scope makeLocalScope(final Scope parent) {
return new AbstractScope(parent) { return new AbstractScope(parent) {
@Override @Override
public ScopeType type() { public ScopeType type() {
@ -3111,7 +3111,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
} }
} }
protected String[] makeNameMap(CAstEntity n, Set<Scope> scopes, SSAInstruction[] insts) { protected String[] makeNameMap(CAstEntity n, Set<Scope> scopes, @SuppressWarnings("unused") SSAInstruction[] insts) {
// all scopes share the same underlying symtab, which is what // all scopes share the same underlying symtab, which is what
// size really refers to. // size really refers to.
String[] map = new String[scopes.iterator().next().size() + 1]; String[] map = new String[scopes.iterator().next().size() + 1];
@ -3252,7 +3252,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
if (n.getAST() == null) // presumably abstract if (n.getAST() == null) // presumably abstract
declareFunction(n, context); declareFunction(n, context);
else else
initFunctionEntity(n, context, codeContext); initFunctionEntity(codeContext);
return false; return false;
} }
@ -3270,7 +3270,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
@Override @Override
protected boolean visitScriptEntity(CAstEntity n, WalkContext context, WalkContext codeContext, CAstVisitor<WalkContext> visitor) { protected boolean visitScriptEntity(CAstEntity n, WalkContext context, WalkContext codeContext, CAstVisitor<WalkContext> visitor) {
declareFunction(n, codeContext); declareFunction(n, codeContext);
initFunctionEntity(n, context, codeContext); initFunctionEntity(codeContext);
return false; return false;
} }
@ -3279,7 +3279,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
closeFunctionEntity(n, context, codeContext); closeFunctionEntity(n, context, codeContext);
} }
public void initFunctionEntity(final CAstEntity n, WalkContext parentContext, WalkContext functionContext) { public void initFunctionEntity(WalkContext functionContext) {
// entry block // entry block
functionContext.cfg().makeEntryBlock(functionContext.cfg().newBlock(false)); functionContext.cfg().makeEntryBlock(functionContext.cfg().newBlock(false));
// first real block // first real block
@ -3323,7 +3323,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
@Override @Override
protected WalkContext makeLocalContext(WalkContext context, CAstNode n) { protected WalkContext makeLocalContext(WalkContext context, CAstNode n) {
return new LocalContext(context, makeLocalScope(n, context.currentScope())); return new LocalContext(context, makeLocalScope(context.currentScope()));
} }
@ -3935,7 +3935,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
protected void leaveObjectLiteralFieldInit(CAstNode n, int i, WalkContext c, CAstVisitor<WalkContext> visitor) { protected void leaveObjectLiteralFieldInit(CAstNode n, int i, WalkContext c, CAstVisitor<WalkContext> visitor) {
WalkContext context = c; WalkContext context = c;
if (n.getChild(i).getKind() == CAstNode.EMPTY) { if (n.getChild(i).getKind() == CAstNode.EMPTY) {
handleUnspecifiedLiteralKey(context, n, i, visitor); handleUnspecifiedLiteralKey();
} }
doFieldWrite(context, c.getValue(n.getChild(0)), n.getChild(i), n, c.getValue(n.getChild(i + 1))); doFieldWrite(context, c.getValue(n.getChild(0)), n.getChild(i), n, c.getValue(n.getChild(i + 1)));
} }
@ -4005,7 +4005,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
} }
/* Prereq: a.getKind() == ASSIGN_PRE_OP || a.getKind() == ASSIGN_POST_OP */ /* Prereq: a.getKind() == ASSIGN_PRE_OP || a.getKind() == ASSIGN_POST_OP */
protected int processAssignOp(CAstNode n, CAstNode v, CAstNode a, int temp, boolean post, WalkContext c) { protected int processAssignOp(CAstNode v, CAstNode a, int temp, WalkContext c) {
WalkContext context = c; WalkContext context = c;
int rval = c.getValue(v); int rval = c.getValue(v);
CAstNode op = a.getChild(2); CAstNode op = a.getChild(2);
@ -4047,7 +4047,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
int temp = context.currentScope().allocateTempValue(); int temp = context.currentScope().allocateTempValue();
int[] dims = gatherArrayDims(c, n); int[] dims = gatherArrayDims(c, n);
arrayOpHandler.doArrayRead(context, temp, c.getValue(n.getChild(0)), n, dims); arrayOpHandler.doArrayRead(context, temp, c.getValue(n.getChild(0)), n, dims);
int rval = processAssignOp(n, v, a, temp, !pre, c); int rval = processAssignOp(v, a, temp, c);
c.setValue(n, pre ? rval : temp); c.setValue(n, pre ? rval : temp);
arrayOpHandler.doArrayWrite(context, c.getValue(n.getChild(0)), n, dims, rval); arrayOpHandler.doArrayWrite(context, c.getValue(n.getChild(0)), n, dims, rval);
} }
@ -4065,9 +4065,6 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
doFieldWrite(context, c.getValue(n.getChild(0)), n.getChild(1), n, rval); doFieldWrite(context, c.getValue(n.getChild(0)), n.getChild(1), n, rval);
} }
protected void processObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, WalkContext c) {
}
@Override @Override
protected boolean visitObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, WalkContext c, CAstVisitor<WalkContext> visitor) { /* empty */ protected boolean visitObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, WalkContext c, CAstVisitor<WalkContext> visitor) { /* empty */
return false; return false;
@ -4078,7 +4075,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
WalkContext context = c; WalkContext context = c;
int temp = context.currentScope().allocateTempValue(); int temp = context.currentScope().allocateTempValue();
doFieldRead(context, temp, c.getValue(n.getChild(0)), n.getChild(1), n); doFieldRead(context, temp, c.getValue(n.getChild(0)), n.getChild(1), n);
int rval = processAssignOp(n, v, a, temp, !pre, c); int rval = processAssignOp(v, a, temp, c);
c.setValue(n, pre ? rval : temp); c.setValue(n, pre ? rval : temp);
doFieldWrite(context, c.getValue(n.getChild(0)), n.getChild(1), n, rval); doFieldWrite(context, c.getValue(n.getChild(0)), n.getChild(1), n, rval);
} }
@ -4159,7 +4156,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
c.setValue(n, ret); c.setValue(n, ret);
} }
int rval = processAssignOp(n, v, a, temp, !pre, c); int rval = processAssignOp(v, a, temp, c);
if (pre) { if (pre) {
c.setValue(n, rval); c.setValue(n, rval);

View File

@ -133,6 +133,7 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
* rewritten AST? By default, just uses the original target. * rewritten AST? By default, just uses the original target.
* *
*/ */
@SuppressWarnings("unused")
protected CAstNode flowOutTo(Map<Pair<CAstNode, K>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget, protected CAstNode flowOutTo(Map<Pair<CAstNode, K>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget,
CAstControlFlowMap orig, CAstSourcePositionMap src) { CAstControlFlowMap orig, CAstSourcePositionMap src) {
return oldTarget; return oldTarget;
@ -307,7 +308,7 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
} }
} }
protected Map<CAstNode, Collection<CAstEntity>> copyChildren(CAstNode root, Map<Pair<CAstNode, K>, CAstNode> nodeMap, protected Map<CAstNode, Collection<CAstEntity>> copyChildren(@SuppressWarnings("unused") CAstNode root, Map<Pair<CAstNode, K>, CAstNode> nodeMap,
Map<CAstNode, Collection<CAstEntity>> children) { Map<CAstNode, Collection<CAstEntity>> children) {
final Map<CAstNode, Collection<CAstEntity>> newChildren = new LinkedHashMap<>(); final Map<CAstNode, Collection<CAstEntity>> newChildren = new LinkedHashMap<>();

View File

@ -86,7 +86,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param context a visitor-specific context in which the unwind was visited * @param context a visitor-specific context in which the unwind was visited
* @param n the unwind node * @param n the unwind node
*/ */
protected C makeUnwindContext(C context, CAstNode n, CAstVisitor<C> visitor) { return context; } protected C makeUnwindContext(C context, CAstNode n, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return context; }
private final Map<CAstEntity, CAstEntity> entityParents = HashMapFactory.make(); private final Map<CAstEntity, CAstEntity> entityParents = HashMapFactory.make();
@ -114,6 +114,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* Should invoke super.doVisitEntity() for unprocessed entities. * Should invoke super.doVisitEntity() for unprocessed entities.
* @return true if entity was handled * @return true if entity was handled
*/ */
@SuppressWarnings("unused")
protected boolean doVisitEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { protected boolean doVisitEntity(CAstEntity n, C context, CAstVisitor<C> visitor) {
return false; return false;
} }
@ -239,13 +240,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param context a visitor-specific context * @param context a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean enterEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { return false; } protected boolean enterEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
/** /**
* Post-process an entity after visiting it. * Post-process an entity after visiting it.
* @param n the entity to process * @param n the entity to process
* @param context a visitor-specific context * @param context a visitor-specific context
*/ */
protected void postProcessEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { return; } protected void postProcessEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
/** /**
* Visit any entity. Override only this to change behavior for all entities. * Visit any entity. Override only this to change behavior for all entities.
@ -253,13 +254,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param context a visitor-specific context * @param context a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
public boolean visitEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { return false; } public boolean visitEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
/** /**
* Leave any entity. Override only this to change behavior for all entities. * Leave any entity. Override only this to change behavior for all entities.
* @param n the entity to process * @param n the entity to process
* @param context a visitor-specific context * @param context a visitor-specific context
*/ */
public void leaveEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { return; } public void leaveEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
/** /**
* Visit a File entity. * Visit a File entity.
@ -371,6 +372,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* *
* @return true if node was handled * @return true if node was handled
*/ */
@SuppressWarnings("unused")
protected boolean doVisit(CAstNode n, C context, CAstVisitor<C> visitor) { protected boolean doVisit(CAstNode n, C context, CAstVisitor<C> visitor) {
return false; return false;
} }
@ -384,7 +386,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* *
* @return true if node was handled * @return true if node was handled
*/ */
protected boolean doVisitAssignNodes(CAstNode n, C context, CAstNode v, CAstNode a, CAstVisitor<C> visitor) { protected boolean doVisitAssignNodes() {
return false; return false;
} }
@ -889,7 +891,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
visitor.leaveNode(n, context, visitor); visitor.leaveNode(n, context, visitor);
} }
protected C makeSpecialParentContext(C context, CAstNode n) { protected C makeSpecialParentContext(C context, @SuppressWarnings("unused") CAstNode n) {
return context; return context;
} }
@ -966,7 +968,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
} }
default: { default: {
if (!visitor.doVisitAssignNodes(n, context, v, a, visitor)) { if (!visitor.doVisitAssignNodes()) {
if (DEBUG) { if (DEBUG) {
System.err.println(("cannot handle assign to kind " + n.getKind())); System.err.println(("cannot handle assign to kind " + n.getKind()));
} }
@ -983,13 +985,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean enterNode(CAstNode n, C c, CAstVisitor<C> visitor) { return false; } protected boolean enterNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
/** /**
* Post-process a node after visiting it. * Post-process a node after visiting it.
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void postProcessNode(CAstNode n, C c, CAstVisitor<C> visitor) { return; } protected void postProcessNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
/** /**
* Visit any node. Override only this to change behavior for all nodes. * Visit any node. Override only this to change behavior for all nodes.
@ -997,13 +999,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
public boolean visitNode(CAstNode n, C c, CAstVisitor<C> visitor) { return false; } public boolean visitNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
/** /**
* Leave any node. Override only this to change behavior for all nodes. * Leave any node. Override only this to change behavior for all nodes.
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
public void leaveNode(CAstNode n, C c, CAstVisitor<C> visitor) { return; } public void leaveNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
/** /**
* Visit a FunctionExpr node. * Visit a FunctionExpr node.
@ -1089,7 +1091,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveLoopHeader(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveLoopHeader(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Leave a Loop node. * Leave a Loop node.
* @param n the node to process * @param n the node to process
@ -1309,13 +1311,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveIfStmtCondition(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveIfStmtCondition(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit an IfStmt node after processing the true clause. * Visit an IfStmt node after processing the true clause.
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveIfStmtTrueClause(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveIfStmtTrueClause(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Leave an IfStmt node. * Leave an IfStmt node.
* @param n the node to process * @param n the node to process
@ -1334,13 +1336,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveIfExprCondition(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveIfExprCondition(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit an IfExpr node after processing the true clause. * Visit an IfExpr node after processing the true clause.
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveIfExprTrueClause(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveIfExprTrueClause(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Leave an IfExpr node. * Leave an IfExpr node.
* @param n the node to process * @param n the node to process
@ -1373,7 +1375,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param i the field position that was initialized * @param i the field position that was initialized
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveObjectLiteralFieldInit(CAstNode n, int i, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveObjectLiteralFieldInit(CAstNode n, int i, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Leave an ObjectLiteral node. * Leave an ObjectLiteral node.
* @param n the node to process * @param n the node to process
@ -1392,14 +1394,14 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveArrayLiteralObject(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveArrayLiteralObject(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit an ArrayLiteral node after processing the {i}th element initializer. * Visit an ArrayLiteral node after processing the {i}th element initializer.
* @param n the node to process * @param n the node to process
* @param i the index that was initialized * @param i the index that was initialized
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveArrayLiteralInitElement(CAstNode n, int i, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveArrayLiteralInitElement(CAstNode n, int i, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Leave a ArrayLiteral node. * Leave a ArrayLiteral node.
* @param n the node to process * @param n the node to process
@ -1440,7 +1442,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitArrayRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitArrayRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit an ArrayRef Assignment node after visiting the LHS. * Visit an ArrayRef Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1448,7 +1450,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param a the assignment node to process * @param a the assignment node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveArrayRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveArrayRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit an ArrayRef Op/Assignment node after visiting the RHS. * Visit an ArrayRef Op/Assignment node after visiting the RHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1458,7 +1460,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitArrayRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitArrayRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit an ArrayRef Op/Assignment node after visiting the LHS. * Visit an ArrayRef Op/Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1467,7 +1469,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param pre whether the value before the operation should be used * @param pre whether the value before the operation should be used
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveArrayRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveArrayRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit an ObjectRef Assignment node after visiting the RHS. * Visit an ObjectRef Assignment node after visiting the RHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1476,7 +1478,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitObjectRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitObjectRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit an ObjectRef Assignment node after visiting the LHS. * Visit an ObjectRef Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1484,7 +1486,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param a the assignment node to process * @param a the assignment node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveObjectRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveObjectRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit an ObjectRef Op/Assignment node after visiting the RHS. * Visit an ObjectRef Op/Assignment node after visiting the RHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1494,7 +1496,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit an ObjectRef Op/Assignment node after visiting the LHS. * Visit an ObjectRef Op/Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1503,7 +1505,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param pre whether the value before the operation should be used * @param pre whether the value before the operation should be used
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit a BlockExpr Assignment node after visiting the RHS. * Visit a BlockExpr Assignment node after visiting the RHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1512,7 +1514,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitBlockExprAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitBlockExprAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit a BlockExpr Assignment node after visiting the LHS. * Visit a BlockExpr Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1520,7 +1522,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param a the assignment node to process * @param a the assignment node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveBlockExprAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveBlockExprAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit a BlockExpr Op/Assignment node after visiting the RHS. * Visit a BlockExpr Op/Assignment node after visiting the RHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1530,7 +1532,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitBlockExprAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitBlockExprAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit a BlockExpr Op/Assignment node after visiting the LHS. * Visit a BlockExpr Op/Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1539,7 +1541,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param pre whether the value before the operation should be used * @param pre whether the value before the operation should be used
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveBlockExprAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveBlockExprAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit a Var Assignment node after visiting the RHS. * Visit a Var Assignment node after visiting the RHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1548,7 +1550,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitVarAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitVarAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit a Var Assignment node after visiting the LHS. * Visit a Var Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1556,7 +1558,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param a the assignment node to process * @param a the assignment node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveVarAssign(CAstNode n, CAstNode v, CAstNode a, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveVarAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit a Var Op/Assignment node after visiting the RHS. * Visit a Var Op/Assignment node after visiting the RHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1566,7 +1568,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context * @param c a visitor-specific context
* @return true if no further processing is needed * @return true if no further processing is needed
*/ */
protected boolean visitVarAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ return false; } protected boolean visitVarAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
/** /**
* Visit a Var Op/Assignment node after visiting the LHS. * Visit a Var Op/Assignment node after visiting the LHS.
* @param n the LHS node to process * @param n the LHS node to process
@ -1575,7 +1577,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param pre whether the value before the operation should be used * @param pre whether the value before the operation should be used
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveVarAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveVarAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Visit a Switch node. * Visit a Switch node.
* @param n the node to process * @param n the node to process
@ -1588,7 +1590,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveSwitchValue(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveSwitchValue(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Leave a Switch node. * Leave a Switch node.
* @param n the node to process * @param n the node to process
@ -1646,7 +1648,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param n the node to process * @param n the node to process
* @param c a visitor-specific context * @param c a visitor-specific context
*/ */
protected void leaveTryBlock(CAstNode n, C c, CAstVisitor<C> visitor) { /* empty */ } protected void leaveTryBlock(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
/** /**
* Leave a Try node. * Leave a Try node.
* @param n the node to process * @param n the node to process

View File

@ -111,7 +111,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -223,13 +223,13 @@ public class CallGraphTest extends WalaTestCase {
@Test public void testIO() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { @Test public void testIO() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope("primordial.txt", CallGraphTestUtil.REGRESSION_EXCLUSIONS); AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope("primordial.txt", CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchyFactory.make(scope); ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = makePrimordialPublicEntrypoints(scope, cha, "java/io"); Iterable<Entrypoint> entrypoints = makePrimordialPublicEntrypoints(cha, "java/io");
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false); CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
} }
public static Iterable<Entrypoint> makePrimordialPublicEntrypoints(AnalysisScope scope, ClassHierarchy cha, String pkg) { public static Iterable<Entrypoint> makePrimordialPublicEntrypoints(ClassHierarchy cha, String pkg) {
final HashSet<Entrypoint> result = HashSetFactory.make(); final HashSet<Entrypoint> result = HashSetFactory.make();
for (IClass clazz : cha) { for (IClass clazz : cha) {
@ -262,7 +262,7 @@ public class CallGraphTest extends WalaTestCase {
"Java60RegressionExclusions.txt": "Java60RegressionExclusions.txt":
"GUIExclusions.txt"); "GUIExclusions.txt");
ClassHierarchy cha = ClassHierarchyFactory.make(scope); ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = makePrimordialMainEntrypoints(scope, cha); Iterable<Entrypoint> entrypoints = makePrimordialMainEntrypoints(cha);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false); CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
@ -288,7 +288,7 @@ public class CallGraphTest extends WalaTestCase {
/** /**
* make main entrypoints, even in the primordial loader. * make main entrypoints, even in the primordial loader.
*/ */
public static Iterable<Entrypoint> makePrimordialMainEntrypoints(AnalysisScope scope, ClassHierarchy cha) { public static Iterable<Entrypoint> makePrimordialMainEntrypoints(ClassHierarchy cha) {
final Atom mainMethod = Atom.findOrCreateAsciiAtom("main"); final Atom mainMethod = Atom.findOrCreateAsciiAtom("main");
final HashSet<Entrypoint> result = HashSetFactory.make(); final HashSet<Entrypoint> result = HashSetFactory.make();
for (IClass klass : cha) { for (IClass klass : cha) {

View File

@ -77,7 +77,7 @@ public class ScopeFileCallGraph {
System.out.println(Warnings.asString()); System.out.println(Warnings.asString());
Warnings.clear(); Warnings.clear();
AnalysisOptions options = new AnalysisOptions(); AnalysisOptions options = new AnalysisOptions();
Iterable<Entrypoint> entrypoints = entryClass != null ? makePublicEntrypoints(scope, cha, entryClass) : Util.makeMainEntrypoints(scope, cha, mainClass); Iterable<Entrypoint> entrypoints = entryClass != null ? makePublicEntrypoints(cha, entryClass) : Util.makeMainEntrypoints(scope, cha, mainClass);
options.setEntrypoints(entrypoints); options.setEntrypoints(entrypoints);
// you can dial down reflection handling if you like // you can dial down reflection handling if you like
// options.setReflectionOptions(ReflectionOptions.NONE); // options.setReflectionOptions(ReflectionOptions.NONE);
@ -97,7 +97,7 @@ public class ScopeFileCallGraph {
System.out.println(CallGraphStats.getStats(cg)); System.out.println(CallGraphStats.getStats(cg));
} }
private static Iterable<Entrypoint> makePublicEntrypoints(AnalysisScope scope, IClassHierarchy cha, String entryClass) { private static Iterable<Entrypoint> makePublicEntrypoints(IClassHierarchy cha, String entryClass) {
Collection<Entrypoint> result = new ArrayList<>(); Collection<Entrypoint> result = new ArrayList<>();
IClass klass = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, IClass klass = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application,
StringStuff.deployment2CanonicalTypeString(entryClass))); StringStuff.deployment2CanonicalTypeString(entryClass)));

View File

@ -96,7 +96,7 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
@ -121,7 +121,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -40,7 +40,7 @@ public class IntraproceduralNullPointerAnalysis {
final NullPointerFrameWork<ISSABasicBlock> problem = new NullPointerFrameWork<ISSABasicBlock>( final NullPointerFrameWork<ISSABasicBlock> problem = new NullPointerFrameWork<ISSABasicBlock>(
cfg, ir); cfg, ir);
this.solver = new NullPointerSolver<ISSABasicBlock>(problem, maxVarNum, this.solver = new NullPointerSolver<ISSABasicBlock>(problem, maxVarNum,
paramValNum, ir, cfg.entry()); ir, cfg.entry());
try { try {
this.solver.solve(NO_PROGRESS_MONITOR); this.solver.solve(NO_PROGRESS_MONITOR);
} catch (final CancelException e) { } catch (final CancelException e) {

View File

@ -245,7 +245,7 @@ public class CloneInterpreter implements SSAContextInterpreter {
public Set getCaughtExceptions(CGNode node) { public Set getCaughtExceptions(CGNode node) {
SSAInstruction[] statements = getIR(node).getInstructions(); SSAInstruction[] statements = getIR(node).getInstructions();
return CodeScanner.getCaughtExceptions(node.getMethod().getDeclaringClass().getClassLoader().getLanguage(), statements); return CodeScanner.getCaughtExceptions(statements);
} }
public boolean hasObjectArrayLoad(CGNode node) { public boolean hasObjectArrayLoad(CGNode node) {

View File

@ -66,7 +66,7 @@ public class GetMethodContextSelector implements ContextSelector {
*/ */
@Override @Override
public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey[] receiver) { public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey[] receiver) {
if (receiver != null && receiver.length > 0 && mayUnderstand(caller, site, callee, receiver[0])) { if (receiver != null && receiver.length > 0 && mayUnderstand(callee, receiver[0])) {
if (DEBUG) { if (DEBUG) {
System.out.print("site := " + site + ", receiver := " + receiver[0]); System.out.print("site := " + site + ", receiver := " + receiver[0]);
} }
@ -147,7 +147,7 @@ public class GetMethodContextSelector implements ContextSelector {
* This object understands a dispatch to {@link java.lang.Class#getMethod(String, Class...)} * This object understands a dispatch to {@link java.lang.Class#getMethod(String, Class...)}
* or {@link java.lang.Class#getDeclaredMethod} when the receiver is a type constant. * or {@link java.lang.Class#getDeclaredMethod} when the receiver is a type constant.
*/ */
private static boolean mayUnderstand(CGNode caller,CallSiteReference site,IMethod targetMethod,InstanceKey instance) { private static boolean mayUnderstand(IMethod targetMethod,InstanceKey instance) {
return UNDERSTOOD_METHOD_REFS.contains(targetMethod.getReference()) return UNDERSTOOD_METHOD_REFS.contains(targetMethod.getReference())
&& getTypeConstant(instance) != null; && getTypeConstant(instance) != null;
} }

View File

@ -50,7 +50,7 @@ class JavaLangClassContextSelector implements ContextSelector {
*/ */
@Override @Override
public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) { public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) {
if (receiver != null && receiver.length > 0 && mayUnderstand(caller, site, callee, receiver[0])) { if (receiver != null && receiver.length > 0 && mayUnderstand(callee, receiver[0])) {
return new JavaTypeContext(new PointType(getTypeConstant(receiver[0]))); return new JavaTypeContext(new PointType(getTypeConstant(receiver[0])));
} }
return null; return null;
@ -82,7 +82,7 @@ class JavaLangClassContextSelector implements ContextSelector {
/** /**
* This object may understand a dispatch to Class.getContructor when the receiver is a type constant. * This object may understand a dispatch to Class.getContructor when the receiver is a type constant.
*/ */
private static boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance) { private static boolean mayUnderstand(IMethod targetMethod, InstanceKey instance) {
return UNDERSTOOD_METHOD_REFS.contains(targetMethod.getReference()) && getTypeConstant(instance) != null; return UNDERSTOOD_METHOD_REFS.contains(targetMethod.getReference()) && getTypeConstant(instance) != null;
} }

View File

@ -49,7 +49,7 @@ class ReflectiveInvocationSelector implements ContextSelector {
*/ */
@Override @Override
public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) { public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) {
if (receiver == null || receiver.length == 0 || !mayUnderstand(caller, site, callee, receiver[0])) { if (receiver == null || receiver.length == 0 || !mayUnderstand(callee, receiver[0])) {
return null; return null;
} }
IR ir = caller.getIR(); IR ir = caller.getIR();
@ -105,7 +105,7 @@ class ReflectiveInvocationSelector implements ContextSelector {
/** /**
* This object may understand a dispatch to Constructor.newInstance(). * This object may understand a dispatch to Constructor.newInstance().
*/ */
private static boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance) { private static boolean mayUnderstand(IMethod targetMethod, InstanceKey instance) {
if (instance instanceof ConstantKey) { if (instance instanceof ConstantKey) {
if (targetMethod.getReference().equals(ReflectiveInvocationInterpreter.METHOD_INVOKE) || if (targetMethod.getReference().equals(ReflectiveInvocationInterpreter.METHOD_INVOKE) ||
isConstructorConstant(instance) isConstructorConstant(instance)

View File

@ -82,7 +82,7 @@ public class ControlDependenceGraph<T> extends AbstractNumberedGraph<T> {
for (Iterator<? extends T> ss = cfg.getSuccNodes(x); ss.hasNext();) { for (Iterator<? extends T> ss = cfg.getSuccNodes(x); ss.hasNext();) {
T s = ss.next(); T s = ss.next();
if (RDF.isDominatedBy(s, y)) { if (RDF.isDominatedBy(s, y)) {
labels.add(makeEdgeLabel(x, y, s)); labels.add(makeEdgeLabel(s));
} }
} }
} }
@ -92,7 +92,7 @@ public class ControlDependenceGraph<T> extends AbstractNumberedGraph<T> {
return controlDependence; return controlDependence;
} }
protected Object makeEdgeLabel(T x, T y, T s) { protected Object makeEdgeLabel(T s) {
return s; return s;
} }

View File

@ -137,7 +137,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
final NullPointerFrameWork<T> problem = new NullPointerFrameWork<T>(cfg, ir); final NullPointerFrameWork<T> problem = new NullPointerFrameWork<T>(cfg, ir);
final int[] paramValNum = ir.getParameterValueNumbers(); final int[] paramValNum = ir.getParameterValueNumbers();
solver = new NullPointerSolver<T>(problem, maxVarNum, paramValNum, cfg.entry(), ir, initialState); solver = new NullPointerSolver<T>(problem, maxVarNum, cfg.entry(), ir, initialState);
solver.solve(progress); solver.solve(progress);

View File

@ -28,11 +28,11 @@ public class NullPointerSolver<B extends ISSABasicBlock> extends DataflowSolver<
private final B entry; private final B entry;
private final IR ir; private final IR ir;
public NullPointerSolver(NullPointerFrameWork<B> problem, int maxVarNum, int[] paramVarNum, IR ir, B entry) { public NullPointerSolver(NullPointerFrameWork<B> problem, int maxVarNum, IR ir, B entry) {
this(problem, maxVarNum, paramVarNum, entry, ir, ParameterState.createDefault(ir.getMethod())); this(problem, maxVarNum, entry, ir, ParameterState.createDefault(ir.getMethod()));
} }
public NullPointerSolver(NullPointerFrameWork<B> problem, int maxVarNum, int[] paramVarNum, B entry, IR ir, ParameterState initialState) { public NullPointerSolver(NullPointerFrameWork<B> problem, int maxVarNum, B entry, IR ir, ParameterState initialState) {
super(problem); super(problem);
this.maxVarNum = maxVarNum; this.maxVarNum = maxVarNum;
this.parameterState = initialState; this.parameterState = initialState;

View File

@ -320,7 +320,7 @@ public class ClassLoaderImpl implements IClassLoader {
JarInputStream s = new JarInputStream(new ByteArrayInputStream(jarFileContents), false); JarInputStream s = new JarInputStream(new ByteArrayInputStream(jarFileContents), false);
JarEntry entry = null; JarEntry entry = null;
while ((entry = s.getNextJarEntry()) != null) { while ((entry = s.getNextJarEntry()) != null) {
byte[] entryBytes = getEntryBytes(entry, entrySizesForFile.get(entry.getName()), s); byte[] entryBytes = getEntryBytes(entrySizesForFile.get(entry.getName()), s);
if (entryBytes == null) { if (entryBytes == null) {
return null; return null;
} }
@ -345,7 +345,7 @@ public class ClassLoaderImpl implements IClassLoader {
return result; return result;
} }
private static byte[] getEntryBytes(JarEntry entry, Long size, InputStream is) throws IOException { private static byte[] getEntryBytes(Long size, InputStream is) throws IOException {
if (size == null) { if (size == null) {
return null; return null;
} }

View File

@ -148,7 +148,7 @@ public class CodeScanner {
} }
if (m.isSynthetic()) { if (m.isSynthetic()) {
SyntheticMethod sm = (SyntheticMethod) m; SyntheticMethod sm = (SyntheticMethod) m;
return getCaughtExceptions(m.getDeclaringClass().getClassLoader().getLanguage(), sm.getStatements()); return getCaughtExceptions(sm.getStatements());
} else { } else {
return getShrikeBTCaughtExceptions((ShrikeCTMethod) m); return getShrikeBTCaughtExceptions((ShrikeCTMethod) m);
} }
@ -245,7 +245,7 @@ public class CodeScanner {
* @return {@link Set}&lt;{@link TypeReference}&gt; * @return {@link Set}&lt;{@link TypeReference}&gt;
* @throws IllegalArgumentException if statements == null * @throws IllegalArgumentException if statements == null
*/ */
public static Set<TypeReference> getCaughtExceptions(final Language l, SSAInstruction[] statements) throws IllegalArgumentException { public static Set<TypeReference> getCaughtExceptions(SSAInstruction[] statements) throws IllegalArgumentException {
if (statements == null) { if (statements == null) {
throw new IllegalArgumentException("statements == null"); throw new IllegalArgumentException("statements == null");
} }

View File

@ -464,7 +464,7 @@ public final class ShrikeCTMethod extends ShrikeBTMethod implements IBytecodeMet
final ClassLoaderReference clRef = getDeclaringClass().getClassLoader().getReference(); final ClassLoaderReference clRef = getDeclaringClass().getClassLoader().getReference();
return TypeAnnotation.getTypeAnnotationsFromReader( return TypeAnnotation.getTypeAnnotationsFromReader(
r, r,
TypeAnnotation.targetConverterAtMethodInfo(clRef, this), TypeAnnotation.targetConverterAtMethodInfo(clRef),
clRef clRef
); );
} }

View File

@ -410,7 +410,7 @@ public final class ShrikeClass extends JVMClass<IClassLoader> {
final ClassLoaderReference clRef = getClassLoader().getReference(); final ClassLoaderReference clRef = getClassLoader().getReference();
return TypeAnnotation.getTypeAnnotationsFromReader( return TypeAnnotation.getTypeAnnotationsFromReader(
r, r,
TypeAnnotation.targetConverterAtFieldInfo(clRef), TypeAnnotation.targetConverterAtFieldInfo(),
clRef clRef
); );
} }

View File

@ -38,7 +38,7 @@ public class ShrikeIRFactory implements IRFactory<IBytecodeMethod> {
public final static boolean buildLocalMap = true; public final static boolean buildLocalMap = true;
public ControlFlowGraph makeCFG(final IBytecodeMethod method, Context C) { public ControlFlowGraph makeCFG(final IBytecodeMethod method) {
return ShrikeCFG.make(method); return ShrikeCFG.make(method);
} }
@ -54,7 +54,7 @@ public class ShrikeIRFactory implements IRFactory<IBytecodeMethod> {
} catch (InvalidClassFileException e) { } catch (InvalidClassFileException e) {
throw new WalaRuntimeException("bad method bytecodes", e); throw new WalaRuntimeException("bad method bytecodes", e);
} }
final ShrikeCFG shrikeCFG = (ShrikeCFG) makeCFG(method, C); final ShrikeCFG shrikeCFG = (ShrikeCFG) makeCFG(method);
final SymbolTable symbolTable = new SymbolTable(method.getNumberOfParameters()); final SymbolTable symbolTable = new SymbolTable(method.getNumberOfParameters());
final SSAInstruction[] newInstrs = new SSAInstruction[shrikeInstructions.length]; final SSAInstruction[] newInstrs = new SSAInstruction[shrikeInstructions.length];

View File

@ -271,7 +271,7 @@ public class SyntheticMethod implements IMethod {
* @param options options governing SSA construction * @param options options governing SSA construction
*/ */
@Deprecated @Deprecated
public SSAInstruction[] getStatements(SSAOptions options) { public SSAInstruction[] getStatements(@SuppressWarnings("unused") SSAOptions options) {
return NO_STATEMENTS; return NO_STATEMENTS;
} }

View File

@ -41,13 +41,6 @@ public class IdentityFlowFunctions<T> implements IFlowFunctionMap<T> {
return IdentityFlowFunction.identity(); return IdentityFlowFunction.identity();
} }
/*
* @see com.ibm.wala.dataflow.IFDS.IFlowFunctionMap#getReturnFlowFunction(java.lang.Object, java.lang.Object, java.lang.Object)
*/
public IFlowFunction getReturnFlowFunction(T src, T dest) {
return IdentityFlowFunction.identity();
}
/* /*
* @see com.ibm.wala.dataflow.IFDS.IFlowFunctionMap#getCallToReturnFlowFunction(java.lang.Object, java.lang.Object) * @see com.ibm.wala.dataflow.IFDS.IFlowFunctionMap#getCallToReturnFlowFunction(java.lang.Object, java.lang.Object)
*/ */

View File

@ -61,7 +61,7 @@ public class PartiallyBalancedTabulationSolver<T, P, F> extends TabulationSolver
T fakeEntry = problem.getFakeEntry(retSite); T fakeEntry = problem.getFakeEntry(retSite);
PathEdge<T> seed = PathEdge.createPathEdge(fakeEntry, d3, retSite, d3); PathEdge<T> seed = PathEdge.createPathEdge(fakeEntry, d3, retSite, d3);
addSeed(seed); addSeed(seed);
newUnbalancedExplodedReturnEdge(s_p, i, n, j, seed); newUnbalancedExplodedReturnEdge(s_p, i, n, j);
} }
} }
} else { } else {
@ -95,7 +95,8 @@ public class PartiallyBalancedTabulationSolver<T, P, F> extends TabulationSolver
* So, we added a new seed callerSeed (to some return site) in the caller. To be overridden * So, we added a new seed callerSeed (to some return site) in the caller. To be overridden
* in subclasses. * in subclasses.
*/ */
protected void newUnbalancedExplodedReturnEdge(T s_p, int i, T n, int j, PathEdge<T> callerSeed) { @SuppressWarnings("unused")
protected void newUnbalancedExplodedReturnEdge(T s_p, int i, T n, int j) {
} }
} }

View File

@ -1055,6 +1055,7 @@ public class TabulationSolver<T, P, F> {
* @return set of d1 s.t. (n1,d1) -&gt; (n2,d2) is recorded as a summary edge, or null if none found * @return set of d1 s.t. (n1,d1) -&gt; (n2,d2) is recorded as a summary edge, or null if none found
* @throws UnsupportedOperationException unconditionally * @throws UnsupportedOperationException unconditionally
*/ */
@SuppressWarnings("unused")
public IntSet getSummarySources(T n2, int d2, T n1) throws UnsupportedOperationException { public IntSet getSummarySources(T n2, int d2, T n1) throws UnsupportedOperationException {
throw new UnsupportedOperationException("not currently supported. be careful"); throw new UnsupportedOperationException("not currently supported. be careful");
// LocalSummaryEdges summaries = summaryEdges.get(supergraph.getProcOf(n1)); // LocalSummaryEdges summaries = summaryEdges.get(supergraph.getProcOf(n1));
@ -1093,6 +1094,7 @@ public class TabulationSolver<T, P, F> {
* this function to record call-to-return flow. * this function to record call-to-return flow.
* *
*/ */
@SuppressWarnings("unused")
protected void newNormalExplodedEdge(PathEdge<T> edge, T m, int d3) { protected void newNormalExplodedEdge(PathEdge<T> edge, T m, int d3) {
} }
@ -1103,6 +1105,7 @@ public class TabulationSolver<T, P, F> {
* <calleeEntry, d3> was created. To be overridden in subclasses. * <calleeEntry, d3> was created. To be overridden in subclasses.
* *
*/ */
@SuppressWarnings("unused")
protected void newCallExplodedEdge(PathEdge<T> edge, T calleeEntry, int d3) { protected void newCallExplodedEdge(PathEdge<T> edge, T calleeEntry, int d3) {
} }
@ -1114,6 +1117,7 @@ public class TabulationSolver<T, P, F> {
* course, there is a call edge <c, d4> -> <s_p, d1>. Finally, we have a * course, there is a call edge <c, d4> -> <s_p, d1>. Finally, we have a
* return edge <e_p, d2> -> <returnSite, d5>. * return edge <e_p, d2> -> <returnSite, d5>.
*/ */
@SuppressWarnings("unused")
protected void newSummaryEdge(PathEdge<T> edgeToCallSite, PathEdge<T> calleeSummaryEdge, T returnSite, int d5) { protected void newSummaryEdge(PathEdge<T> edgeToCallSite, PathEdge<T> calleeSummaryEdge, T returnSite, int d5) {
} }

View File

@ -262,7 +262,7 @@ public abstract class AbstractDemandFlowGraph extends AbstractFlowGraph {
} }
DefUse du = node.getDU(); DefUse du = node.getDU();
addNodeInstructionConstraints(node, ir, du); addNodeInstructionConstraints(node, ir);
addNodePassthruExceptionConstraints(node, ir); addNodePassthruExceptionConstraints(node, ir);
addNodeConstantConstraints(node, ir); addNodeConstantConstraints(node, ir);
} }
@ -270,7 +270,7 @@ public abstract class AbstractDemandFlowGraph extends AbstractFlowGraph {
/** /**
* Add pointer flow constraints based on instructions in a given node * Add pointer flow constraints based on instructions in a given node
*/ */
protected void addNodeInstructionConstraints(CGNode node, IR ir, DefUse du) { protected void addNodeInstructionConstraints(CGNode node, IR ir) {
FlowStatementVisitor v = makeVisitor(node); FlowStatementVisitor v = makeVisitor(node);
ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg = ir.getControlFlowGraph(); ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg = ir.getControlFlowGraph();
for (ISSABasicBlock b : cfg) { for (ISSABasicBlock b : cfg) {

View File

@ -52,15 +52,14 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
private final Map<PointerKey, Set<Statement>> invRef; private final Map<PointerKey, Set<Statement>> invRef;
public PABasedMemoryAccessMap(CallGraph cg, PointerAnalysis<InstanceKey> pa) { public PABasedMemoryAccessMap(CallGraph cg, PointerAnalysis<InstanceKey> pa) {
this(cg, pa, new SDG<InstanceKey>(cg, pa, DataDependenceOptions.NO_BASE_NO_HEAP_NO_EXCEPTIONS, ControlDependenceOptions.NONE)); this(pa, new SDG<InstanceKey>(cg, pa, DataDependenceOptions.NO_BASE_NO_HEAP_NO_EXCEPTIONS, ControlDependenceOptions.NONE));
} }
public PABasedMemoryAccessMap(CallGraph cg, PointerAnalysis<InstanceKey> pa, SDG<InstanceKey> sdg) { public PABasedMemoryAccessMap(PointerAnalysis<InstanceKey> pa, SDG<InstanceKey> sdg) {
this(cg, pa, CISlicer.scanForMod(sdg, pa, true, ModRef.make()), CISlicer.scanForRef(sdg, pa)); this(pa, CISlicer.scanForMod(sdg, pa, true, ModRef.make()), CISlicer.scanForRef(sdg, pa));
} }
public PABasedMemoryAccessMap(CallGraph cg, PointerAnalysis<InstanceKey> pa, Map<Statement, Set<PointerKey>> mod, public PABasedMemoryAccessMap(PointerAnalysis<InstanceKey> pa, Map<Statement, Set<PointerKey>> mod, Map<Statement, Set<PointerKey>> ref) {
Map<Statement, Set<PointerKey>> ref) {
if (pa == null) { if (pa == null) {
throw new IllegalArgumentException("null pa"); throw new IllegalArgumentException("null pa");
} }

View File

@ -16,7 +16,6 @@ import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.callgraph.CGNode; import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.MethodTargetSelector; import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference; import com.ibm.wala.types.TypeReference;
/** /**
@ -74,14 +73,7 @@ public class ClassHierarchyMethodTargetSelector implements MethodTargetSelector
return classHierarchy.resolveMethod(klass, call.getDeclaredTarget().getSelector()); return classHierarchy.resolveMethod(klass, call.getDeclaredTarget().getSelector());
} }
public boolean mightReturnSyntheticMethod(CGNode caller, CallSiteReference site) { public boolean mightReturnSyntheticMethod() {
return false;
}
/*
* @see com.ibm.wala.ipa.callgraph.MethodTargetSelector#mightReturnSyntheticMethod(com.ibm.wala.types.MethodReference)
*/
public boolean mightReturnSyntheticMethod(MethodReference declaredTarget) {
return false; return false;
} }
} }

View File

@ -18,7 +18,6 @@ import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode; import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph; import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.types.TypeReference; import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Predicate; import com.ibm.wala.util.Predicate;
@ -83,7 +82,7 @@ public final class ConcreteTypeKey implements InstanceKey {
* @return a set of ConcreteTypeKeys that represent the exceptions the PEI may throw. * @return a set of ConcreteTypeKeys that represent the exceptions the PEI may throw.
* @throws IllegalArgumentException if pei is null * @throws IllegalArgumentException if pei is null
*/ */
public static InstanceKey[] getInstanceKeysForPEI(SSAInstruction pei, IR ir, IClassHierarchy cha) { public static InstanceKey[] getInstanceKeysForPEI(SSAInstruction pei, IClassHierarchy cha) {
if (pei == null) { if (pei == null) {
throw new IllegalArgumentException("pei is null"); throw new IllegalArgumentException("pei is null");
} }

View File

@ -281,7 +281,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
return callGraph; return callGraph;
} }
protected PropagationSystem makeSystem(AnalysisOptions options) { protected PropagationSystem makeSystem(@SuppressWarnings("unused") AnalysisOptions options) {
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory); return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory);
} }
@ -859,7 +859,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
if (DEBUG_ARRAY_LOAD) { if (DEBUG_ARRAY_LOAD) {
System.err.println("ArrayLoad add assign: " + dVal + " " + p); System.err.println("ArrayLoad add assign: " + dVal + " " + p);
} }
sideEffect.b |= system.newFieldRead(dVal, assignOperator, p, object); sideEffect.b |= system.newFieldRead(dVal, assignOperator, p);
} }
}; };
if (priorInstances != null) { if (priorInstances != null) {
@ -952,9 +952,9 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
// note that the following is idempotent // note that the following is idempotent
if (isJavaLangObject(contents)) { if (isJavaLangObject(contents)) {
sideEffect |= system.newFieldWrite(p, assignOperator, pVal, object); sideEffect |= system.newFieldWrite(p, assignOperator, pVal);
} else { } else {
sideEffect |= system.newFieldWrite(p, filterOperator, pVal, object); sideEffect |= system.newFieldWrite(p, filterOperator, pVal);
} }
} }
byte sideEffectMask = sideEffect ? (byte) SIDE_EFFECT_MASK : 0; byte sideEffectMask = sideEffect ? (byte) SIDE_EFFECT_MASK : 0;
@ -1037,7 +1037,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
String S = "Getfield add constraint " + dVal + " " + p; String S = "Getfield add constraint " + dVal + " " + p;
System.err.println(S); System.err.println(S);
} }
sideEffect.b |= system.newFieldRead(dVal, assignOperator, p, object); sideEffect.b |= system.newFieldRead(dVal, assignOperator, p);
} }
} }
} }
@ -1156,7 +1156,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
String S = "Putfield add constraint " + p + " " + pVal; String S = "Putfield add constraint " + p + " " + pVal;
System.err.println(S); System.err.println(S);
} }
sideEffect.b |= system.newFieldWrite(p, assign, pVal, object); sideEffect.b |= system.newFieldWrite(p, assign, pVal);
} }
} }
} }

View File

@ -390,14 +390,14 @@ public class PropagationSystem extends DefaultFixedPointSolver<PointsToSetVariab
/** /**
* @return true iff the system changes * @return true iff the system changes
*/ */
public boolean newFieldWrite(PointerKey lhs, UnaryOperator<PointsToSetVariable> op, PointerKey rhs, PointerKey container) { public boolean newFieldWrite(PointerKey lhs, UnaryOperator<PointsToSetVariable> op, PointerKey rhs) {
return newConstraint(lhs, op, rhs); return newConstraint(lhs, op, rhs);
} }
/** /**
* @return true iff the system changes * @return true iff the system changes
*/ */
public boolean newFieldRead(PointerKey lhs, UnaryOperator<PointsToSetVariable> op, PointerKey rhs, PointerKey container) { public boolean newFieldRead(PointerKey lhs, UnaryOperator<PointsToSetVariable> op, PointerKey rhs) {
return newConstraint(lhs, op, rhs); return newConstraint(lhs, op, rhs);
} }

View File

@ -269,6 +269,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
* Hook for aubclasses to add pointer flow constraints based on values in a given node * Hook for aubclasses to add pointer flow constraints based on values in a given node
* @throws CancelException * @throws CancelException
*/ */
@SuppressWarnings("unused")
protected void addNodeValueConstraints(CGNode node, IProgressMonitor monitor) throws CancelException { protected void addNodeValueConstraints(CGNode node, IProgressMonitor monitor) throws CancelException {
} }
@ -566,7 +567,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
} }
} }
protected IntSet getParamObjects(int paramIndex, int rhsi) { protected IntSet getParamObjects(int paramIndex, @SuppressWarnings("unused") int rhsi) {
int paramVn = call.getUse(paramIndex); int paramVn = call.getUse(paramIndex);
PointerKey var = getPointerKeyForLocal(caller, paramVn); PointerKey var = getPointerKeyForLocal(caller, paramVn);
IntSet s = system.findOrCreatePointsToSet(var).getValue(); IntSet s = system.findOrCreatePointsToSet(var).getValue();
@ -1731,7 +1732,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
} }
} }
private byte cpa(PointsToSetVariable lhs, final PointsToSetVariable[] rhs) { private byte cpa(final PointsToSetVariable[] rhs) {
final MutableBoolean changed = new MutableBoolean(); final MutableBoolean changed = new MutableBoolean();
for(int rhsIndex = 0; rhsIndex < rhs.length; rhsIndex++) { for(int rhsIndex = 0; rhsIndex < rhs.length; rhsIndex++) {
final int y = rhsIndex; final int y = rhsIndex;
@ -1791,7 +1792,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
public byte evaluate(PointsToSetVariable lhs, final PointsToSetVariable[] rhs) { public byte evaluate(PointsToSetVariable lhs, final PointsToSetVariable[] rhs) {
assert dispatchIndices.length >= rhs.length : "bad operator at " + call; assert dispatchIndices.length >= rhs.length : "bad operator at " + call;
return cpa(lhs, rhs); return cpa(rhs);
/* /*
// did evaluating the dispatch operation add a new possible target // did evaluating the dispatch operation add a new possible target
@ -2007,8 +2008,8 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
} }
} }
protected void iterateCrossProduct(final CGNode caller, final SSAAbstractInvokeInstruction call, IntSet parameters, protected void iterateCrossProduct(final CGNode caller, final SSAAbstractInvokeInstruction call, final InstanceKey[][] invariants,
final InstanceKey[][] invariants, final VoidFunction<InstanceKey[]> f) { final VoidFunction<InstanceKey[]> f) {
new CrossProductRec(invariants, call, caller, f).rec(0, 0); new CrossProductRec(invariants, call, caller, f).rec(0, 0);
} }
@ -2035,7 +2036,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
} }
} }
}; };
iterateCrossProduct(caller, instruction, params, invs, f); iterateCrossProduct(caller, instruction, invs, f);
return targets; return targets;
} }
@ -2069,7 +2070,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
return true; return true;
} }
protected InterestingVisitor makeInterestingVisitor(CGNode node, int vn) { protected InterestingVisitor makeInterestingVisitor(@SuppressWarnings("unused") CGNode node, int vn) {
return new InterestingVisitor(vn); return new InterestingVisitor(vn);
} }

View File

@ -17,7 +17,6 @@ import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextItem; import com.ibm.wala.ipa.callgraph.ContextItem;
import com.ibm.wala.ipa.callgraph.ContextKey; import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.ContextSelector; import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.Selector; import com.ibm.wala.types.Selector;
import com.ibm.wala.util.intset.IntSet; import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.IntSetUtil; import com.ibm.wala.util.intset.IntSetUtil;
@ -30,7 +29,7 @@ public class TargetMethodContextSelector implements ContextSelector {
private final Selector selector; private final Selector selector;
public TargetMethodContextSelector(Selector selector, IClassHierarchy cha) { public TargetMethodContextSelector(Selector selector) {
this.selector = selector; this.selector = selector;
} }

View File

@ -112,7 +112,7 @@ public class ContainerContextSelector implements ContextSelector {
if (keys != null && keys.length > 0 && keys[0] != null) { if (keys != null && keys.length > 0 && keys[0] != null) {
receiver = keys[0]; receiver = keys[0];
} }
if (mayUnderstand(caller, site, callee, receiver)) { if (mayUnderstand(site, callee, receiver)) {
if (DEBUG) { if (DEBUG) {
System.err.println("May Understand: " + callee + " recv " + receiver); System.err.println("May Understand: " + callee + " recv " + receiver);
} }
@ -270,7 +270,7 @@ public class ContainerContextSelector implements ContextSelector {
return (n == null) ? null : n.getContext(); return (n == null) ? null : n.getContext();
} }
public boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey receiver) { public boolean mayUnderstand(CallSiteReference site, IMethod targetMethod, InstanceKey receiver) {
if (targetMethod == null) { if (targetMethod == null) {
throw new IllegalArgumentException("targetMethod is null"); throw new IllegalArgumentException("targetMethod is null");
} }

View File

@ -158,18 +158,18 @@ public abstract class AbstractRTABuilder extends PropagationCallGraphBuilder {
private void addFieldConstraints(CGNode node) { private void addFieldConstraints(CGNode node) {
for (Iterator it = getRTAContextInterpreter().iterateFieldsRead(node); it.hasNext();) { for (Iterator it = getRTAContextInterpreter().iterateFieldsRead(node); it.hasNext();) {
FieldReference f = (FieldReference) it.next(); FieldReference f = (FieldReference) it.next();
processFieldAccess(node, f); processFieldAccess(f);
} }
for (Iterator it = getRTAContextInterpreter().iterateFieldsWritten(node); it.hasNext();) { for (Iterator it = getRTAContextInterpreter().iterateFieldsWritten(node); it.hasNext();) {
FieldReference f = (FieldReference) it.next(); FieldReference f = (FieldReference) it.next();
processFieldAccess(node, f); processFieldAccess(f);
} }
} }
/** /**
* Is s is a getstatic or putstatic, then potentially add the relevant <clinit>to the newMethod set. * Is s is a getstatic or putstatic, then potentially add the relevant <clinit>to the newMethod set.
*/ */
private void processFieldAccess(CGNode node, FieldReference f) { private void processFieldAccess(FieldReference f) {
if (DEBUG) { if (DEBUG) {
System.err.println(("processFieldAccess: " + f)); System.err.println(("processFieldAccess: " + f));
} }

View File

@ -206,7 +206,7 @@ public class TypeBasedHeapModel implements HeapModel {
return iKeyFactory.getInstanceKeyForConstant(type, S); return iKeyFactory.getInstanceKeyForConstant(type, S);
} }
public String getStringConstantForInstanceKey(InstanceKey I) throws UnimplementedError { public String getStringConstantForInstanceKey() throws UnimplementedError {
Assertions.UNREACHABLE(); Assertions.UNREACHABLE();
return null; return null;
} }

View File

@ -177,7 +177,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
isPopulated = true; isPopulated = true;
Map<SSAInstruction, Integer> instructionIndices = computeInstructionIndices(ir); Map<SSAInstruction, Integer> instructionIndices = computeInstructionIndices(ir);
createNodes(ref, cOptions, ir); createNodes(ref, ir);
createScalarEdges(cOptions, ir, instructionIndices); createScalarEdges(cOptions, ir, instructionIndices);
} }
} }
@ -880,7 +880,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
/** /**
* Create all nodes in this PDG. Each node is a Statement. * Create all nodes in this PDG. Each node is a Statement.
*/ */
private void createNodes(Map<CGNode, OrdinalSet<PointerKey>> ref, ControlDependenceOptions cOptions, IR ir) { private void createNodes(Map<CGNode, OrdinalSet<PointerKey>> ref, IR ir) {
if (ir != null) { if (ir != null) {
createNormalStatements(ir, ref); createNormalStatements(ir, ref);

View File

@ -68,6 +68,7 @@ public class ReachabilityFunctions<T> implements IFlowFunctionMap<T> {
return FLOW_REACHES; return FLOW_REACHES;
} }
@SuppressWarnings("unused")
public IFlowFunction getReturnFlowFunction(T src, T dest) { public IFlowFunction getReturnFlowFunction(T src, T dest) {
return FLOW_REACHES; return FLOW_REACHES;
} }

View File

@ -46,7 +46,7 @@ class SDGSupergraph implements ISupergraph<Statement, PDG<? extends InstanceKey>
return null; return null;
} }
public Object[] getEntry(Statement n) { public Object[] getEntry() {
Assertions.UNREACHABLE(); Assertions.UNREACHABLE();
return null; return null;
} }

View File

@ -19,7 +19,7 @@ import com.ibm.wala.ssa.SSAOptions;
public class SyntheticIRFactory implements IRFactory<SyntheticMethod> { public class SyntheticIRFactory implements IRFactory<SyntheticMethod> {
public ControlFlowGraph makeCFG(SyntheticMethod method, Context C) { public ControlFlowGraph makeCFG(SyntheticMethod method) {
if (method == null) { if (method == null) {
throw new IllegalArgumentException("method is null"); throw new IllegalArgumentException("method is null");
} }

View File

@ -35,14 +35,14 @@ public class DefaultIRFactory implements IRFactory<IMethod> {
* @see com.ibm.wala.ssa.IRFactory#makeCFG(com.ibm.wala.classLoader.IMethod, com.ibm.wala.ipa.callgraph.Context, * @see com.ibm.wala.ssa.IRFactory#makeCFG(com.ibm.wala.classLoader.IMethod, com.ibm.wala.ipa.callgraph.Context,
* com.ibm.wala.ipa.cha.IClassHierarchy, com.ibm.wala.util.warnings.WarningSet) * com.ibm.wala.ipa.cha.IClassHierarchy, com.ibm.wala.util.warnings.WarningSet)
*/ */
public ControlFlowGraph makeCFG(IMethod method, Context c) throws IllegalArgumentException { public ControlFlowGraph makeCFG(IMethod method, @SuppressWarnings("unused") Context c) throws IllegalArgumentException {
if (method == null) { if (method == null) {
throw new IllegalArgumentException("method cannot be null"); throw new IllegalArgumentException("method cannot be null");
} }
if (method.isSynthetic()) { if (method.isSynthetic()) {
return syntheticFactory.makeCFG((SyntheticMethod) method, c); return syntheticFactory.makeCFG((SyntheticMethod) method);
} else if (method instanceof IBytecodeMethod) { } else if (method instanceof IBytecodeMethod) {
return shrikeFactory.makeCFG((IBytecodeMethod) method, c); return shrikeFactory.makeCFG((IBytecodeMethod) method);
} else { } else {
Assertions.UNREACHABLE(); Assertions.UNREACHABLE();
return null; return null;

View File

@ -248,7 +248,7 @@ public abstract class SSAInstruction {
/** /**
* @return value number representing the jth use in this instruction. -1 means TOP (i.e., the value doesn't matter) * @return value number representing the jth use in this instruction. -1 means TOP (i.e., the value doesn't matter)
*/ */
public int getUse(int j) throws UnsupportedOperationException { public int getUse(@SuppressWarnings("unused") int j) throws UnsupportedOperationException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -816,7 +816,7 @@ public class TypeAnnotation {
} }
// TODO: method is currently unused, but we may want to use it if we decide to resolve generic signature indices here // TODO: method is currently unused, but we may want to use it if we decide to resolve generic signature indices here
public static TypeAnnotationTargetConverter targetConverterAtMethodInfo(final ClassLoaderReference clRef, final IBytecodeMethod method) { public static TypeAnnotationTargetConverter targetConverterAtMethodInfo(final ClassLoaderReference clRef) {
return new TypeAnnotationTargetConverter() { return new TypeAnnotationTargetConverter() {
@Override @Override
public TypeAnnotationTarget visitTypeParameterTarget(com.ibm.wala.shrikeCT.TypeAnnotationsReader.TypeParameterTarget target) { public TypeAnnotationTarget visitTypeParameterTarget(com.ibm.wala.shrikeCT.TypeAnnotationsReader.TypeParameterTarget target) {
@ -944,7 +944,7 @@ public class TypeAnnotation {
}; };
} }
public static TypeAnnotationTargetConverter targetConverterAtFieldInfo(final ClassLoaderReference clRef) { public static TypeAnnotationTargetConverter targetConverterAtFieldInfo() {
return new TypeAnnotationTargetConverter() { return new TypeAnnotationTargetConverter() {
@Override @Override
public TypeAnnotationTarget visitTypeParameterTarget(com.ibm.wala.shrikeCT.TypeAnnotationsReader.TypeParameterTarget target) { public TypeAnnotationTarget visitTypeParameterTarget(com.ibm.wala.shrikeCT.TypeAnnotationsReader.TypeParameterTarget target) {

View File

@ -80,7 +80,7 @@ public class ProgressMaster implements IProgressMonitor {
public synchronized void reset() { public synchronized void reset() {
killNanny(); killNanny();
setCanceled(false); setCanceled();
timedOut = false; timedOut = false;
tooMuchMemory = false; tooMuchMemory = false;
} }
@ -118,7 +118,7 @@ public class ProgressMaster implements IProgressMonitor {
return delegate.isCanceled() || timedOut || tooMuchMemory; return delegate.isCanceled() || timedOut || tooMuchMemory;
} }
public void setCanceled(boolean value) { public void setCanceled() {
killNanny(); killNanny();
} }
@ -131,7 +131,7 @@ public class ProgressMaster implements IProgressMonitor {
@Override @Override
public void cancel() { public void cancel() {
setCanceled(true); setCanceled();
} }
/** END Custom change: subtasks and canceling */ /** END Custom change: subtasks and canceling */
@Override @Override

View File

@ -50,12 +50,11 @@ public class AnalysisScopeReader {
*/ */
public static AnalysisScope readJavaScope(String scopeFileName, File exclusionsFile, ClassLoader javaLoader) throws IOException { public static AnalysisScope readJavaScope(String scopeFileName, File exclusionsFile, ClassLoader javaLoader) throws IOException {
AnalysisScope scope = AnalysisScope.createJavaAnalysisScope(); AnalysisScope scope = AnalysisScope.createJavaAnalysisScope();
return read(scope, scopeFileName, exclusionsFile, javaLoader, new FileProvider()); return read(scope, scopeFileName, exclusionsFile, javaLoader);
} }
public static AnalysisScope read(AnalysisScope scope, String scopeFileName, File exclusionsFile, ClassLoader javaLoader, public static AnalysisScope read(AnalysisScope scope, String scopeFileName, File exclusionsFile, ClassLoader javaLoader) throws IOException {
FileProvider fp) throws IOException {
BufferedReader r = null; BufferedReader r = null;
try { try {
// Now reading from jar is included in WALA, but we can't use their version, because they load from // Now reading from jar is included in WALA, but we can't use their version, because they load from
@ -99,8 +98,7 @@ public class AnalysisScopeReader {
return scope; return scope;
} }
protected static AnalysisScope read(AnalysisScope scope, final URI scopeFileURI, final File exclusionsFile, ClassLoader javaLoader, protected static AnalysisScope read(AnalysisScope scope, final URI scopeFileURI, final File exclusionsFile, ClassLoader javaLoader) throws IOException {
FileProvider fp) throws IOException {
BufferedReader r = null; BufferedReader r = null;
try { try {
String line; String line;

View File

@ -609,6 +609,7 @@ public class TypeSafeInstructionFactory {
return insts.PhiInstruction(iindex, result.getNumber(), aParams); return insts.PhiInstruction(iindex, result.getNumber(), aParams);
} }
@SuppressWarnings("unused")
private static boolean isSuperclassOf(final TypeReference superClass, final TypeReference subClass) { private static boolean isSuperclassOf(final TypeReference superClass, final TypeReference subClass) {
return true; // TODO return true; // TODO
} }

View File

@ -41,7 +41,7 @@ public class CgPanel extends JSplitPane{
this.setLeftComponent(new JScrollPane(tree)); this.setLeftComponent(new JScrollPane(tree));
final IrAndSourceViewer irViewer = new IrAndSourceViewer(cg); final IrAndSourceViewer irViewer = new IrAndSourceViewer();
this.setRightComponent(irViewer.getComponent()); this.setRightComponent(irViewer.getComponent());
tree.addTreeSelectionListener(new TreeSelectionListener() { tree.addTreeSelectionListener(new TreeSelectionListener() {

View File

@ -19,7 +19,6 @@ import javax.swing.JSplitPane;
import com.ibm.wala.classLoader.IClassLoader; import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.classLoader.IMethod; import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ssa.IR; import com.ibm.wala.ssa.IR;
import com.ibm.wala.viz.viewer.IrViewer.SelectedPcListner; import com.ibm.wala.viz.viewer.IrViewer.SelectedPcListner;
@ -30,9 +29,6 @@ public class IrAndSourceViewer {
private IR ir; private IR ir;
public IrAndSourceViewer(CallGraph cg) {
}
public Component getComponent() { public Component getComponent() {

View File

@ -97,7 +97,7 @@ public class PaPanel extends JSplitPane {
this.setRightComponent(rightPanel); this.setRightComponent(rightPanel);
fullName = new JTextField(""); fullName = new JTextField("");
rightPanel.add(fullName, BorderLayout.PAGE_START); rightPanel.add(fullName, BorderLayout.PAGE_START);
irViewer = new IrAndSourceViewer(cg); irViewer = new IrAndSourceViewer();
rightPanel.add(irViewer.getComponent(), BorderLayout.CENTER); rightPanel.add(irViewer.getComponent(), BorderLayout.CENTER);
heapTree.addTreeExpansionListener(new TreeExpansionListener() { heapTree.addTreeExpansionListener(new TreeExpansionListener() {

View File

@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
@ -112,7 +112,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
@ -112,7 +112,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

View File

@ -74,6 +74,6 @@ public class JDTJavaIRTests extends JavaIRTests {
@Override @Override
protected <I extends InstanceKey> AbstractAnalysisEngine<I> getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) { protected <I extends InstanceKey> AbstractAnalysisEngine<I> getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
return JDTJavaTest.makeAnalysisEngine(mainClassDescriptors, sources, libs, project); return JDTJavaTest.makeAnalysisEngine(mainClassDescriptors, project);
} }
} }

View File

@ -45,10 +45,10 @@ public abstract class JDTJavaTest extends IRTests {
@Override @Override
protected <I extends InstanceKey> AbstractAnalysisEngine<I> getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) { protected <I extends InstanceKey> AbstractAnalysisEngine<I> getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
return makeAnalysisEngine(mainClassDescriptors, sources, libs, project); return makeAnalysisEngine(mainClassDescriptors, project);
} }
static <I extends InstanceKey> AbstractAnalysisEngine<I> makeAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs, ZippedProjectData project) { static <I extends InstanceKey> AbstractAnalysisEngine<I> makeAnalysisEngine(final String[] mainClassDescriptors, ZippedProjectData project) {
AbstractAnalysisEngine<I> engine; AbstractAnalysisEngine<I> engine;
engine = new JDTJavaSourceAnalysisEngine<I>(project.projectName) { engine = new JDTJavaSourceAnalysisEngine<I>(project.projectName) {
{ {

View File

@ -33,7 +33,7 @@ final class TypeInferenceAssertion implements IRAssertion {
@Override @Override
public void check(CallGraph cg) { public void check(CallGraph cg) {
IR ir = getIR(cg, typeName, "main", "[Ljava/lang/String;", "V"); IR ir = getIR(cg, typeName, "main", "[Ljava/lang/String;", "V");
AstJavaTypeInference inference = new AstJavaTypeInference(ir, cg.getClassHierarchy(), true); AstJavaTypeInference inference = new AstJavaTypeInference(ir, true);
for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateAllInstructions())) { for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateAllInstructions())) {
// Check defs // Check defs

View File

@ -108,7 +108,7 @@ public class JDTJavaSourceAnalysisEngine<I extends InstanceKey> extends EclipseP
@Override @Override
protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha, protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha,
AnalysisOptions options, IAnalysisCacheView cache) { AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make(options, cache, cha, scope, false); return new ZeroCFABuilderFactory().make(options, cache, cha, scope);
} }
} }

View File

@ -74,6 +74,6 @@ public class JDTClassLoaderFactory extends ClassLoaderFactoryImpl {
} }
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent) { protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent) {
return new JDTSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha, dump); return new JDTSourceLoaderImpl(classLoaderReference, parent, cha, dump);
} }
} }

View File

@ -42,17 +42,16 @@ import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.classLoader.IClassLoader; import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class JDTSourceLoaderImpl extends JavaSourceLoaderImpl { public class JDTSourceLoaderImpl extends JavaSourceLoaderImpl {
private final boolean dump; private final boolean dump;
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) { public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
this(loaderRef, parent, exclusions, cha, false); this(loaderRef, parent, cha, false);
} }
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) { public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, exclusions, cha); super(loaderRef, parent, cha);
this.dump = dump; this.dump = dump;
} }

View File

@ -88,7 +88,7 @@ public class JavaEclipseProjectPath extends EclipseProjectPath<IClasspathEntry,
break; break;
} }
case IClasspathEntry.CPE_PROJECT: { case IClasspathEntry.CPE_PROJECT: {
resolveProjectPathEntry(loader, includeSource, entry.getPath()); resolveProjectPathEntry(includeSource, entry.getPath());
break; break;
} }
case IClasspathEntry.CPE_CONTAINER: { case IClasspathEntry.CPE_CONTAINER: {

View File

@ -115,7 +115,7 @@ public class EclipseJavaScriptAnalysisEngine<I extends InstanceKey> extends Ecli
@Override @Override
protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha, protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha,
AnalysisOptions options, IAnalysisCacheView cache) { AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make((JSAnalysisOptions)options, cache, cha, scope, false); return new ZeroCFABuilderFactory().make((JSAnalysisOptions)options, cache, cha);
} }
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> getFieldBasedCallGraph() throws CancelException { public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> getFieldBasedCallGraph() throws CancelException {

View File

@ -86,7 +86,7 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
@ -111,7 +111,7 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

Some files were not shown because too many files have changed in this diff Show More