Fix or suppress all 242 Eclipse warnings about unused parameters

In general, my approach was to try to eliminate each unused parameter
using Eclipse's "Change Method Signature" refactoring.  That did not
always succeed: a parameter may be unused in some base class method,
but then be used in subclass's override of that method.  In cases
where refactoring to eliminate a parameter failed, I instead annotated
the parameter with '@SuppressWarnings("unused")' to silence the
warning.

Note: this group of changes creates a significant risk of
incompatibility for third-party WALA code.  Some removed parameters
change externally-visible APIs.  Furthermore, these changes do not
necessarily lead to Java compilation errors.  For example, suppose
third-party code subclasses a WALA class or interface, overrides a
method, but does not annotate that method as @Override.  Removing a
parameter means that the third-party method no longer overrides.  This
can quietly change code behavior without compile-time errors or
warnings.  This is exactly why one should use @Override wherever
possible, but we cannot guarantee that third-party WALA users have
done that.
This commit is contained in:
Ben Liblit 2017-07-28 15:33:41 -05:00 committed by Manu Sridharan
parent c65943add1
commit 6087b73cee
109 changed files with 277 additions and 343 deletions

View File

@ -70,7 +70,7 @@ public class SourceDirCallGraph {
// options.setReflectionOptions(ReflectionOptions.NONE);
AnalysisCache cache = new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory());
//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...");
CallGraph cg = builder.makeCallGraph(options, null);
long end = System.currentTimeMillis();

View File

