Declare private methods static wherever possible
If a method is private, there's no risk that a subclass elsewhere might be overriding it and depending on dynamic dispatch to choose the right implementation. So all of these private methods can safely be declared static without risk of regression in either WALA code or unseen third-party code.
This commit is contained in:
parent
e1d2fa9850
commit
72c754e874
|
@ -396,7 +396,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
|
|||
|
||||
}
|
||||
|
||||
private boolean isInterface(AbstractTypeDeclaration decl) {
|
||||
private static boolean isInterface(AbstractTypeDeclaration decl) {
|
||||
return decl instanceof AnnotationTypeDeclaration ||
|
||||
(decl instanceof TypeDeclaration && ((TypeDeclaration)decl).isInterface());
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
|
|||
return visit(fakeCtor, classBinding, oldContext, inits);
|
||||
}
|
||||
|
||||
private IMethodBinding findDefaultCtor(ITypeBinding superClass) {
|
||||
private static IMethodBinding findDefaultCtor(ITypeBinding superClass) {
|
||||
for (IMethodBinding met : superClass.getDeclaredMethods()) {
|
||||
if (met.isConstructor() && met.getParameterTypes().length == 0)
|
||||
return met;
|
||||
|
@ -1832,7 +1832,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
|
|||
* @param isPrivate
|
||||
* @return
|
||||
*/
|
||||
private ITypeBinding findClosestEnclosingClassSubclassOf(ITypeBinding typeOfThis, ITypeBinding owningType, boolean isPrivate) {
|
||||
private static ITypeBinding findClosestEnclosingClassSubclassOf(ITypeBinding typeOfThis, ITypeBinding owningType, boolean isPrivate) {
|
||||
// GENERICS
|
||||
// if (owningType.isParameterizedType())
|
||||
// owningType = owningType.getTypeDeclaration();
|
||||
|
|
|
@ -128,7 +128,7 @@ public class ECJSourceModuleTranslator implements SourceModuleTranslator {
|
|||
libs = paths.snd;
|
||||
}
|
||||
|
||||
private Pair<String[],String[]> computeClassPath(AnalysisScope scope) {
|
||||
private static Pair<String[],String[]> computeClassPath(AnalysisScope scope) {
|
||||
List<String> sources = new LinkedList<>();
|
||||
List<String> libs = new LinkedList<>();
|
||||
for (ClassLoaderReference cl : scope.getLoaders()) {
|
||||
|
|
|
@ -596,7 +596,7 @@ public abstract class JavaIRTests extends IRTests {
|
|||
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
|
||||
}
|
||||
|
||||
private MethodReference getSliceRootReference(String className, String methodName, String methodDescriptor) {
|
||||
private static MethodReference getSliceRootReference(String className, String methodName, String methodDescriptor) {
|
||||
TypeName clsName = TypeName.string2TypeName("L" + className.replace('.', '/'));
|
||||
TypeReference clsRef = TypeReference.findOrCreate(JavaSourceAnalysisScope.SOURCE, clsName);
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ public class SynchronizedBlockDuplicator extends
|
|||
return oldTarget;
|
||||
}
|
||||
|
||||
private boolean contains(RewriteContext<UnwindKey> c, CAstNode n) {
|
||||
private static boolean contains(RewriteContext<UnwindKey> c, CAstNode n) {
|
||||
if (c instanceof SyncContext) {
|
||||
return ((SyncContext) c).containsNode(n);
|
||||
} else {
|
||||
|
@ -176,7 +176,7 @@ public class SynchronizedBlockDuplicator extends
|
|||
* does root represent a synchronized block? if so, return the variable whose
|
||||
* lock is acquired. otherwise, return <code>null</code>
|
||||
*/
|
||||
private String isSynchronizedOnVar(CAstNode root) {
|
||||
private static String isSynchronizedOnVar(CAstNode root) {
|
||||
if (root.getKind() == CAstNode.UNWIND) {
|
||||
CAstNode unwindBody = root.getChild(0);
|
||||
if (unwindBody.getKind() == CAstNode.BLOCK_STMT) {
|
||||
|
|
|
@ -535,7 +535,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
((JavaClass) owner).addField(n);
|
||||
}
|
||||
|
||||
private TypeName toWALATypeName(CAstType type) {
|
||||
private static TypeName toWALATypeName(CAstType type) {
|
||||
return TypeName.string2TypeName(type.getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
|||
processExceptions(newNode, context);
|
||||
}
|
||||
|
||||
private void processExceptions(CAstNode n, WalkContext context) {
|
||||
private static void processExceptions(CAstNode n, WalkContext context) {
|
||||
context.cfg().addPreNode(n, context.getUnwindState());
|
||||
context.cfg().newBlock(true);
|
||||
|
||||
|
@ -412,7 +412,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
private CAstType getType(final String name) {
|
||||
private static CAstType getType(final String name) {
|
||||
return new CAstType.Class() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -153,7 +153,7 @@ public class TestRhinoSourceMap {
|
|||
checkFunctionBodies("jquery_spec_test.js", jquery_spec_testSource);
|
||||
}
|
||||
|
||||
private void checkFunctionBodies(String fileName, String[][] assertions) throws IOException, ClassHierarchyException {
|
||||
private static void checkFunctionBodies(String fileName, String[][] assertions) throws IOException, ClassHierarchyException {
|
||||
Map<String, String> sources = HashMapFactory.make();
|
||||
for(String[] assertion : assertions) {
|
||||
sources.put(assertion[0], assertion[1]);
|
||||
|
|
|
@ -213,7 +213,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
|
||||
}
|
||||
|
||||
private String operationReceiverName(int operationIndex) {
|
||||
private static String operationReceiverName(int operationIndex) {
|
||||
return "$$destructure$rcvr" + operationIndex;
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
return Ast.makeNode(CAstNode.VAR, Ast.makeConstant(operationReceiverName(operationIndex)));
|
||||
}
|
||||
|
||||
private String operationElementName(int operationIndex) {
|
||||
private static String operationElementName(int operationIndex) {
|
||||
return "$$destructure$elt" + operationIndex;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
return Ast.makeNode(CAstNode.VAR, Ast.makeConstant(operationElementName(operationIndex)));
|
||||
}
|
||||
|
||||
private CAstNode translateOpcode(int nodeType) {
|
||||
private static CAstNode translateOpcode(int nodeType) {
|
||||
switch (nodeType) {
|
||||
case Token.POS:
|
||||
case Token.ADD:
|
||||
|
@ -311,26 +311,26 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
return makeCtorCall(value, arguments, context);
|
||||
}
|
||||
|
||||
private boolean isPrologueScript(WalkContext context) {
|
||||
private static boolean isPrologueScript(WalkContext context) {
|
||||
return JavaScriptLoader.bootstrapFileNames.contains(context.script());
|
||||
}
|
||||
|
||||
private Node getCallTarget(FunctionCall n) {
|
||||
private static Node getCallTarget(FunctionCall n) {
|
||||
return n.getTarget();
|
||||
}
|
||||
/**
|
||||
* is n a call to "primitive" within our synthetic modeling code?
|
||||
*/
|
||||
private boolean isPrimitiveCall(WalkContext context, FunctionCall n) {
|
||||
private static boolean isPrimitiveCall(WalkContext context, FunctionCall n) {
|
||||
return isPrologueScript(context) && n.getType() == Token.CALL && getCallTarget(n).getType() == Token.NAME
|
||||
&& getCallTarget(n).getString().equals("primitive");
|
||||
}
|
||||
|
||||
private Node getNewTarget(NewExpression n) {
|
||||
private static Node getNewTarget(NewExpression n) {
|
||||
return n.getTarget();
|
||||
}
|
||||
|
||||
private boolean isPrimitiveCreation(WalkContext context, NewExpression n) {
|
||||
private static boolean isPrimitiveCreation(WalkContext context, NewExpression n) {
|
||||
Node target = getNewTarget(n);
|
||||
return isPrologueScript(context) && n.getType() == Token.NEW && target.getType() == Token.NAME
|
||||
&& target.getString().equals("Primitives");
|
||||
|
@ -585,14 +585,14 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
return cn;
|
||||
}
|
||||
|
||||
private List<Label> getLabels(AstNode node) {
|
||||
private static List<Label> getLabels(AstNode node) {
|
||||
if (node instanceof LabeledStatement || ((node = node.getParent()) instanceof LabeledStatement)) {
|
||||
return ((LabeledStatement)node).getLabels();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private AstNode makeEmptyLabelStmt(String label) {
|
||||
private static AstNode makeEmptyLabelStmt(String label) {
|
||||
Label l = new Label();
|
||||
l.setName(label);
|
||||
LabeledStatement st = new LabeledStatement();
|
||||
|
@ -603,7 +603,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
return st;
|
||||
}
|
||||
|
||||
private WalkContext makeLoopContext(AstNode node, WalkContext arg,
|
||||
private static WalkContext makeLoopContext(AstNode node, WalkContext arg,
|
||||
AstNode breakStmt, AstNode contStmt) {
|
||||
WalkContext loopContext = arg;
|
||||
List<Label> labels = getLabels(node);
|
||||
|
@ -617,7 +617,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
return loopContext;
|
||||
}
|
||||
|
||||
private WalkContext makeBreakContext(AstNode node, WalkContext arg,
|
||||
private static WalkContext makeBreakContext(AstNode node, WalkContext arg,
|
||||
AstNode breakStmt) {
|
||||
WalkContext loopContext = arg;
|
||||
List<Label> labels = getLabels(node);
|
||||
|
|
|
@ -172,7 +172,7 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
|
|||
}
|
||||
*/
|
||||
|
||||
private void addHackedForInLoopSensitivity(JSCFABuilder builder) {
|
||||
private static void addHackedForInLoopSensitivity(JSCFABuilder builder) {
|
||||
final ContextSelector orig = builder.getContextSelector();
|
||||
builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), orig));
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public abstract class TestPointerAnalyses {
|
|||
JSCallGraphUtil.setTranslatorFactory(factory);
|
||||
}
|
||||
|
||||
private Pair<CGNode, NewSiteReference> map(CallGraph CG, Pair<CGNode, NewSiteReference> ptr) {
|
||||
private static Pair<CGNode, NewSiteReference> map(CallGraph CG, Pair<CGNode, NewSiteReference> ptr) {
|
||||
CGNode n = ptr.fst;
|
||||
|
||||
if (! (n.getMethod() instanceof JavaScriptConstructor)) {
|
||||
|
@ -116,7 +116,7 @@ public abstract class TestPointerAnalyses {
|
|||
return Pair.make(caller, new NewSiteReference(site.getProgramCounter(), ptr.snd.getDeclaredType()));
|
||||
}
|
||||
|
||||
private Set<Pair<CGNode, NewSiteReference>> map(CallGraph CG, Set<Pair<CGNode, NewSiteReference>> ptrs) {
|
||||
private static Set<Pair<CGNode, NewSiteReference>> map(CallGraph CG, Set<Pair<CGNode, NewSiteReference>> ptrs) {
|
||||
Set<Pair<CGNode, NewSiteReference>> result = HashSetFactory.make();
|
||||
for(Pair<CGNode, NewSiteReference> ptr : ptrs) {
|
||||
result.add(map(CG, ptr));
|
||||
|
@ -124,7 +124,7 @@ public abstract class TestPointerAnalyses {
|
|||
return result;
|
||||
}
|
||||
|
||||
private Set<Pair<CGNode, NewSiteReference>> ptrs(Set<CGNode> functions, int local, CallGraph CG, PointerAnalysis<? extends InstanceKey> pa) {
|
||||
private static Set<Pair<CGNode, NewSiteReference>> ptrs(Set<CGNode> functions, int local, CallGraph CG, PointerAnalysis<? extends InstanceKey> pa) {
|
||||
Set<Pair<CGNode, NewSiteReference>> result = HashSetFactory.make();
|
||||
|
||||
for(CGNode n : functions) {
|
||||
|
@ -144,7 +144,7 @@ public abstract class TestPointerAnalyses {
|
|||
return result;
|
||||
}
|
||||
|
||||
private boolean isGlobal(Set<CGNode> functions, int local, PointerAnalysis<? extends InstanceKey> pa) {
|
||||
private static boolean isGlobal(Set<CGNode> functions, int local, PointerAnalysis<? extends InstanceKey> pa) {
|
||||
for(CGNode n : functions) {
|
||||
PointerKey l = pa.getHeapModel().getPointerKeyForLocal(n, local);
|
||||
if (l != null) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
this.supportFullPointerAnalysis = supportFullPointerAnalysis;
|
||||
}
|
||||
|
||||
private MethodTargetSelector setupMethodTargetSelector(IClassHierarchy cha, JavaScriptConstructorFunctions constructors2, AnalysisOptions options) {
|
||||
private static MethodTargetSelector setupMethodTargetSelector(IClassHierarchy cha, JavaScriptConstructorFunctions constructors2, AnalysisOptions options) {
|
||||
MethodTargetSelector result = new JavaScriptConstructTargetSelector(constructors2, options.getMethodTargetSelector());
|
||||
if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) {
|
||||
result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result));
|
||||
|
@ -243,7 +243,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
|
||||
Everywhere targetContext = Everywhere.EVERYWHERE;
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean addCGEdgeWithContext(final JSCallGraph cg, CallSiteReference site, IMethod target, CGNode caller,
|
||||
private static boolean addCGEdgeWithContext(final JSCallGraph cg, CallSiteReference site, IMethod target, CGNode caller,
|
||||
Context targetContext) throws CancelException {
|
||||
boolean ret = false;
|
||||
if(target != null) {
|
||||
|
@ -266,14 +266,14 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
* FuncVertex nodes for the reflectively-invoked methods
|
||||
* @throws CancelException
|
||||
*/
|
||||
private OrdinalSet<FuncVertex> getReflectiveTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
|
||||
private static OrdinalSet<FuncVertex> getReflectiveTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
|
||||
SSAAbstractInvokeInstruction invoke = callVertex.getInstruction();
|
||||
VarVertex functionParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(1));
|
||||
return flowGraph.getReachingSet(functionParam, monitor);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
|
||||
private static OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
|
||||
SSAAbstractInvokeInstruction invoke = callVertex.getInstruction();
|
||||
assert invoke.getDeclaredTarget().getName().equals(JavaScriptMethods.ctorAtom);
|
||||
VarVertex objectParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(0));
|
||||
|
|
|
@ -93,7 +93,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
|
|||
}
|
||||
|
||||
// add flow corresponding to a new call edge
|
||||
private void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, IProgressMonitor monitor) throws CancelException {
|
||||
private static void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, IProgressMonitor monitor) throws CancelException {
|
||||
VertexFactory factory = flowgraph.getVertexFactory();
|
||||
JavaScriptInvoke invk = c.getInstruction();
|
||||
FuncVertex caller = c.getCaller();
|
||||
|
@ -116,7 +116,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
|
|||
|
||||
// add data flow corresponding to a reflective invocation via Function.prototype.call
|
||||
// NB: for f.call(...), f will _not_ appear as a call target, but the appropriate argument and return data flow will be set up
|
||||
private void addReflectiveCallEdge(FlowGraph flowgraph, CallVertex c, IProgressMonitor monitor) throws CancelException {
|
||||
private static void addReflectiveCallEdge(FlowGraph flowgraph, CallVertex c, IProgressMonitor monitor) throws CancelException {
|
||||
VertexFactory factory = flowgraph.getVertexFactory();
|
||||
FuncVertex caller = c.getCaller();
|
||||
JavaScriptInvoke invk = c.getInstruction();
|
||||
|
|
|
@ -104,7 +104,7 @@ public class FlowGraph implements Iterable<Vertex> {
|
|||
optimistic_closure = computeClosure(graph, monitor, FuncVertex.class);
|
||||
}
|
||||
|
||||
private <T> GraphReachability<Vertex, T> computeClosure(NumberedGraph<Vertex> graph, IProgressMonitor monitor, final Class<?> type) throws CancelException {
|
||||
private static <T> GraphReachability<Vertex, T> computeClosure(NumberedGraph<Vertex> graph, IProgressMonitor monitor, final Class<?> type) throws CancelException {
|
||||
// prune flowgraph by taking out 'unknown' vertex
|
||||
Graph<Vertex> pruned_flowgraph = GraphSlicer.prune(graph, new Predicate<Vertex>() {
|
||||
@Override
|
||||
|
|
|
@ -100,7 +100,7 @@ public class DefaultSourceExtractor extends DomLessSourceExtractor{
|
|||
domRegion.println("");
|
||||
}
|
||||
|
||||
private String makeRef(String object, String property) {
|
||||
private static String makeRef(String object, String property) {
|
||||
assert object != null && property != null;
|
||||
return object + "[\"" + property + "\"]";
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
|||
handleDOM(tag);
|
||||
}
|
||||
|
||||
private boolean isUsableIdentifier(String x) {
|
||||
private static boolean isUsableIdentifier(String x) {
|
||||
return x != null &&
|
||||
LEGAL_JS_IDENTIFIER_REGEXP.matcher(x).matches() &&
|
||||
!LEGAL_JS_KEYWORD_REGEXP.matcher(x).matches();
|
||||
|
@ -217,7 +217,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
|||
return Pair.make(value, quote);
|
||||
}
|
||||
|
||||
private String extructJS(String attValue) {
|
||||
private static String extructJS(String attValue) {
|
||||
if (attValue == null){
|
||||
return "";
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
|
|||
return new HtmlCallback(entrypointUrl, urlResolver);
|
||||
}
|
||||
|
||||
private File createOutputFile(URL url, boolean delete, boolean useTempName) throws IOException {
|
||||
private static File createOutputFile(URL url, boolean delete, boolean useTempName) throws IOException {
|
||||
File outputFile;
|
||||
String fileName = new File(url.getFile()).getName();
|
||||
if (fileName.length() < 5) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
|||
}
|
||||
}
|
||||
|
||||
private IR makeIRForArgList(CGNode node) {
|
||||
private static IR makeIRForArgList(CGNode node) {
|
||||
// we have: v1 is dummy apply method
|
||||
// v2 is function to be invoked
|
||||
// v3 is argument to be passed as 'this'
|
||||
|
@ -121,7 +121,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
|||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int passArbitraryPropertyValAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
|
||||
private static int passArbitraryPropertyValAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
|
||||
// read an arbitrary property name via EachElementGet
|
||||
int curValNum = nargs + 2;
|
||||
int eachElementGetResult = curValNum++;
|
||||
|
@ -139,7 +139,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
|||
return curValNum;
|
||||
}
|
||||
|
||||
private int passActualPropertyValsAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
|
||||
private static int passActualPropertyValsAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
|
||||
// read an arbitrary property name via EachElementGet
|
||||
int nullVn = nargs + 2;
|
||||
S.addConstant(nullVn, new ConstantValue(null));
|
||||
|
@ -165,7 +165,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
|||
return curValNum;
|
||||
}
|
||||
|
||||
private IR makeIRForNoArgList(CGNode node) {
|
||||
private static IR makeIRForNoArgList(CGNode node) {
|
||||
// kind of a hack; re-use the summarized function infrastructure
|
||||
MethodReference ref = node.getMethod().getReference();
|
||||
IClass declaringClass = node.getMethod().getDeclaringClass();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class JavaScriptFunctionApplyTargetSelector implements MethodTargetSelect
|
|||
this.base = base;
|
||||
}
|
||||
|
||||
private IMethod createApplyDummyMethod(IClass declaringClass) {
|
||||
private static IMethod createApplyDummyMethod(IClass declaringClass) {
|
||||
final MethodReference ref = genSyntheticMethodRef(declaringClass);
|
||||
// number of args doesn't matter
|
||||
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
||||
|
@ -51,7 +51,7 @@ public class JavaScriptFunctionApplyTargetSelector implements MethodTargetSelect
|
|||
|
||||
public static final String SYNTHETIC_APPLY_METHOD_PREFIX = "$$ apply_dummy";
|
||||
|
||||
private MethodReference genSyntheticMethodRef(IClass receiver) {
|
||||
private static MethodReference genSyntheticMethodRef(IClass receiver) {
|
||||
Atom atom = Atom.findOrCreateUnicodeAtom(SYNTHETIC_APPLY_METHOD_PREFIX);
|
||||
Descriptor desc = Descriptor.findOrCreateUTF8(JavaScriptLoader.JS, "()LRoot;");
|
||||
MethodReference ref = MethodReference.findOrCreate(receiver.getReference(), atom, desc);
|
||||
|
|
|
@ -174,14 +174,14 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
|
|||
|
||||
public static final String SYNTHETIC_CALL_METHOD_PREFIX = "$$ call_";
|
||||
|
||||
private MethodReference genSyntheticMethodRef(IClass receiver, int nargs, String key) {
|
||||
private static MethodReference genSyntheticMethodRef(IClass receiver, int nargs, 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);
|
||||
return ref;
|
||||
}
|
||||
|
||||
private String getKey(int nargs, CGNode caller, CallSiteReference site) {
|
||||
private static String getKey(int nargs, CGNode caller, CallSiteReference site) {
|
||||
if (SEPARATE_SYNTHETIC_METHOD_PER_SITE) {
|
||||
return JSCallGraphUtil.getShortName(caller) + "_" + caller.getGraphNodeId() + "_" + site.getProgramCounter();
|
||||
} else {
|
||||
|
@ -189,7 +189,7 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
|
|||
}
|
||||
}
|
||||
|
||||
private int getNumberOfArgsPassed(CGNode caller, CallSiteReference site) {
|
||||
private static int getNumberOfArgsPassed(CGNode caller, CallSiteReference site) {
|
||||
IR callerIR = caller.getIR();
|
||||
SSAAbstractInvokeInstruction callStmts[] = callerIR.getCalls(site);
|
||||
assert callStmts.length == 1;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class RecursionCheckContextSelector implements ContextSelector {
|
|||
return baseContext;
|
||||
}
|
||||
|
||||
private boolean recursiveContext(Context baseContext, IMethod callee) {
|
||||
private static boolean recursiveContext(Context baseContext, IMethod callee) {
|
||||
if (!recursionPossible(callee)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class RecursionCheckContextSelector implements ContextSelector {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean updateForNode(Context baseContext, Collection<IMethod> curEncountered, LinkedList<Pair<Context, Collection<IMethod>>> worklist, CGNode callerNode) {
|
||||
private static boolean updateForNode(Context baseContext, Collection<IMethod> curEncountered, LinkedList<Pair<Context, Collection<IMethod>>> worklist, CGNode callerNode) {
|
||||
final IMethod method = callerNode.getMethod();
|
||||
if (!recursionPossible(method)) {
|
||||
assert !curEncountered.contains(method);
|
||||
|
@ -132,7 +132,7 @@ public class RecursionCheckContextSelector implements ContextSelector {
|
|||
* @param m
|
||||
* @return
|
||||
*/
|
||||
private boolean recursionPossible(IMethod m) {
|
||||
private static boolean recursionPossible(IMethod m) {
|
||||
// object or array constructors cannot be involved
|
||||
if (m.getReference().getName().equals(JavaScriptMethods.ctorAtom)) {
|
||||
TypeReference declaringClass = m.getReference().getDeclaringClass();
|
||||
|
|
|
@ -244,7 +244,7 @@ public class CorrelationFinder {
|
|||
printCorrelatedAccesses(findCorrelatedAccesses(url));
|
||||
}
|
||||
|
||||
private void printCorrelatedAccesses(Map<IMethod, CorrelationSummary> summaries) {
|
||||
private static void printCorrelatedAccesses(Map<IMethod, CorrelationSummary> summaries) {
|
||||
List<Pair<Position, String>> correlations = new ArrayList<>();
|
||||
for(CorrelationSummary summary : summaries.values())
|
||||
correlations.addAll(summary.pp());
|
||||
|
|
|
@ -666,7 +666,7 @@ public class ClosureExtractor extends CAstRewriterExt {
|
|||
return stmts;
|
||||
}
|
||||
|
||||
private CAstNode addSpuriousExnFlow(CAstNode node, CAstControlFlowMap cfg) {
|
||||
private static CAstNode addSpuriousExnFlow(CAstNode node, CAstControlFlowMap cfg) {
|
||||
CAstControlFlowRecorder flow = (CAstControlFlowRecorder)cfg;
|
||||
if(node.getKind() == ASSIGN) {
|
||||
if(node.getChild(0).getKind() == VAR) {
|
||||
|
|
|
@ -179,7 +179,7 @@ public class CorrelatedPairExtractionPolicy extends ExtractionPolicy {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void filterNames(Set<ChildPos> nodes, String indexName) {
|
||||
private static void filterNames(Set<ChildPos> nodes, String indexName) {
|
||||
for(Iterator<ChildPos> iter=nodes.iterator();iter.hasNext();) {
|
||||
CAstNode node = iter.next().getChild();
|
||||
if(node.getKind() == CAstNode.OBJECT_REF) {
|
||||
|
@ -191,7 +191,7 @@ public class CorrelatedPairExtractionPolicy extends ExtractionPolicy {
|
|||
}
|
||||
}
|
||||
|
||||
private Pair<CAstNode, ? extends ExtractionRegion> findClosestContainingBlock(CAstEntity entity, ChildPos startNode, ChildPos endNode, String parmName, List<String> locals) {
|
||||
private static Pair<CAstNode, ? extends ExtractionRegion> findClosestContainingBlock(CAstEntity entity, ChildPos startNode, ChildPos endNode, String parmName, List<String> locals) {
|
||||
ChildPos pos = startNode;
|
||||
CAstNode block = null;
|
||||
int start = -1, end = 0;
|
||||
|
|
|
@ -88,7 +88,7 @@ public class JavaScriptConstructorFunctions {
|
|||
return m;
|
||||
}
|
||||
|
||||
private IMethod makeNullaryValueConstructor(IClass cls, Object value) {
|
||||
private static IMethod makeNullaryValueConstructor(IClass cls, Object value) {
|
||||
JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory();
|
||||
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
||||
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
||||
|
@ -118,7 +118,7 @@ public class JavaScriptConstructorFunctions {
|
|||
return new JavaScriptConstructor(ref, S, cls, cls);
|
||||
}
|
||||
|
||||
private IMethod makeUnaryValueConstructor(IClass cls) {
|
||||
private static IMethod makeUnaryValueConstructor(IClass cls) {
|
||||
JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory();
|
||||
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
||||
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class JSAstTranslator extends AstTranslator {
|
|||
super(loader);
|
||||
}
|
||||
|
||||
private boolean isPrologueScript(WalkContext context) {
|
||||
private static boolean isPrologueScript(WalkContext context) {
|
||||
return JavaScriptLoader.bootstrapFileNames.contains( context.getModule().getName() );
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
}
|
||||
|
||||
private void test(CAstPattern p, CAstNode n, Map names) {
|
||||
private static void test(CAstPattern p, CAstNode n, Map names) {
|
||||
System.err.println(("testing pattern " + p));
|
||||
System.err.println(("testing with input " + CAstPrinter.print(n)));
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
return ((AstPointerKeyFactory) getBuilder().getPointerKeyFactory()).getPointerKeysForReflectedFieldWrite(I, F);
|
||||
}
|
||||
|
||||
private void visitLexical(AstLexicalAccess instruction, final LexicalOperator op) {
|
||||
private static void visitLexical(AstLexicalAccess instruction, final LexicalOperator op) {
|
||||
op.doLexicalPointerKeys(false);
|
||||
// I have no idea what the code below does, but commenting it out doesn't
|
||||
// break any regression tests. --MS
|
||||
|
|
|
@ -306,15 +306,15 @@ public abstract class AbstractSSAConversion {
|
|||
}
|
||||
}
|
||||
|
||||
private <T> void push(ArrayList<T> stack, T elt) {
|
||||
private static <T> void push(ArrayList<T> stack, T elt) {
|
||||
stack.add(elt);
|
||||
}
|
||||
|
||||
private <T> T peek(ArrayList<T> stack) {
|
||||
private static <T> T peek(ArrayList<T> stack) {
|
||||
return stack.get(stack.size()-1);
|
||||
}
|
||||
|
||||
private <T> T pop(ArrayList<T> stack) {
|
||||
private static <T> T pop(ArrayList<T> stack) {
|
||||
T e = stack.get(stack.size()-1);
|
||||
stack.remove(stack.size()-1);
|
||||
return e;
|
||||
|
|
|
@ -332,11 +332,11 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
return null;
|
||||
}
|
||||
|
||||
private <T> void push(ArrayList<T> stack, T elt) {
|
||||
private static <T> void push(ArrayList<T> stack, T elt) {
|
||||
stack.add(elt);
|
||||
}
|
||||
|
||||
private <T> T peek(ArrayList<T> stack) {
|
||||
private static <T> T peek(ArrayList<T> stack) {
|
||||
return stack.get(stack.size()-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
* call sites, as would be required for
|
||||
* {@link #doLexicallyScopedRead(CAstNode, WalkContext, String)}
|
||||
*/
|
||||
private int doLexReadHelper(WalkContext context, final String name, TypeReference type) {
|
||||
private static int doLexReadHelper(WalkContext context, final String name, TypeReference type) {
|
||||
Symbol S = context.currentScope().lookup(name);
|
||||
Scope definingScope = S.getDefiningScope();
|
||||
CAstEntity E = definingScope.getEntity();
|
||||
|
@ -369,7 +369,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
* @param entityName
|
||||
* @param isWrite
|
||||
*/
|
||||
private void markExposedInEnclosingEntities(WalkContext context, final String name, Scope definingScope, TypeReference type, CAstEntity E,
|
||||
private static void markExposedInEnclosingEntities(WalkContext context, final String name, Scope definingScope, TypeReference type, CAstEntity E,
|
||||
final String entityName, boolean isWrite) {
|
||||
Scope curScope = context.currentScope();
|
||||
while (!curScope.equals(definingScope)) {
|
||||
|
@ -1158,7 +1158,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
}
|
||||
|
||||
private boolean checkBlockBoundaries(IncipientCFG icfg) {
|
||||
private static boolean checkBlockBoundaries(IncipientCFG icfg) {
|
||||
MutableIntSet boundaries = IntSetUtil.make();
|
||||
for(PreBasicBlock b : icfg) {
|
||||
if (b.getFirstInstructionIndex() >= 0) {
|
||||
|
@ -2798,7 +2798,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
readOnlyNames = original.readOnlyNames;
|
||||
}
|
||||
|
||||
private int[] buildLexicalUseArray(Pair<Pair<String, String>, Integer>[] exposedNames, String entityName) {
|
||||
private static int[] buildLexicalUseArray(Pair<Pair<String, String>, Integer>[] exposedNames, String entityName) {
|
||||
if (exposedNames != null) {
|
||||
int[] lexicalUses = new int[exposedNames.length];
|
||||
for (int j = 0; j < exposedNames.length; j++) {
|
||||
|
@ -2815,7 +2815,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
}
|
||||
|
||||
private Pair<String, String>[] buildLexicalNamesArray(Pair<Pair<String, String>, Integer>[] exposedNames) {
|
||||
private static Pair<String, String>[] buildLexicalNamesArray(Pair<Pair<String, String>, Integer>[] exposedNames) {
|
||||
if (exposedNames != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Pair<String, String>[] lexicalNames = new Pair[exposedNames.length];
|
||||
|
@ -2993,7 +2993,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
* used to update an instruction that performs all the accesses at the
|
||||
* beginning of the method and defines the locals.
|
||||
*/
|
||||
private void addAccess(WalkContext context, CAstEntity e, Access access) {
|
||||
private static void addAccess(WalkContext context, CAstEntity e, Access access) {
|
||||
context.getAccesses(e).add(access);
|
||||
}
|
||||
|
||||
|
@ -3016,7 +3016,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
* @param valueNumber
|
||||
* the name's value number in the scope of entity
|
||||
*/
|
||||
private void addExposedName(CAstEntity entity, CAstEntity declaration, String name, int valueNumber, boolean isWrite, WalkContext context) {
|
||||
private static void addExposedName(CAstEntity entity, CAstEntity declaration, String name, int valueNumber, boolean isWrite, WalkContext context) {
|
||||
Pair<Pair<String, String>, Integer> newVal = Pair.make(Pair.make(name, context.getEntityName(declaration)), valueNumber);
|
||||
context.exposeNameSet(entity, isWrite).add(newVal);
|
||||
}
|
||||
|
@ -3624,7 +3624,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean handleBinaryOpThrow(CAstNode n, CAstNode op, WalkContext context) {
|
||||
private static boolean handleBinaryOpThrow(CAstNode n, CAstNode op, WalkContext context) {
|
||||
// currently, only integer / and % throw exceptions
|
||||
boolean mayBeInteger = false;
|
||||
Collection labels = context.getControlFlow().getTargetLabels(n);
|
||||
|
@ -3997,7 +3997,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
}
|
||||
|
||||
private int[] gatherArrayDims(WalkContext c, CAstNode n) {
|
||||
private static int[] gatherArrayDims(WalkContext c, CAstNode n) {
|
||||
int numDims = n.getChildCount() - 2;
|
||||
int[] dims = new int[numDims];
|
||||
for (int i = 0; i < numDims; i++)
|
||||
|
@ -4175,7 +4175,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isSimpleSwitch(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
|
||||
private static boolean isSimpleSwitch(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
|
||||
CAstControlFlowMap ctrl = context.getControlFlow();
|
||||
Collection caseLabels = ctrl.getTargetLabels(n);
|
||||
for (Iterator kases = caseLabels.iterator(); kases.hasNext();) {
|
||||
|
|
|
@ -192,7 +192,7 @@ public class CAstPrinter {
|
|||
instance.doXmlTo(top, pos, w);
|
||||
}
|
||||
|
||||
private void doXmlTo(CAstNode top, CAstSourcePositionMap pos, Writer w) {
|
||||
private static void doXmlTo(CAstNode top, CAstSourcePositionMap pos, Writer w) {
|
||||
printTo(top, pos, w, 0, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
/**
|
||||
* Test the MutableSparseIntSet implementation
|
||||
*/
|
||||
private void doMutableIntSet(MutableIntSetFactory factory) {
|
||||
private static void doMutableIntSet(MutableIntSetFactory factory) {
|
||||
MutableIntSet v = factory.parse("{9,17}");
|
||||
MutableIntSet w = factory.make(new int[] {});
|
||||
MutableIntSet x = factory.make(new int[] { 7, 4, 2, 4, 2, 2 });
|
||||
|
@ -351,7 +351,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
/**
|
||||
* Test the MutableSparseIntSet implementation
|
||||
*/
|
||||
private void doMutableLongSet(MutableLongSetFactory factory) {
|
||||
private static void doMutableLongSet(MutableLongSetFactory factory) {
|
||||
MutableLongSet v = factory.parse("{9,17}");
|
||||
MutableLongSet w = factory.make(new long[] {});
|
||||
MutableLongSet x = factory.make(new long[] { 7, 4, 2, 4, 2, 2 });
|
||||
|
@ -707,7 +707,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
Assert.assertTrue(c.size() == 10);
|
||||
}
|
||||
|
||||
private NumberedGraph<Integer> makeBFSTestGraph() {
|
||||
private static NumberedGraph<Integer> makeBFSTestGraph() {
|
||||
// test graph
|
||||
NumberedGraph<Integer> G = SlowSparseNumberedGraph.make();
|
||||
|
||||
|
@ -859,7 +859,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
Assert.assertTrue("Got count " + count, count == 2);
|
||||
}
|
||||
|
||||
private int countEquivalenceClasses(IntegerUnionFind uf) {
|
||||
private static int countEquivalenceClasses(IntegerUnionFind uf) {
|
||||
HashSet<Integer> s = HashSetFactory.make();
|
||||
for (int i = 0; i < uf.size(); i++) {
|
||||
s.add(new Integer(uf.find(i)));
|
||||
|
@ -891,7 +891,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
testSingleBitVector(new OffsetBitVector(100, 10));
|
||||
}
|
||||
|
||||
private void testSingleBitVector(BitVectorBase bv) {
|
||||
private static void testSingleBitVector(BitVectorBase bv) {
|
||||
// does the following not automatically scale the bitvector to
|
||||
// a reasonable size?
|
||||
bv.set(55);
|
||||
|
@ -960,7 +960,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends BitVectorBase> void testBitVectors(T v1, T v2) {
|
||||
private static <T extends BitVectorBase> void testBitVectors(T v1, T v2) {
|
||||
v1.set(100);
|
||||
v1.set(101);
|
||||
v1.set(102);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class CPATest extends WalaTestCase {
|
|||
doCPATest("Lcpa/CPATest2", "(Lcpa/CPATest2$N;I)Lcpa/CPATest2$N;");
|
||||
}
|
||||
|
||||
private void doCPATest(String testClass, String testIdSignature) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
private static void doCPATest(String testClass, String testIdSignature) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
|
||||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class PiNodeCallGraphTest extends WalaTestCase {
|
|||
private static final MemberReference unary2Ref = MethodReference.findOrCreate(whateverRef,
|
||||
Atom.findOrCreateUnicodeAtom("unary2"), Descriptor.findOrCreateUTF8("()V"));
|
||||
|
||||
private CallGraph doGraph(boolean usePiNodes) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
private static CallGraph doGraph(boolean usePiNodes) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
|
||||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
|
@ -86,7 +86,7 @@ public class PiNodeCallGraphTest extends WalaTestCase {
|
|||
return CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(new DefaultIRFactory(), options.getSSAOptions()), cha, scope, false);
|
||||
}
|
||||
|
||||
private void checkCallAssertions(CallGraph cg, int desiredNumberOfTargets, int desiredNumberOfCalls, int numLocalCastCallees) {
|
||||
private static void checkCallAssertions(CallGraph cg, int desiredNumberOfTargets, int desiredNumberOfCalls, int numLocalCastCallees) {
|
||||
|
||||
int numberOfCalls = 0;
|
||||
Set<CGNode> callerNodes = HashSetFactory.make();
|
||||
|
|
|
@ -316,7 +316,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Assert.assertTrue(filePermToStringNode != null);
|
||||
}
|
||||
|
||||
private Collection<CGNode> getSuccNodes(CallGraph cg, Collection<CGNode> nodes) {
|
||||
private static Collection<CGNode> getSuccNodes(CallGraph cg, Collection<CGNode> nodes) {
|
||||
Set<CGNode> succNodes = HashSetFactory.make();
|
||||
for (CGNode newInstanceNode : nodes) {
|
||||
Iterator<? extends CGNode> succNodesIter = cg.getSuccNodes(newInstanceNode);
|
||||
|
|
|
@ -258,7 +258,7 @@ public abstract class AbstractPtrTest {
|
|||
* @return
|
||||
* @throws ClassHierarchyException
|
||||
*/
|
||||
private IClassHierarchy findOrCreateCHA(AnalysisScope scope) throws ClassHierarchyException {
|
||||
private static IClassHierarchy findOrCreateCHA(AnalysisScope scope) throws ClassHierarchyException {
|
||||
if (cachedCHA == null) {
|
||||
cachedCHA = ClassHierarchyFactory.make(scope);
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void checkRemovingNormalOk(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock block,
|
||||
private static void checkRemovingNormalOk(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock block,
|
||||
ISSABasicBlock normalSucc) {
|
||||
if (!block.getLastInstruction().isPEI() || !filter.getFilter(node).alwaysThrowsException(block.getLastInstruction())) {
|
||||
specialCaseThrowFiltered(cfg, normalSucc);
|
||||
|
@ -197,7 +197,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
|
|||
* @param cfg
|
||||
* @param normalSucc
|
||||
*/
|
||||
private void specialCaseThrowFiltered(ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock normalSucc) {
|
||||
private static void specialCaseThrowFiltered(ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock normalSucc) {
|
||||
ISSABasicBlock next = normalSucc;
|
||||
while (!(next.getLastInstruction() instanceof SSAThrowInstruction)) {
|
||||
assertTrue(cfg.getNormalSuccessors(next).iterator().hasNext());
|
||||
|
@ -205,7 +205,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void checkNoNewEdges(ControlFlowGraph<SSAInstruction, ISSABasicBlock> original,
|
||||
private static void checkNoNewEdges(ControlFlowGraph<SSAInstruction, ISSABasicBlock> original,
|
||||
ControlFlowGraph<SSAInstruction, ISSABasicBlock> filtered) {
|
||||
for (ISSABasicBlock block : filtered) {
|
||||
for (ISSABasicBlock normalSucc : filtered.getNormalSuccessors(block)) {
|
||||
|
|
|
@ -98,7 +98,7 @@ public class DeterministicIRTest extends WalaTestCase {
|
|||
/**
|
||||
* @param iterator
|
||||
*/
|
||||
private void checkNoneNull(Iterator<?> iterator) {
|
||||
private static void checkNoneNull(Iterator<?> iterator) {
|
||||
while (iterator.hasNext()) {
|
||||
Assert.assertTrue(iterator.next() != null);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class DynamicCallGraphTest extends DynamicCallGraphTestBase {
|
|||
this(getClasspathEntry("com.ibm.wala.core.testdata"));
|
||||
}
|
||||
|
||||
private CallGraph staticCG(String mainClass, String exclusionsFile) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException {
|
||||
private static CallGraph staticCG(String mainClass, String exclusionsFile) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, exclusionsFile != null? exclusionsFile: CallGraphTestUtil.REGRESSION_EXCLUSIONS);
|
||||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
|
||||
|
|
|
@ -143,7 +143,7 @@ public abstract class DynamicCallGraphTestBase extends WalaTestCase {
|
|||
void edgesTest(CallGraph staticCG, CGNode caller, MethodReference callee);
|
||||
}
|
||||
|
||||
private MethodReference callee(String calleeClass, String calleeMethod) {
|
||||
private static MethodReference callee(String calleeClass, String calleeMethod) {
|
||||
return MethodReference.findOrCreate(TypeReference.findOrCreate(ClassLoaderReference.Application, "L" + calleeClass), Selector.make(calleeMethod));
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public class DalvikTypeInference extends TypeInference {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean containsNonPrimitiveAndZero(DalvikTypeVariable[] types) {
|
||||
private static boolean containsNonPrimitiveAndZero(DalvikTypeVariable[] types) {
|
||||
boolean containsNonPrimitive = false;
|
||||
boolean containsZero = false;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
|
|
|
@ -3136,7 +3136,7 @@ public class DexIMethod implements IBytecodeMethod {
|
|||
// //comment out stop
|
||||
}
|
||||
|
||||
private TypeReference findOutArrayElementType(
|
||||
private static TypeReference findOutArrayElementType(
|
||||
org.jf.dexlib.Code.Instruction[] instrucs, Instruction[] walaInstructions, int instCounter) {
|
||||
if (instCounter < 0 || instrucs[instCounter].opcode != Opcode.FILL_ARRAY_DATA) {
|
||||
throw new IllegalArgumentException();
|
||||
|
|
|
@ -119,7 +119,7 @@ public class WDexClassLoaderImpl extends ClassLoaderImpl {
|
|||
/**
|
||||
* Remove from s any class file module entries which already are in t
|
||||
*/
|
||||
private void removeClassFiles(Set<ModuleEntry> s, Set<ModuleEntry> t) {
|
||||
private static void removeClassFiles(Set<ModuleEntry> s, Set<ModuleEntry> t) {
|
||||
Set<String> old = HashSetFactory.make();
|
||||
for (Iterator<ModuleEntry> it = t.iterator(); it.hasNext();) {
|
||||
ModuleEntry m = it.next();
|
||||
|
@ -135,7 +135,7 @@ public class WDexClassLoaderImpl extends ClassLoaderImpl {
|
|||
s.removeAll(toRemove);
|
||||
}
|
||||
|
||||
private Set<ModuleEntry> getDexFiles(Module M) {
|
||||
private static Set<ModuleEntry> getDexFiles(Module M) {
|
||||
HashSet<ModuleEntry> result = HashSetFactory.make();
|
||||
for (Iterator<? extends ModuleEntry> it = M.getEntries(); it.hasNext();) {
|
||||
ModuleEntry entry = it.next();
|
||||
|
|
|
@ -343,7 +343,7 @@ public class FlatInstantiator implements IInstantiator {
|
|||
return instance;
|
||||
}
|
||||
|
||||
private void createPrimitive(SSAValue instance) {
|
||||
private static void createPrimitive(SSAValue instance) {
|
||||
// XXX; something else?
|
||||
instance.setAssigned();
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ public class Instantiator implements IInstantiator {
|
|||
return instance;
|
||||
}
|
||||
|
||||
private void createPrimitive(SSAValue instance) {
|
||||
private static void createPrimitive(SSAValue instance) {
|
||||
// XXX; something else?
|
||||
instance.setAssigned();
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public class ReuseParameters {
|
|||
*
|
||||
* @see com.ibm.wala.util.ssa.ParameterAccessor
|
||||
*/
|
||||
private int ssaFor(IMethod inCallTo, int paramNo) {
|
||||
private static int ssaFor(IMethod inCallTo, int paramNo) {
|
||||
assert (paramNo >= 0);
|
||||
assert (paramNo < inCallTo.getNumberOfParameters());
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class ReuseParameters {
|
|||
*
|
||||
* @see com.ibm.wala.util.ssa.ParameterAccessor
|
||||
*/
|
||||
private int firstOf(TypeName type, IMethod inCallTo) {
|
||||
private static int firstOf(TypeName type, IMethod inCallTo) {
|
||||
for (int i = 0; i < inCallTo.getNumberOfParameters(); ++i) {
|
||||
if (inCallTo.getParameterType(i).getName().equals(type)) {
|
||||
return i;
|
||||
|
|
|
@ -132,7 +132,7 @@ public class IntentContextInterpreter implements SSAContextInterpreter {
|
|||
}
|
||||
}
|
||||
|
||||
private TypeReference getCaller(final Context ctx, final CGNode node) {
|
||||
private static TypeReference getCaller(final Context ctx, final CGNode node) {
|
||||
if (ctx.get(ContextKey.CALLER) != null) {
|
||||
System.out.println("CALLER CONTEXT" + ctx.get(ContextKey.CALLER));
|
||||
return node.getMethod().getReference().getDeclaringClass();
|
||||
|
|
|
@ -352,7 +352,7 @@ public abstract class AbstractIntRegisterMachine implements FixedPointConstants
|
|||
* @param bb the basic block at whose entry the meet occurs
|
||||
* @return true if the lhs value changes. false otherwise.
|
||||
*/
|
||||
private boolean meet(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
|
||||
private static boolean meet(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
|
||||
|
||||
// boolean changed = meetStacks(lhs, rhs, bb, meeter);
|
||||
|
||||
|
@ -368,7 +368,7 @@ public abstract class AbstractIntRegisterMachine implements FixedPointConstants
|
|||
* @param bb the basic block at whose entry the meet occurs
|
||||
* @return true if the lhs value changes. false otherwise.
|
||||
*/
|
||||
private boolean meetForCatchBlock(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
|
||||
private static boolean meetForCatchBlock(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
|
||||
|
||||
boolean changed = meetLocals(lhs, rhs, bb, meeter);
|
||||
|
||||
|
@ -473,7 +473,7 @@ public abstract class AbstractIntRegisterMachine implements FixedPointConstants
|
|||
* @param bb the basic block at whose entry the meet occurs
|
||||
* @return true if the lhs value changes. false otherwise.
|
||||
*/
|
||||
private boolean meetLocals(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
|
||||
private static boolean meetLocals(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
|
||||
|
||||
boolean changed = false;
|
||||
MachineState L = (MachineState) lhs;
|
||||
|
|
|
@ -1515,7 +1515,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
|
|||
/**
|
||||
* @return the indices i s.t. x[i] == y, or null if none found.
|
||||
*/
|
||||
private int[] extractIndices(int[] x, int y) {
|
||||
private static int[] extractIndices(int[] x, int y) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
if (x[i] == y) {
|
||||
|
|
|
@ -274,7 +274,7 @@ nextMethod:
|
|||
// return test.getName().toString().contains("$"); // PRETTY!
|
||||
// }
|
||||
|
||||
private AndroidEntryPoint makeEntryPointForHeuristic(final IMethod method, final IClassHierarchy cha) {
|
||||
private static AndroidEntryPoint makeEntryPointForHeuristic(final IMethod method, final IClassHierarchy cha) {
|
||||
AndroidComponent compo;
|
||||
{ // Guess component
|
||||
compo = AndroidComponent.from(method, cha);
|
||||
|
@ -404,11 +404,11 @@ nextMethod:
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isAPIComponent(final IMethod method) {
|
||||
private static boolean isAPIComponent(final IMethod method) {
|
||||
return isAPIComponent(method.getDeclaringClass());
|
||||
}
|
||||
|
||||
private boolean isAPIComponent(final IClass cls) {
|
||||
private static boolean isAPIComponent(final IClass cls) {
|
||||
ClassLoaderReference clr = cls.getClassLoader().getReference();
|
||||
if (! (clr.equals(ClassLoaderReference.Primordial) || clr.equals(ClassLoaderReference.Extension))) {
|
||||
if (cls.getName().toString().startsWith("Landroid/")) {
|
||||
|
@ -420,7 +420,7 @@ nextMethod:
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isExcluded(final IClass cls) {
|
||||
private static boolean isExcluded(final IClass cls) {
|
||||
final SetOfClasses set = cls.getClassHierarchy().getScope().getExclusions();
|
||||
if (set == null) {
|
||||
return false; // exclusions null ==> no exclusions ==> no class is excluded
|
||||
|
@ -435,7 +435,7 @@ nextMethod:
|
|||
*
|
||||
* Currently all methods are placed at ExecutionOrder.MULTIPLE_TIMES_IN_LOOP.
|
||||
*/
|
||||
private ExecutionOrder selectPositionForHeuristic() {
|
||||
private static ExecutionOrder selectPositionForHeuristic() {
|
||||
return ExecutionOrder.MULTIPLE_TIMES_IN_LOOP;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ final class TypeInferenceAssertion implements IRAssertion {
|
|||
|
||||
}
|
||||
|
||||
private IR getIR(CallGraph cg, String fullyQualifiedTypeName, String methodName, String methodParameter, String methodReturnType) {
|
||||
private static IR getIR(CallGraph cg, String fullyQualifiedTypeName, String methodName, String methodParameter, String methodReturnType) {
|
||||
IClassHierarchy classHierarchy = cg.getClassHierarchy();
|
||||
MethodReference methodRef = IRTests
|
||||
.descriptorToMethodRef(
|
||||
|
|
|
@ -123,7 +123,7 @@ public class JDTSourceModuleTranslator implements SourceModuleTranslator {
|
|||
this.dump = dump;
|
||||
}
|
||||
|
||||
private void computeClassPath(AnalysisScope scope) {
|
||||
private static void computeClassPath(AnalysisScope scope) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
ClassLoaderReference cl = scope.getApplicationLoader();
|
||||
|
|
|
@ -129,7 +129,7 @@ public class EclipseJavaScriptAnalysisEngine<I extends InstanceKey> extends Ecli
|
|||
return getFieldBasedCallGraph(eps);
|
||||
}
|
||||
|
||||
private String getScriptName(AstMethod m) {
|
||||
private static String getScriptName(AstMethod m) {
|
||||
|
||||
// we want the original including file, since that will be the "script"
|
||||
Position p = m.getSourcePosition();
|
||||
|
|
|
@ -121,7 +121,7 @@ public class EclipseFileProvider extends FileProvider {
|
|||
* @return the URL, or <code>null</code> if the file is not found
|
||||
* @throws IOException
|
||||
*/
|
||||
private URL getFileURLFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
private static URL getFileURLFromPlugin(Plugin p, String fileName) throws IOException {
|
||||
try {
|
||||
URL url = FileLocator.find(p.getBundle(), new Path(fileName), null);
|
||||
if (url == null) {
|
||||
|
@ -159,7 +159,7 @@ public class EclipseFileProvider extends FileProvider {
|
|||
* @param url
|
||||
* @return an escaped version of the URL
|
||||
*/
|
||||
private URL fixupFileURLSpaces(URL url) {
|
||||
private static URL fixupFileURLSpaces(URL url) {
|
||||
String urlString = url.toExternalForm();
|
||||
StringBuffer fixedUpUrl = new StringBuffer();
|
||||
int lastIndex = 0;
|
||||
|
|
|
@ -266,7 +266,7 @@ public abstract class EclipseProjectPath<E, P> {
|
|||
/**
|
||||
* Is javaProject a plugin project?
|
||||
*/
|
||||
private boolean isPluginProject(IProject project) {
|
||||
private static boolean isPluginProject(IProject project) {
|
||||
IPluginModelBase model = findModel(project);
|
||||
if (model == null) {
|
||||
return false;
|
||||
|
@ -349,13 +349,13 @@ public abstract class EclipseProjectPath<E, P> {
|
|||
}
|
||||
}
|
||||
|
||||
private IPluginModelBase findModel(IProject p) {
|
||||
private static IPluginModelBase findModel(IProject p) {
|
||||
// PluginRegistry is specific to Eclipse 3.3+. Use PDECore for compatibility with 3.2
|
||||
// return PluginRegistry.findModel(p);
|
||||
return PDECore.getDefault().getModelManager().findModel(p);
|
||||
}
|
||||
|
||||
private IPluginModelBase findModel(BundleDescription bd) {
|
||||
private static IPluginModelBase findModel(BundleDescription bd) {
|
||||
// PluginRegistry is specific to Eclipse 3.3+. Use PDECore for compatibility with 3.2
|
||||
// return PluginRegistry.findModel(bd);
|
||||
return PDECore.getDefault().getModelManager().findModel(bd);
|
||||
|
|
|
@ -121,7 +121,7 @@ public class OutflowAnalysis {
|
|||
this.specs = specs;
|
||||
}
|
||||
|
||||
private void addEdge(
|
||||
private static void addEdge(
|
||||
Map<FlowType<IExplodedBasicBlock>, Set<FlowType<IExplodedBasicBlock>>> graph,
|
||||
FlowType<IExplodedBasicBlock> source,
|
||||
FlowType<IExplodedBasicBlock> dest) {
|
||||
|
|
|
@ -461,7 +461,7 @@ public class TaintTransferFunctions<E extends ISSABasicBlock> implements
|
|||
return elts;
|
||||
}
|
||||
|
||||
private Set<CodeElement> getStaticFieldAccessCodeElts(SSAFieldAccessInstruction inst) {
|
||||
private static Set<CodeElement> getStaticFieldAccessCodeElts(SSAFieldAccessInstruction inst) {
|
||||
Set<CodeElement> elts = HashSetFactory.make();
|
||||
final FieldReference fieldRef = inst.getDeclaredField();
|
||||
elts.add(new StaticFieldElement(fieldRef));
|
||||
|
@ -490,7 +490,7 @@ public class TaintTransferFunctions<E extends ISSABasicBlock> implements
|
|||
return elts;
|
||||
}
|
||||
|
||||
private IUnaryFlowFunction union(final IUnaryFlowFunction g,
|
||||
private static IUnaryFlowFunction union(final IUnaryFlowFunction g,
|
||||
final IUnaryFlowFunction h) {
|
||||
return new IUnaryFlowFunction() {
|
||||
@Override
|
||||
|
@ -507,7 +507,7 @@ public class TaintTransferFunctions<E extends ISSABasicBlock> implements
|
|||
* @param g
|
||||
* @return { (x, z) | (x, y) \in g, (y, z) \in f }
|
||||
*/
|
||||
private IUnaryFlowFunction compose(final IUnaryFlowFunction f,
|
||||
private static IUnaryFlowFunction compose(final IUnaryFlowFunction f,
|
||||
final IUnaryFlowFunction g) {
|
||||
return new IUnaryFlowFunction() {
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ public class CallRetSourceSpec extends SourceSpec {
|
|||
}
|
||||
}
|
||||
|
||||
private<E extends ISSABasicBlock> Collection<FlowType<E>> getFlowType(
|
||||
BasicBlockInContext<E> block) {
|
||||
private static <E extends ISSABasicBlock> Collection<FlowType<E>> getFlowType(
|
||||
BasicBlockInContext<E> block) {
|
||||
|
||||
HashSet<FlowType<E>> flowSet = new HashSet<>();
|
||||
flowSet.clear();
|
||||
|
|
|
@ -486,7 +486,7 @@ public class SSAtoXMLVisitor implements SSAInstruction.IVisitor {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String typeRefToStr(TypeReference fieldType)
|
||||
private static String typeRefToStr(TypeReference fieldType)
|
||||
throws UTFDataFormatException {
|
||||
Atom className = fieldType.getName().getClassName();
|
||||
Atom pkgName = fieldType.getName().getPackage();
|
||||
|
|
|
@ -269,7 +269,7 @@ public class XMLSummaryWriter {
|
|||
* @param summary
|
||||
* @return
|
||||
*/
|
||||
private String getMethodDescriptor(MethodSummary summary) {
|
||||
private static String getMethodDescriptor(MethodSummary summary) {
|
||||
StringBuilder typeSigs = new StringBuilder("(");
|
||||
|
||||
int i=0;
|
||||
|
|
|
@ -176,7 +176,7 @@ public class CLISCanDroidOptions implements ISCanDroidOptions {
|
|||
}
|
||||
}
|
||||
|
||||
private URI processURIArg(String arg) {
|
||||
private static URI processURIArg(String arg) {
|
||||
if (arg == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
|
|
@ -357,7 +357,7 @@ public class EntryPoints {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String IntentToMethod(String intent) {
|
||||
private static String IntentToMethod(String intent) {
|
||||
if (intent.contentEquals("android.intent.action.MAIN") ||
|
||||
intent.contentEquals("android.media.action.IMAGE_CAPTURE") ||
|
||||
intent.contentEquals("android.media.action.VIDEO_CAPTURE") ||
|
||||
|
|
|
@ -236,7 +236,7 @@ public class CopyWriter {
|
|||
return elems;
|
||||
}
|
||||
|
||||
private int copyEntry(ConstantPoolParser cp, ClassWriter w, int i) throws InvalidClassFileException {
|
||||
private static int copyEntry(ConstantPoolParser cp, ClassWriter w, int i) throws InvalidClassFileException {
|
||||
byte t = cp.getItemType(i);
|
||||
switch (t) {
|
||||
case ClassReader.CONSTANT_String:
|
||||
|
|
|
@ -448,7 +448,7 @@ public abstract class Compiler implements Constants {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean applyPatches(ArrayList<Patch> patches) {
|
||||
private static boolean applyPatches(ArrayList<Patch> patches) {
|
||||
for (Iterator<Patch> i = patches.iterator(); i.hasNext();) {
|
||||
Patch p = i.next();
|
||||
if (!p.apply()) {
|
||||
|
|
|
@ -214,7 +214,7 @@ public abstract class Decoder implements Constants {
|
|||
}
|
||||
}
|
||||
|
||||
private String getPrimitiveType(int t) throws InvalidBytecodeException {
|
||||
private static String getPrimitiveType(int t) throws InvalidBytecodeException {
|
||||
switch (t) {
|
||||
case T_BOOLEAN:
|
||||
return TYPE_boolean;
|
||||
|
@ -698,7 +698,7 @@ public abstract class Decoder implements Constants {
|
|||
return index;
|
||||
}
|
||||
|
||||
private int applyInstructionToStack(Instruction i, int stackLen, byte[] stackWords) throws InvalidBytecodeException {
|
||||
private static int applyInstructionToStack(Instruction i, int stackLen, byte[] stackWords) throws InvalidBytecodeException {
|
||||
stackLen -= i.getPoppedCount();
|
||||
|
||||
if (stackLen < 0) {
|
||||
|
|
|
@ -145,7 +145,7 @@ public final class MethodEditor {
|
|||
}
|
||||
}
|
||||
|
||||
private String getStateMessage(int state) {
|
||||
private static String getStateMessage(int state) {
|
||||
switch (state) {
|
||||
case BEFORE_PASS:
|
||||
return "This operation can only be performed before or after an editing pass";
|
||||
|
|
|
@ -197,7 +197,7 @@ public class Analyzer {
|
|||
return ClassHierarchy.isSubtypeOf(hierarchy, patchType(t1), patchType(t2)) != ClassHierarchy.NO;
|
||||
}
|
||||
|
||||
private boolean isPrimitive(String type) {
|
||||
private static boolean isPrimitive(String type) {
|
||||
return type != null && (!type.startsWith("L") && !type.startsWith("["));
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ public class Analyzer {
|
|||
}
|
||||
}
|
||||
|
||||
private String[] cutArray(String[] a, int len) {
|
||||
private static String[] cutArray(String[] a, int len) {
|
||||
if (len == 0) {
|
||||
return noStrings;
|
||||
} else {
|
||||
|
@ -532,7 +532,7 @@ public class Analyzer {
|
|||
return a||b;
|
||||
}
|
||||
|
||||
private boolean longType(String type) {
|
||||
private static boolean longType(String type) {
|
||||
return Constants.TYPE_long.equals(type) || Constants.TYPE_double.equals(type);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ final public class CTDecoder extends Decoder {
|
|||
return cp.getItemType(index);
|
||||
}
|
||||
|
||||
private Error convertToError(InvalidClassFileException e) {
|
||||
private static Error convertToError(InvalidClassFileException e) {
|
||||
e.printStackTrace();
|
||||
return new Error("Invalid class file: " + e.getMessage());
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class StackMapTableWriter extends Element {
|
|||
this.data = serialize(writer, frames);
|
||||
}
|
||||
|
||||
private byte[] serialize(ClassWriter writer, List<StackMapFrame> frames) throws IOException {
|
||||
private static byte[] serialize(ClassWriter writer, List<StackMapFrame> frames) throws IOException {
|
||||
ByteArrayOutputStream data = new ByteArrayOutputStream();
|
||||
|
||||
for(StackMapFrame frame : frames) {
|
||||
|
|
|
@ -98,7 +98,7 @@ public final class MethodPositions extends PositionsAttribute {
|
|||
* @throws IOException
|
||||
* if the input stream cannot be read
|
||||
*/
|
||||
private Range readRange(DataInputStream in, String startVarName, String endVarName, boolean undefinedAllowed) throws IOException {
|
||||
private static Range readRange(DataInputStream in, String startVarName, String endVarName, boolean undefinedAllowed) throws IOException {
|
||||
boolean valid = true;
|
||||
Range range = null;
|
||||
Position start = null;
|
||||
|
@ -150,7 +150,7 @@ public final class MethodPositions extends PositionsAttribute {
|
|||
* @throws InvalidPositionException
|
||||
* if the read position is invalid
|
||||
*/
|
||||
private Position readPosition(DataInputStream in, String varName) throws IOException, InvalidPositionException {
|
||||
private static Position readPosition(DataInputStream in, String varName) throws IOException, InvalidPositionException {
|
||||
Position pos = null;
|
||||
try {
|
||||
pos = new Position(in.readInt());
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Pair<T,U> implements Serializable {
|
|||
this.snd = snd;
|
||||
}
|
||||
|
||||
private boolean check(Object x, Object y) {
|
||||
private static boolean check(Object x, Object y) {
|
||||
return (x == null) ? (y == null) : x.equals(y);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class Pair<T,U> implements Serializable {
|
|||
return (o instanceof Pair) && check(fst, ((Pair) o).fst) && check(snd, ((Pair) o).snd);
|
||||
}
|
||||
|
||||
private int hc(Object o) {
|
||||
private static int hc(Object o) {
|
||||
return (o == null) ? 0 : o.hashCode();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ public class TwoLevelVector<T> implements IVector<T>, Serializable {
|
|||
return v.get(localX);
|
||||
}
|
||||
|
||||
private int getFirstIndexOnPage(int page) {
|
||||
private static int getFirstIndexOnPage(int page) {
|
||||
return page << LOG_PAGE_SIZE;
|
||||
}
|
||||
|
||||
private int getPageNumber(int x) {
|
||||
private static int getPageNumber(int x) {
|
||||
return x >> LOG_PAGE_SIZE;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class TwoLevelVector<T> implements IVector<T>, Serializable {
|
|||
v.set(localX, value);
|
||||
}
|
||||
|
||||
private int toLocalIndex(int x, int page) {
|
||||
private static int toLocalIndex(int x, int page) {
|
||||
return x - getFirstIndexOnPage(page);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class BimodalMutableIntSet implements MutableIntSet {
|
|||
/**
|
||||
* @return true iff we would like to use the same representation for V as we do for W
|
||||
*/
|
||||
private boolean sameRepresentation(IntSet V, IntSet W) {
|
||||
private static boolean sameRepresentation(IntSet V, IntSet W) {
|
||||
// for now we assume that we always want to use the same representation for
|
||||
// V as
|
||||
// for W.
|
||||
|
|
|
@ -310,7 +310,7 @@ public final class BitVectorIntSet implements MutableIntSet {
|
|||
}
|
||||
}
|
||||
|
||||
private void actOnWord(IntSetAction action, int startingIndex, int word) {
|
||||
private static void actOnWord(IntSetAction action, int startingIndex, int word) {
|
||||
if (word != 0) {
|
||||
if ((word & 0x1) != 0) {
|
||||
action.act(startingIndex);
|
||||
|
|
|
@ -16,7 +16,7 @@ public final class OffsetBitVector extends BitVectorBase<OffsetBitVector> {
|
|||
|
||||
int offset;
|
||||
|
||||
private int wordDiff(int offset1, int offset2) {
|
||||
private static int wordDiff(int offset1, int offset2) {
|
||||
return (offset1 > offset2) ? (offset1 - offset2) >> LOG_BITS_PER_UNIT : -((offset2 - offset1) >> LOG_BITS_PER_UNIT);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,15 +54,15 @@ public class TwoLevelIntVector implements IntVector, Serializable {
|
|||
return v.get(localX);
|
||||
}
|
||||
|
||||
private int toLocalIndex(int x, int page) {
|
||||
private static int toLocalIndex(int x, int page) {
|
||||
return x - getFirstIndexOnPage(page);
|
||||
}
|
||||
|
||||
private int getFirstIndexOnPage(int page) {
|
||||
private static int getFirstIndexOnPage(int page) {
|
||||
return page << LOG_PAGE_SIZE;
|
||||
}
|
||||
|
||||
private int getPageNumber(int x) {
|
||||
private static int getPageNumber(int x) {
|
||||
return x >> LOG_PAGE_SIZE;
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ public class JavaLauncher extends Launcher {
|
|||
return lastProcess;
|
||||
}
|
||||
|
||||
private String makeLibPath() {
|
||||
private static String makeLibPath() {
|
||||
String libPath = System.getProperty("java.library.path");
|
||||
if (libPath == null) {
|
||||
return null;
|
||||
|
|
|
@ -126,7 +126,7 @@ public abstract class Launcher {
|
|||
return p;
|
||||
}
|
||||
|
||||
private String[] buildEnv(Map<String,String> ev) {
|
||||
private static String[] buildEnv(Map<String,String> ev) {
|
||||
String[] result = new String[ev.size()];
|
||||
int i = 0;
|
||||
for (Iterator<Map.Entry<String,String>> it = ev.entrySet().iterator(); it.hasNext();) {
|
||||
|
@ -273,7 +273,7 @@ public abstract class Launcher {
|
|||
/**
|
||||
* Drain some data from the input stream, and print said data to p. Do not block.
|
||||
*/
|
||||
private void drainAndPrint(BufferedInputStream s, PrintStream p) throws IOException {
|
||||
private static void drainAndPrint(BufferedInputStream s, PrintStream p) throws IOException {
|
||||
try {
|
||||
while (s.available() > 0) {
|
||||
byte[] data = new byte[s.available()];
|
||||
|
@ -289,7 +289,7 @@ public abstract class Launcher {
|
|||
/**
|
||||
* Drain all data from the input stream, and print said data to p. Block if necessary.
|
||||
*/
|
||||
private void blockingDrainAndPrint(BufferedInputStream s, PrintStream p) throws IOException {
|
||||
private static void blockingDrainAndPrint(BufferedInputStream s, PrintStream p) throws IOException {
|
||||
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||
try {
|
||||
// gather all the data from the stream.
|
||||
|
@ -310,7 +310,7 @@ public abstract class Launcher {
|
|||
/**
|
||||
* Drain some data from the input stream, and append said data to b. Do not block.
|
||||
*/
|
||||
private void drainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) throws IOException {
|
||||
private static void drainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) throws IOException {
|
||||
try {
|
||||
while (s.available() > 0) {
|
||||
byte[] data = new byte[s.available()];
|
||||
|
@ -326,7 +326,7 @@ public abstract class Launcher {
|
|||
/**
|
||||
* Drain all data from the input stream, and append said data to p. Block if necessary.
|
||||
*/
|
||||
private void blockingDrainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) throws IOException {
|
||||
private static void blockingDrainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) throws IOException {
|
||||
try {
|
||||
int next = s.read();
|
||||
while (next != -1) {
|
||||
|
|
Loading…
Reference in New Issue