@ -33,7 +33,7 @@ public class ECJClassLoaderFactory extends ClassLoaderFactoryImpl {
}
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.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class ECJSourceLoaderImpl extends JavaSourceLoaderImpl {
private final boolean dump;
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) {
this(loaderRef, parent, exclusions, cha, false);
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
this(loaderRef, parent, cha, false);
}
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, exclusions, cha);
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, cha);
this.dump = dump;
}

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.classLoader.IClass;
import com.ibm.wala.fixpoint.IVariable;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.shrikeBT.IBinaryOpInstruction;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSABinaryOpInstruction;
@ -98,8 +97,8 @@ public class AstJavaTypeInference extends AstTypeInference {
}
public AstJavaTypeInference(IR ir, IClassHierarchy cha, boolean doPrimitives) {
super(ir, cha, JavaPrimitiveType.BOOLEAN, doPrimitives);
public AstJavaTypeInference(IR ir, boolean doPrimitives) {
super(ir, JavaPrimitiveType.BOOLEAN, doPrimitives);
}
IClass getStringClass() {

View File

@ -173,6 +173,6 @@ public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends Ab
@Override
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 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.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
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 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.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
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) {
TypeInference ti = new AstJavaTypeInference(ir, cha, false);
protected TypeInference makeTypeInference(IR ir) {
TypeInference ti = new AstJavaTypeInference(ir, false);
if (DEBUG_TYPE_INFERENCE) {
System.err.println(("IR of " + ir.getMethod()));

View File

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

View File

@ -38,7 +38,7 @@ public class AstJavaZeroXCFABuilder extends AstJavaCFABuilder {
setContextSelector(contextSelector);
setInstanceKeys(new JavaScopeMappingInstanceKeys(cha, this, new ZeroXInstanceKeys(options, cha, contextInterpreter,
setInstanceKeys(new JavaScopeMappingInstanceKeys(this, new ZeroXInstanceKeys(options, cha, contextInterpreter,
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.InstanceKeyFactory;
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.Pair;
public class JavaScopeMappingInstanceKeys extends ScopeMappingInstanceKeys {
public JavaScopeMappingInstanceKeys(IClassHierarchy cha, PropagationCallGraphBuilder builder, InstanceKeyFactory basic) {
public JavaScopeMappingInstanceKeys(PropagationCallGraphBuilder builder, InstanceKeyFactory 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.ClassConstants;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAThrowInstruction;
import com.ibm.wala.ssa.SymbolTable;
import com.ibm.wala.types.ClassLoaderReference;
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.util.collections.HashMapFactory;
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.strings.Atom;
@ -483,14 +481,14 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/** BEGIN Custom change: Common superclass is optional */
public JavaSourceLoaderImpl(boolean existsCommonSuperClass, ClassLoaderReference loaderRef, IClassLoader parent,
SetOfClasses exclusions, IClassHierarchy cha) {
IClassHierarchy cha) {
super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha);
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
this(true, loaderRef, parent, exclusions, cha);
this(true, loaderRef, parent, cha);
}
/** 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) {
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();

View File

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

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.Language;
import com.ibm.wala.classLoader.SourceURLModule;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
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.*;
import com.ibm.wala.ipa.callgraph.impl.ComposedEntrypoints;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@ -34,7 +29,7 @@ import com.ibm.wala.util.strings.Atom;
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);
Map<Atom,MethodTargetSelector> methodTargetSelectors = HashMapFactory.make();
@ -52,7 +47,7 @@ public class Driver {
HybridAnalysisScope scope = new HybridAnalysisScope();
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.getJavaScriptLoader(),
@ -81,7 +76,7 @@ public class Driver {
AnalysisCache cache = new AnalysisCacheImpl(factory);
addDefaultDispatchLogic(options, scope, cha, cache);
addDefaultDispatchLogic(options, cha);
JavaJavaScriptHybridCallGraphBuilder b = new JavaJavaScriptHybridCallGraphBuilder(cha, options, cache);

View File

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

View File

@ -34,7 +34,7 @@ import com.ibm.wala.types.TypeReference;
public class JSTypeInference extends AstTypeInference {
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

View File

@ -83,11 +83,11 @@ public abstract class FieldBasedCallGraphBuilder {
this.options = options;
this.cache = iAnalysisCacheView;
this.constructors = new JavaScriptConstructorFunctions(cha);
this.targetSelector = setupMethodTargetSelector(cha, constructors, options);
this.targetSelector = setupMethodTargetSelector(constructors, options);
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());
if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) {
result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result));

View File

@ -75,7 +75,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
if(newEdge) {
// handle it
addEdge(flowgraph, edge.fst, edge.snd, monitor);
addEdge(flowgraph, edge.fst, edge.snd);
// 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
@ -93,7 +93,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
}
// 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();
JavaScriptInvoke invk = c.getInstruction();
FuncVertex caller = c.getCaller();

View File

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

View File

@ -16,67 +16,67 @@ package com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices;
* @author mschaefer
*/
public class AbstractVertexVisitor<T> implements VertexVisitor<T> {
public T visitVertex(Vertex vertex) {
public T visitVertex() {
return null;
}
@Override
public T visitVarVertex(VarVertex varVertex) {
return visitVertex(varVertex);
return visitVertex();
}
@Override
public T visitPropVertex(PropVertex propVertex) {
return visitVertex(propVertex);
return visitVertex();
}
@Override
public T visitUnknownVertex(UnknownVertex unknownVertex) {
return visitVertex(unknownVertex);
return visitVertex();
}
@Override
public T visitFuncVertex(FuncVertex funcVertex) {
return visitVertex(funcVertex);
return visitVertex();
}
@Override
public T visitCreationSiteVertex(CreationSiteVertex csVertex) {
return visitVertex(csVertex);
return visitVertex();
}
@Override
public T visitParamVertex(ParamVertex paramVertex) {
return visitVertex(paramVertex);
return visitVertex();
}
@Override
public T visitRetVertex(RetVertex retVertex) {
return visitVertex(retVertex);
return visitVertex();
}
@Override
public T visitArgVertex(ArgVertex argVertex) {
return visitVertex(argVertex);
return visitVertex();
}
@Override
public T visitCalleeVertex(CallVertex calleeVertex) {
return visitVertex(calleeVertex);
return visitVertex();
}
@Override
public T visitLexicalAccessVertex(LexicalVarVertex lexicalAccessVertex) {
return visitVertex(lexicalAccessVertex);
return visitVertex();
}
@Override
public T visitGlobalVertex(GlobalVertex globalVertex) {
return visitVertex(globalVertex);
return visitVertex();
}
@Override
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
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.JSZeroOrOneXCFABuilder;
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.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
@ -27,8 +26,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/
public class OneCFABuilderFactory {
public CallGraphBuilder<InstanceKey> make(JSAnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope,
boolean keepPointsTo) {
public CallGraphBuilder<InstanceKey> make(JSAnalysisOptions options, AnalysisCache cache, IClassHierarchy cha) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
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.js.ipa.callgraph.JSAnalysisOptions;
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.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
@ -26,8 +25,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/
public class ZeroCFABuilderFactory {
public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope,
boolean keepPointsTo) {
public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
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()){
String attr = e.getKey();
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")) {
@ -143,7 +143,7 @@ public class DefaultSourceExtractor extends DomLessSourceExtractor{
}
}
inputElementCallback(tag);
inputElementCallback();
}
assert varName != null && !"".equals(varName);
@ -152,16 +152,16 @@ public class DefaultSourceExtractor extends DomLessSourceExtractor{
printlnIndented("parent.appendChild(this);", tag);
}
protected void inputElementCallback(ITag tag) {
protected void inputElementCallback() {
// 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);
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.
if(attr.length() >= 2 && attr.substring(0,2).equals("on")) {
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();");
}
protected Position makePos(int lineNumber, ITag governingTag) {
return makePos(entrypointUrl, lineNumber, governingTag);
}
protected Position makePos(final URL url, final int lineNumber, ITag governingTag) {
protected Position makePos(ITag governingTag) {
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.ssa.IR;
import com.ibm.wala.ssa.SSAAbstractInvokeInstruction;
import com.ibm.wala.types.MethodReference;
/**
* 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) {
return true;
}
public boolean mightReturnSyntheticMethod(MethodReference declaredTarget) {
public boolean mightReturnSyntheticMethod() {
return true;
}
}

View File

@ -135,7 +135,7 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
return callModels.get(key);
}
JSInstructionFactory insts = (JSInstructionFactory) receiver.getClassLoader().getInstructionFactory();
MethodReference ref = genSyntheticMethodRef(receiver, nargs, key);
MethodReference ref = genSyntheticMethodRef(receiver, key);
JavaScriptSummary S = new JavaScriptSummary(ref, nargs);
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_";
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);
Descriptor desc = Descriptor.findOrCreateUTF8(JavaScriptLoader.JS, "()LRoot;");
MethodReference ref = MethodReference.findOrCreate(receiver.getReference(), atom, desc);

View File

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

View File

@ -200,7 +200,7 @@ public class ClosureExtractor extends CAstRewriterExt {
}
@Override
protected void leaveEntity(CAstEntity entity) {
protected void leaveEntity() {
policies.pop();
}
@ -210,7 +210,7 @@ public class ClosureExtractor extends CAstRewriterExt {
case OPERATOR:
return root;
case CONSTANT:
return copyConstant(root, cfg, context, nodeMap);
return copyConstant(root, context, nodeMap);
case BLOCK_STMT:
return copyBlock(root, cfg, context, nodeMap);
case RETURN:
@ -225,7 +225,7 @@ public class ClosureExtractor extends CAstRewriterExt {
}
/* 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());
nodeMap.put(Pair.make(root, context.key()), newNode);
return newNode;

View File

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

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.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IR;
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);
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.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
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.*;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ContextInsensitiveSSAInterpreter;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.util.collections.EmptyIterator;
@ -37,7 +34,7 @@ public class AstContextInsensitiveSSAContextInterpreter extends ContextInsensiti
super(options, cache);
}
public boolean understands(IMethod method, Context context) {
public boolean understands(IMethod method) {
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.cast.ipa.callgraph.AstCallGraph.AstCGNode;
import com.ibm.wala.cast.ipa.callgraph.ScopeMappingInstanceKeys.ScopeMappingInstanceKey;
import com.ibm.wala.cast.ir.ssa.AstAssertInstruction;
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.*;
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.loader.AstMethod;
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
* in object catalogs or not. By default, always return false.
*/
@SuppressWarnings("unused")
protected boolean isUncataloguedField(IClass type, String fieldName) {
return false;
}
@ -357,8 +347,8 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
return ((AstPointerKeyFactory) getBuilder().getPointerKeyFactory()).getPointerKeysForReflectedFieldWrite(I, F);
}
private static void visitLexical(AstLexicalAccess instruction, final LexicalOperator op) {
op.doLexicalPointerKeys(false);
private static void visitLexical(final LexicalOperator op) {
op.doLexicalPointerKeys();
// I have no idea what the code below does, but commenting it out doesn't
// break any regression tests. --MS
// if (! checkLexicalInstruction(instruction)) {
@ -370,7 +360,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
@Override
public void visitAstLexicalRead(AstLexicalRead instruction) {
visitLexical(instruction, new LexicalOperator((AstCGNode) node, instruction.getAccesses(), true) {
visitLexical(new LexicalOperator((AstCGNode) node, instruction.getAccesses(), true) {
@Override
protected void action(PointerKey lexicalKey, int vn) {
PointerKey lval = getPointerKeyForLocal(vn);
@ -400,7 +390,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
@Override
public void visitAstLexicalWrite(AstLexicalWrite instruction) {
visitLexical(instruction, new LexicalOperator((AstCGNode) node, instruction.getAccesses(), false) {
visitLexical(new LexicalOperator((AstCGNode) node, instruction.getAccesses(), false) {
@Override
protected void action(PointerKey lexicalKey, int vn) {
PointerKey rval = getPointerKeyForLocal(vn);
@ -618,7 +608,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
* {@link AstConstraintVisitor#handleRootLexicalReference(String, String, CGNode)}
* .
*/
private void doLexicalPointerKeys(boolean funargsOnly) {
private void doLexicalPointerKeys() {
for (int i = 0; i < accesses.length; i++) {
final String name = accesses[i].variableName;
final String definer = accesses[i].variableDefiner;
@ -640,7 +630,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
@Override
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
doLexicalPointerKeys(true);
doLexicalPointerKeys();
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 boolean keep(IMethod method) {
protected boolean keep() {
return true;
}
@ -93,7 +93,7 @@ public abstract class ScriptEntryPoints implements Iterable<Entrypoint> {
IClass cls = classes.next();
if (cha.isSubclassOf(cls, scriptType) && !cls.isAbstract()) {
for (IMethod method : cls.getDeclaredMethods()) {
if (keep(method)) {
if (keep()) {
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));
assert cls != null && cha.isSubclassOf(cls, scriptType) && !cls.isAbstract() : String.valueOf(cls) + " for " + scriptName;
for (IMethod method : cls.getDeclaredMethods()) {
if (keep(method)) {
if (keep()) {
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.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference;
public class StandardFunctionTargetSelector implements MethodTargetSelector {
@ -67,11 +66,7 @@ public class StandardFunctionTargetSelector implements MethodTargetSelector {
}
}
public boolean mightReturnSyntheticMethod(CGNode caller, CallSiteReference site) {
return true;
}
public boolean mightReturnSyntheticMethod(MethodReference declaredTarget) {
public boolean mightReturnSyntheticMethod() {
return true;
}
}

View File

@ -426,7 +426,7 @@ public abstract class AbstractSSAConversion {
return newDefs;
}
protected boolean skipRepair(SSAInstruction inst, int index) {
protected boolean skipRepair(SSAInstruction inst, @SuppressWarnings("unused") int index) {
if (inst == null)
return true;
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 ControlFlowGraph<?, ?> makeCFG(final IMethod method, final Context context) {
public ControlFlowGraph<?, ?> makeCFG(final IMethod method) {
return ((AstMethod) method).getControlFlowGraph();
}
@ -63,7 +63,7 @@ public class AstIRFactory<T extends IMethod> implements IRFactory<T> {
@Override
public ControlFlowGraph makeCFG(IMethod method, Context context) {
if (method instanceof AstMethod) {
return astFactory.makeCFG(method, context);
return astFactory.makeCFG(method);
} else {
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
* such cases.
*/
protected void handleUnspecifiedLiteralKey(WalkContext context, CAstNode objectLiteralNode, int unspecifiedLiteralIndex,
CAstVisitor<WalkContext> visitor) {
protected void handleUnspecifiedLiteralKey() {
Assertions.UNREACHABLE();
}
@ -409,7 +408,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
/**
* 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
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
*/
@SuppressWarnings("unused")
protected void doIsFieldDefined(WalkContext context, int result, int ref, CAstNode field) {
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) {
@Override
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
// size really refers to.
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
declareFunction(n, context);
else
initFunctionEntity(n, context, codeContext);
initFunctionEntity(codeContext);
return false;
}
@ -3270,7 +3270,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
@Override
protected boolean visitScriptEntity(CAstEntity n, WalkContext context, WalkContext codeContext, CAstVisitor<WalkContext> visitor) {
declareFunction(n, codeContext);
initFunctionEntity(n, context, codeContext);
initFunctionEntity(codeContext);
return false;
}
@ -3279,7 +3279,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
closeFunctionEntity(n, context, codeContext);
}
public void initFunctionEntity(final CAstEntity n, WalkContext parentContext, WalkContext functionContext) {
public void initFunctionEntity(WalkContext functionContext) {
// entry block
functionContext.cfg().makeEntryBlock(functionContext.cfg().newBlock(false));
// first real block
@ -3323,7 +3323,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
@Override
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) {
WalkContext context = c;
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)));
}
@ -4005,7 +4005,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
}
/* 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;
int rval = c.getValue(v);
CAstNode op = a.getChild(2);
@ -4047,7 +4047,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
int temp = context.currentScope().allocateTempValue();
int[] dims = gatherArrayDims(c, n);
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);
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);
}
protected void processObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, WalkContext c) {
}
@Override
protected boolean visitObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, WalkContext c, CAstVisitor<WalkContext> visitor) { /* empty */
return false;
@ -4078,7 +4075,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
WalkContext context = c;
int temp = context.currentScope().allocateTempValue();
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);
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);
}
int rval = processAssignOp(n, v, a, temp, !pre, c);
int rval = processAssignOp(v, a, temp, c);
if (pre) {
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.
*
*/
@SuppressWarnings("unused")
protected CAstNode flowOutTo(Map<Pair<CAstNode, K>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget,
CAstControlFlowMap orig, CAstSourcePositionMap src) {
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) {
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 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();
@ -114,6 +114,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* Should invoke super.doVisitEntity() for unprocessed entities.
* @return true if entity was handled
*/
@SuppressWarnings("unused")
protected boolean doVisitEntity(CAstEntity n, C context, CAstVisitor<C> visitor) {
return false;
}
@ -239,13 +240,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param context a visitor-specific context
* @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.
* @param n the entity to process
* @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.
@ -253,13 +254,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param context a visitor-specific context
* @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.
* @param n the entity to process
* @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.
@ -371,6 +372,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
*
* @return true if node was handled
*/
@SuppressWarnings("unused")
protected boolean doVisit(CAstNode n, C context, CAstVisitor<C> visitor) {
return false;
}
@ -384,7 +386,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
*
* @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;
}
@ -889,7 +891,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
visitor.leaveNode(n, context, visitor);
}
protected C makeSpecialParentContext(C context, CAstNode n) {
protected C makeSpecialParentContext(C context, @SuppressWarnings("unused") CAstNode n) {
return context;
}
@ -966,7 +968,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
}
default: {
if (!visitor.doVisitAssignNodes(n, context, v, a, visitor)) {
if (!visitor.doVisitAssignNodes()) {
if (DEBUG) {
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
* @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.
* @param n the node to process
* @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.
@ -997,13 +999,13 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context
* @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.
* @param n the node to process
* @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.
@ -1089,7 +1091,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param n the node to process
* @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.
* @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 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.
* @param n the node to process
* @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.
* @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 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.
* @param n the node to process
* @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.
* @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 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.
* @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 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.
* @param n the node to process
* @param i the index that was initialized
* @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.
* @param n the node to process
@ -1440,7 +1442,7 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
* @param c a visitor-specific context
* @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.
* @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 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.
* @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
* @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.
* @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 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.
* @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
* @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.
* @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 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.
* @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
* @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.
* @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 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.
* @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
* @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.
* @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 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.
* @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
* @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.
* @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 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.
* @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
* @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.
* @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 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.
* @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
* @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.
* @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 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.
* @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 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.
* @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 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.
* @param n the node to process

View File

@ -223,13 +223,13 @@ public class CallGraphTest extends WalaTestCase {
@Test public void testIO() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope("primordial.txt", CallGraphTestUtil.REGRESSION_EXCLUSIONS);
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);
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();
for (IClass clazz : cha) {
@ -262,7 +262,7 @@ public class CallGraphTest extends WalaTestCase {
"Java60RegressionExclusions.txt":
"GUIExclusions.txt");
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = makePrimordialMainEntrypoints(scope, cha);
Iterable<Entrypoint> entrypoints = makePrimordialMainEntrypoints(cha);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
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.
*/
public static Iterable<Entrypoint> makePrimordialMainEntrypoints(AnalysisScope scope, ClassHierarchy cha) {
public static Iterable<Entrypoint> makePrimordialMainEntrypoints(ClassHierarchy cha) {
final Atom mainMethod = Atom.findOrCreateAsciiAtom("main");
final HashSet<Entrypoint> result = HashSetFactory.make();
for (IClass klass : cha) {

View File

@ -77,7 +77,7 @@ public class ScopeFileCallGraph {
System.out.println(Warnings.asString());
Warnings.clear();
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);
// you can dial down reflection handling if you like
// options.setReflectionOptions(ReflectionOptions.NONE);
@ -97,7 +97,7 @@ public class ScopeFileCallGraph {
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<>();
IClass klass = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application,
StringStuff.deployment2CanonicalTypeString(entryClass)));

View File

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

View File

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

View File

@ -66,7 +66,7 @@ public class GetMethodContextSelector implements ContextSelector {
*/
@Override
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) {
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...)}
* 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())
&& getTypeConstant(instance) != null;
}

View File

@ -50,7 +50,7 @@ class JavaLangClassContextSelector implements ContextSelector {
*/
@Override
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 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.
*/
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;
}

View File

@ -49,7 +49,7 @@ class ReflectiveInvocationSelector implements ContextSelector {
*/
@Override
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;
}
IR ir = caller.getIR();
@ -105,7 +105,7 @@ class ReflectiveInvocationSelector implements ContextSelector {
/**
* 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 (targetMethod.getReference().equals(ReflectiveInvocationInterpreter.METHOD_INVOKE) ||
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();) {
T s = ss.next();
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;
}
protected Object makeEdgeLabel(T x, T y, T s) {
protected Object makeEdgeLabel(T 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 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);

View File

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

View File

@ -320,7 +320,7 @@ public class ClassLoaderImpl implements IClassLoader {
JarInputStream s = new JarInputStream(new ByteArrayInputStream(jarFileContents), false);
JarEntry entry = 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) {
return null;
}
@ -345,7 +345,7 @@ public class ClassLoaderImpl implements IClassLoader {
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) {
return null;
}

View File

@ -148,7 +148,7 @@ public class CodeScanner {
}
if (m.isSynthetic()) {
SyntheticMethod sm = (SyntheticMethod) m;
return getCaughtExceptions(m.getDeclaringClass().getClassLoader().getLanguage(), sm.getStatements());
return getCaughtExceptions(sm.getStatements());
} else {
return getShrikeBTCaughtExceptions((ShrikeCTMethod) m);
}
@ -245,7 +245,7 @@ public class CodeScanner {
* @return {@link Set}&lt;{@link TypeReference}&gt;
* @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) {
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();
return TypeAnnotation.getTypeAnnotationsFromReader(
r,
TypeAnnotation.targetConverterAtMethodInfo(clRef, this),
TypeAnnotation.targetConverterAtMethodInfo(clRef),
clRef
);
}

View File

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

View File

@ -38,7 +38,7 @@ public class ShrikeIRFactory implements IRFactory<IBytecodeMethod> {
public final static boolean buildLocalMap = true;
public ControlFlowGraph makeCFG(final IBytecodeMethod method, Context C) {
public ControlFlowGraph makeCFG(final IBytecodeMethod method) {
return ShrikeCFG.make(method);
}
@ -54,7 +54,7 @@ public class ShrikeIRFactory implements IRFactory<IBytecodeMethod> {
} catch (InvalidClassFileException 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 SSAInstruction[] newInstrs = new SSAInstruction[shrikeInstructions.length];

View File

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

View File

@ -41,13 +41,6 @@ public class IdentityFlowFunctions<T> implements IFlowFunctionMap<T> {
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)
*/

View File

@ -61,7 +61,7 @@ public class PartiallyBalancedTabulationSolver<T, P, F> extends TabulationSolver
T fakeEntry = problem.getFakeEntry(retSite);
PathEdge<T> seed = PathEdge.createPathEdge(fakeEntry, d3, retSite, d3);
addSeed(seed);
newUnbalancedExplodedReturnEdge(s_p, i, n, j, seed);
newUnbalancedExplodedReturnEdge(s_p, i, n, j);
}
}
} 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
* 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
* @throws UnsupportedOperationException unconditionally
*/
@SuppressWarnings("unused")
public IntSet getSummarySources(T n2, int d2, T n1) throws UnsupportedOperationException {
throw new UnsupportedOperationException("not currently supported. be careful");
// 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.
*
*/
@SuppressWarnings("unused")
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.
*
*/
@SuppressWarnings("unused")
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
* return edge <e_p, d2> -> <returnSite, d5>.
*/
@SuppressWarnings("unused")
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();
addNodeInstructionConstraints(node, ir, du);
addNodeInstructionConstraints(node, ir);
addNodePassthruExceptionConstraints(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
*/
protected void addNodeInstructionConstraints(CGNode node, IR ir, DefUse du) {
protected void addNodeInstructionConstraints(CGNode node, IR ir) {
FlowStatementVisitor v = makeVisitor(node);
ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg = ir.getControlFlowGraph();
for (ISSABasicBlock b : cfg) {

View File

@ -52,15 +52,14 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
private final Map<PointerKey, Set<Statement>> invRef;
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) {
this(cg, pa, CISlicer.scanForMod(sdg, pa, true, ModRef.make()), CISlicer.scanForRef(sdg, pa));
public PABasedMemoryAccessMap(PointerAnalysis<InstanceKey> pa, SDG<InstanceKey> sdg) {
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,
Map<Statement, Set<PointerKey>> ref) {
public PABasedMemoryAccessMap(PointerAnalysis<InstanceKey> pa, Map<Statement, Set<PointerKey>> mod, Map<Statement, Set<PointerKey>> ref) {
if (pa == null) {
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.MethodTargetSelector;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference;
/**
@ -74,14 +73,7 @@ public class ClassHierarchyMethodTargetSelector implements MethodTargetSelector
return classHierarchy.resolveMethod(klass, call.getDeclaredTarget().getSelector());
}
public boolean mightReturnSyntheticMethod(CGNode caller, CallSiteReference site) {
return false;
}
/*
* @see com.ibm.wala.ipa.callgraph.MethodTargetSelector#mightReturnSyntheticMethod(com.ibm.wala.types.MethodReference)
*/
public boolean mightReturnSyntheticMethod(MethodReference declaredTarget) {
public boolean mightReturnSyntheticMethod() {
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.CallGraph;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.types.TypeReference;
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.
* @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) {
throw new IllegalArgumentException("pei is null");
}

View File

@ -281,7 +281,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
return callGraph;
}
protected PropagationSystem makeSystem(AnalysisOptions options) {
protected PropagationSystem makeSystem(@SuppressWarnings("unused") AnalysisOptions options) {
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory);
}
@ -859,7 +859,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
if (DEBUG_ARRAY_LOAD) {
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) {
@ -952,9 +952,9 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
// note that the following is idempotent
if (isJavaLangObject(contents)) {
sideEffect |= system.newFieldWrite(p, assignOperator, pVal, object);
sideEffect |= system.newFieldWrite(p, assignOperator, pVal);
} else {
sideEffect |= system.newFieldWrite(p, filterOperator, pVal, object);
sideEffect |= system.newFieldWrite(p, filterOperator, pVal);
}
}
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;
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;
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
*/
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 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);
}

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
* @throws CancelException
*/
@SuppressWarnings("unused")
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);
PointerKey var = getPointerKeyForLocal(caller, paramVn);
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();
for(int rhsIndex = 0; rhsIndex < rhs.length; rhsIndex++) {
final int y = rhsIndex;
@ -1791,7 +1792,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
public byte evaluate(PointsToSetVariable lhs, final PointsToSetVariable[] rhs) {
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
@ -2007,8 +2008,8 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
}
}
protected void iterateCrossProduct(final CGNode caller, final SSAAbstractInvokeInstruction call, IntSet parameters,
final InstanceKey[][] invariants, final VoidFunction<InstanceKey[]> f) {
protected void iterateCrossProduct(final CGNode caller, final SSAAbstractInvokeInstruction call, final InstanceKey[][] invariants,
final VoidFunction<InstanceKey[]> f) {
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;
}
@ -2069,7 +2070,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
return true;
}
protected InterestingVisitor makeInterestingVisitor(CGNode node, int vn) {
protected InterestingVisitor makeInterestingVisitor(@SuppressWarnings("unused") CGNode node, int 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.ContextKey;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.Selector;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.IntSetUtil;
@ -30,7 +29,7 @@ public class TargetMethodContextSelector implements ContextSelector {
private final Selector selector;
public TargetMethodContextSelector(Selector selector, IClassHierarchy cha) {
public TargetMethodContextSelector(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) {
receiver = keys[0];
}
if (mayUnderstand(caller, site, callee, receiver)) {
if (mayUnderstand(site, callee, receiver)) {
if (DEBUG) {
System.err.println("May Understand: " + callee + " recv " + receiver);
}
@ -270,7 +270,7 @@ public class ContainerContextSelector implements ContextSelector {
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) {
throw new IllegalArgumentException("targetMethod is null");
}

View File

@ -158,18 +158,18 @@ public abstract class AbstractRTABuilder extends PropagationCallGraphBuilder {
private void addFieldConstraints(CGNode node) {
for (Iterator it = getRTAContextInterpreter().iterateFieldsRead(node); it.hasNext();) {
FieldReference f = (FieldReference) it.next();
processFieldAccess(node, f);
processFieldAccess(f);
}
for (Iterator it = getRTAContextInterpreter().iterateFieldsWritten(node); it.hasNext();) {
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.
*/
private void processFieldAccess(CGNode node, FieldReference f) {
private void processFieldAccess(FieldReference f) {
if (DEBUG) {
System.err.println(("processFieldAccess: " + f));
}

View File

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

View File

@ -177,7 +177,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
isPopulated = true;
Map<SSAInstruction, Integer> instructionIndices = computeInstructionIndices(ir);
createNodes(ref, cOptions, ir);
createNodes(ref, ir);
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.
*/
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) {
createNormalStatements(ir, ref);

View File

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

View File

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

View File

@ -19,7 +19,7 @@ import com.ibm.wala.ssa.SSAOptions;
public class SyntheticIRFactory implements IRFactory<SyntheticMethod> {
public ControlFlowGraph makeCFG(SyntheticMethod method, Context C) {
public ControlFlowGraph makeCFG(SyntheticMethod method) {
if (method == 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,
* 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) {
throw new IllegalArgumentException("method cannot be null");
}
if (method.isSynthetic()) {
return syntheticFactory.makeCFG((SyntheticMethod) method, c);
return syntheticFactory.makeCFG((SyntheticMethod) method);
} else if (method instanceof IBytecodeMethod) {
return shrikeFactory.makeCFG((IBytecodeMethod) method, c);
return shrikeFactory.makeCFG((IBytecodeMethod) method);
} else {
Assertions.UNREACHABLE();
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)
*/
public int getUse(int j) throws UnsupportedOperationException {
public int getUse(@SuppressWarnings("unused") int j) throws 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
public static TypeAnnotationTargetConverter targetConverterAtMethodInfo(final ClassLoaderReference clRef, final IBytecodeMethod method) {
public static TypeAnnotationTargetConverter targetConverterAtMethodInfo(final ClassLoaderReference clRef) {
return new TypeAnnotationTargetConverter() {
@Override
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() {
@Override
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() {
killNanny();
setCanceled(false);
setCanceled();
timedOut = false;
tooMuchMemory = false;
}
@ -118,7 +118,7 @@ public class ProgressMaster implements IProgressMonitor {
return delegate.isCanceled() || timedOut || tooMuchMemory;
}
public void setCanceled(boolean value) {
public void setCanceled() {
killNanny();
}
@ -131,7 +131,7 @@ public class ProgressMaster implements IProgressMonitor {
@Override
public void cancel() {
setCanceled(true);
setCanceled();
}
/** END Custom change: subtasks and canceling */
@Override

View File

@ -50,12 +50,11 @@ public class AnalysisScopeReader {
*/
public static AnalysisScope readJavaScope(String scopeFileName, File exclusionsFile, ClassLoader javaLoader) throws IOException {
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,
FileProvider fp) throws IOException {
public static AnalysisScope read(AnalysisScope scope, String scopeFileName, File exclusionsFile, ClassLoader javaLoader) throws IOException {
BufferedReader r = null;
try {
// 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;
}
protected static AnalysisScope read(AnalysisScope scope, final URI scopeFileURI, final File exclusionsFile, ClassLoader javaLoader,
FileProvider fp) throws IOException {
protected static AnalysisScope read(AnalysisScope scope, final URI scopeFileURI, final File exclusionsFile, ClassLoader javaLoader) throws IOException {
BufferedReader r = null;
try {
String line;

View File

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

View File

@ -41,7 +41,7 @@ public class CgPanel extends JSplitPane{
this.setLeftComponent(new JScrollPane(tree));
final IrAndSourceViewer irViewer = new IrAndSourceViewer(cg);
final IrAndSourceViewer irViewer = new IrAndSourceViewer();
this.setRightComponent(irViewer.getComponent());
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.IMethod;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.viz.viewer.IrViewer.SelectedPcListner;
@ -30,9 +29,6 @@ public class IrAndSourceViewer {
private IR ir;
public IrAndSourceViewer(CallGraph cg) {
}
public Component getComponent() {

View File

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

View File

@ -74,6 +74,6 @@ public class JDTJavaIRTests extends JavaIRTests {
@Override
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
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;
engine = new JDTJavaSourceAnalysisEngine<I>(project.projectName) {
{

View File

@ -33,7 +33,7 @@ final class TypeInferenceAssertion implements IRAssertion {
@Override
public void check(CallGraph cg) {
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())) {
// Check defs

View File

@ -108,7 +108,7 @@ public class JDTJavaSourceAnalysisEngine<I extends InstanceKey> extends EclipseP
@Override
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

@ -74,6 +74,6 @@ public class JDTClassLoaderFactory extends ClassLoaderFactoryImpl {
}
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.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class JDTSourceLoaderImpl extends JavaSourceLoaderImpl {
private final boolean dump;
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) {
this(loaderRef, parent, exclusions, cha, false);
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
this(loaderRef, parent, cha, false);
}
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, exclusions, cha);
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, cha);
this.dump = dump;
}

View File

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

View File

@ -115,7 +115,7 @@ public class EclipseJavaScriptAnalysisEngine<I extends InstanceKey> extends Ecli
@Override
protected CallGraphBuilder<I> 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);
}
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> getFieldBasedCallGraph() throws CancelException {

View File

@ -25,9 +25,9 @@ public class EclipseAnalysisScopeReader extends AnalysisScopeReader {
public static AnalysisScope readJavaScopeFromPlugin(String scopeFileName, File exclusionsFile, ClassLoader javaLoader) throws IOException {
return readJavaScopeFromPlugin(scopeFileName, exclusionsFile, javaLoader, CorePlugin.getDefault());
}
public static AnalysisScope readJavaScopeFromPlugin(String scopeFileName, File exclusionsFile, ClassLoader javaLoader, Plugin plugIn) throws IOException {
public static AnalysisScope readJavaScopeFromPlugin(String scopeFileName, File exclusionsFile, ClassLoader javaLoader, @SuppressWarnings("unused") Plugin plugIn) throws IOException {
AnalysisScope scope = AnalysisScope.createJavaAnalysisScope();
return read(scope, scopeFileName, exclusionsFile, javaLoader, new EclipseFileProvider(plugIn));
return read(scope, scopeFileName, exclusionsFile, javaLoader);
}
public static AnalysisScope makePrimordialScopeFromPlugin(File exclusionsFile) throws IOException {
@ -38,9 +38,9 @@ public class EclipseAnalysisScopeReader extends AnalysisScopeReader {
* @throws IOException
* @throws IllegalStateException if there are problmes reading wala properties
*/
public static AnalysisScope makePrimordialScopeFromPlugin(File exclusionsFile, Plugin plugIn) throws IOException {
public static AnalysisScope makePrimordialScopeFromPlugin(File exclusionsFile, @SuppressWarnings("unused") Plugin plugIn) throws IOException {
return read(AnalysisScope.createJavaAnalysisScope(), BASIC_FILE, exclusionsFile,
EclipseAnalysisScopeReader.class.getClassLoader(), new EclipseFileProvider(plugIn));
EclipseAnalysisScopeReader.class.getClassLoader());
}
public static AnalysisScope makeJavaBinaryAnalysisScopeFromPlugin(String classPath, File exclusionsFile) throws IOException {

View File

@ -153,7 +153,7 @@ public abstract class EclipseProjectPath<E, P> {
// should ignore directories as well..
return;
}
if (isPrimordialJarFile(j)) {
if (isPrimordialJarFile()) {
List<Module> s = MapUtil.findOrCreateList(modules, loader);
s.add(file.isDirectory() ? (Module) new BinaryDirectoryTreeModule(file) : (Module) new JarFileModule(j));
}
@ -170,7 +170,7 @@ public abstract class EclipseProjectPath<E, P> {
}
}
protected void resolveProjectPathEntry(ILoader loader, boolean includeSource, IPath p) {
protected void resolveProjectPathEntry(boolean includeSource, IPath p) {
IPath projectPath = makeAbsolute(p);
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
@ -281,7 +281,7 @@ public abstract class EclipseProjectPath<E, P> {
* @return true if the given jar file should be handled by the Primordial loader. If false, other provisions should be made to add
* the jar file to the appropriate component of the AnalysisScope. Subclasses can override this method.
*/
protected boolean isPrimordialJarFile(JarFile j) {
protected boolean isPrimordialJarFile() {
return true;
}
@ -335,7 +335,7 @@ public abstract class EclipseProjectPath<E, P> {
return toAnalysisScope(getClass().getClassLoader(), null);
}
public Collection<Module> getModules(ILoader loader, boolean binary) {
public Collection<Module> getModules(ILoader loader) {
return Collections.unmodifiableCollection(modules.get(loader));
}

View File

@ -154,8 +154,7 @@ public class EntryPoints {
}
}
@SuppressWarnings("unused")
private void systemEntry(ClassHierarchy cha, AndroidAnalysisContext loader) {
private void systemEntry(ClassHierarchy cha, @SuppressWarnings("unused") AndroidAnalysisContext loader) {
String[] systemEntyPoints = {
// "android.app.ActivityThread.main([Ljava/lang/String;)V"
// , "com.android.server.ServerThread.run()V"

View File

@ -60,7 +60,7 @@ public class OnlineDynamicCallGraph implements ClassFileTransformer {
}
}
public static void premain(String agentArgs, Instrumentation inst) throws IllegalArgumentException, IOException, InvalidClassFileException {
public static void premain(Instrumentation inst) throws IllegalArgumentException, IOException, InvalidClassFileException {
inst.addTransformer(new OnlineDynamicCallGraph());
}

View File

@ -156,11 +156,12 @@ public class Runtime {
runtime.callStacks.get().push(bashToDescriptor(klass) + "\t" + method);
}
@SuppressWarnings("unused")
public static void termination(String klass, String method, Object receiver, boolean exception) {
runtime.callStacks.get().pop();
}
public static void pop(String klass, String method) {
public static void pop() {
if (runtime.currentSite != null) {
synchronized (runtime) {
if (runtime.output != null) {

View File

@ -54,7 +54,7 @@ public class CodeScraper implements ClassFileTransformer {
}
}
public static void premain(String agentArgs, Instrumentation inst) {
public static void premain(Instrumentation inst) {
inst.addTransformer(new CodeScraper());
}
}

View File

@ -90,7 +90,7 @@ public abstract class Decoder implements Constants {
.make(indexedTypes[(i - OP_iadd) % 4], BinaryOpInstruction.Operator.values()[(i - OP_iadd) / 4]);
}
for (int i = OP_ineg; i <= OP_dneg; i++) {
table[i] = UnaryOpInstruction.make(indexedTypes[i - OP_ineg], IUnaryOpInstruction.Operator.NEG);
table[i] = UnaryOpInstruction.make(indexedTypes[i - OP_ineg]);
}
for (int i = OP_ishl; i <= OP_lushr; i++) {
table[i] = ShiftInstruction.make(indexedTypes[(i - OP_ishl) % 2], ShiftInstruction.Operator.values()[(i - OP_ishl) / 2]);

View File

@ -20,6 +20,7 @@ public interface IInstruction {
/**
* This class is used by IInstruction.visit to dispatch based on the instruction type.
*/
@SuppressWarnings("unused")
public static abstract class Visitor {
public void visitConstant(ConstantInstruction instruction) {
}

View File

@ -28,7 +28,7 @@ public final class UnaryOpInstruction extends Instruction implements IUnaryOpIns
return r;
}
public static UnaryOpInstruction make(String type, IUnaryOpInstruction.Operator operator) throws IllegalArgumentException {
public static UnaryOpInstruction make(String type) throws IllegalArgumentException {
int t = Util.getTypeIndex(type);
if (t < 0 || t > TYPE_double_index) {
throw new IllegalArgumentException("Type " + type + " cannot have a unary operator applied");

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