This commit is contained in:
Julian Dolby 2017-07-15 14:01:51 -04:00
commit 12e736b36f
86 changed files with 152 additions and 157 deletions

View File

@ -83,7 +83,7 @@ org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled

View File

@ -55,7 +55,7 @@ public class NuValidatorHtmlParser implements IHtmlParser {
parser.setXmlPolicy(XmlViolationPolicy.ALLOW);
parser.setContentHandler(new ContentHandler() {
private Locator locator;
private Stack<ITag> tags = new Stack<>();;
private Stack<ITag> tags = new Stack<>();
private int countLines(char[] ch, int start, int length) {
LineNumberReader r = new LineNumberReader(new StringReader (new String(ch, start, length)));

View File

@ -83,7 +83,7 @@ org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled

View File

@ -132,7 +132,7 @@ public class NodejsRequireTargetSelector implements MethodTargetSelector {
return calledMethod;
}
private JavaScriptInvoke getInvokeInstruction(CGNode caller, CallSiteReference site) {
private static JavaScriptInvoke getInvokeInstruction(CGNode caller, CallSiteReference site) {
IR callerIR = caller.getIR();
SSAAbstractInvokeInstruction callInstrs[] = callerIR.getCalls(site);
assert callInstrs.length == 1;

View File

@ -111,12 +111,12 @@ public class NodejsRequiredSourceModule extends SourceFileModule {
return className;
}
private void loadWrapperSources() throws IOException {
private static void loadWrapperSources() throws IOException {
MODULE_WRAPPER_SOURCE = loadWrapperSource(MODULE_WRAPPER_FILENAME);
JSON_WRAPPER_SOURCE = loadWrapperSource(JSON_WRAPPER_FILENAME);
}
private String loadWrapperSource(String filename) throws IOException {
private static String loadWrapperSource(String filename) throws IOException {
InputStream url = NodejsRequiredSourceModule.class.getClassLoader().getResourceAsStream(filename);
return new String(Streams.inputStream2ByteArray(url));
}

View File

@ -2382,7 +2382,7 @@ private CAstNode[] walkChildren(final Node n, WalkContext context) {
public void warning(String arg0, String arg1, int arg2, String arg3, int arg4) {
// ignore warnings
}
};
}
CAstErrorReporter reporter = new CAstErrorReporter();
CompilerEnvirons compilerEnv = new CompilerEnvirons();

View File

@ -54,7 +54,7 @@ import com.ibm.wala.util.functions.Function;
*
*/
public class FieldBasedCGUtil {
public static enum BuilderType { PESSIMISTIC, OPTIMISTIC, OPTIMISTIC_WORKLIST };
public static enum BuilderType { PESSIMISTIC, OPTIMISTIC, OPTIMISTIC_WORKLIST }
private final JavaScriptTranslatorFactory translatorFactory;

View File

@ -81,7 +81,6 @@ public class JSTypeInference extends AstTypeInference {
result = new DeclaredTypeOperator(new ConeType(cha.getRootClass()));
}
}
;
class JSTypeVarFactory extends TypeVarFactory {
@ -104,7 +103,6 @@ public class JSTypeInference extends AstTypeInference {
}
}
}
;
init(ir, new JSTypeVarFactory(), new JSTypeOperatorFactory());
}

View File

@ -4,7 +4,7 @@ import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
public class PrototypeFieldVertex extends Vertex implements PointerKey {
public enum PrototypeField { __proto__, prototype };
public enum PrototypeField { __proto__, prototype }
private final PrototypeField field;
private final ObjectVertex type;

View File

@ -116,7 +116,7 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
}
public static class FieldBasedJavaScriptAnalysisEngine extends JavaScriptAnalysisEngine<ObjectVertex> {
public enum BuilderType { PESSIMISTIC, OPTIMISTIC, REFLECTIVE };
public enum BuilderType { PESSIMISTIC, OPTIMISTIC, REFLECTIVE }
private BuilderType builderType = BuilderType.OPTIMISTIC;

View File

@ -125,7 +125,7 @@ public class RangeFileMapping implements FileMapping {
public String toString() {
return "[include:"+includePosition+"]"+super.toString();
}
};
}
return new Pos();
} else {

View File

@ -321,7 +321,7 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
public URL getURL() {
return url;
}
};
}
public static Module getPrologueFile(final String name) {
return new Bootstrap(name, JSCallGraphUtil.class.getClassLoader().getResourceAsStream(name), JSCallGraphUtil.class.getClassLoader().getResource(name));

View File

@ -390,13 +390,13 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
public void visitPrototypeLookup(PrototypeLookup instruction) {
}
};
}
@Override
protected ImplicitPointsToSetVisitor makeImplicitPointsToVisitor(LocalPointerKey lpk) {
return new JSImplicitPointsToSetVisitor(this, lpk);
}
};
}
@Override
protected PropagationSystem makeSystem(AnalysisOptions options) {
@ -639,7 +639,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
public String toString() {
return "sub-dispatch for " + instruction + ": " + receiverType + ", " + fieldKey;
}
};
}
system.newSideEffect(new FieldValueDispatch(), fieldKey);
}

View File

@ -153,7 +153,7 @@ public class PropertyNameContextSelector implements ContextSelector {
this.base = base;
}
private enum Frequency { NEVER, SOMETIMES, ALWAYS };
private enum Frequency { NEVER, SOMETIMES, ALWAYS }
private final HashMap<MethodReference, Frequency> usesFirstArgAsPropertyName_cache = HashMapFactory.make();
/** Determine whether the method never/sometimes/always uses its first argument as a property name. */

View File

@ -95,7 +95,7 @@ public class PropertyReadExpander extends CAstRewriter<PropertyReadExpander.Rewr
this.elementTemp = elementTemp;
}
};
}
private final static RewriteContext READ = new RewriteContext() {
@Override

View File

@ -73,7 +73,7 @@ public abstract class AstTypeInference extends TypeInference {
public void visitEcho(AstEchoInstruction inst) {
}
};
}
public AstTypeInference(IR ir, IClassHierarchy cha, TypeAbstraction booleanType, boolean doPrimitives) {
super(ir, doPrimitives);

View File

@ -240,7 +240,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
}
}
};
}
// /////////////////////////////////////////////////////////////////////////
//
@ -1209,7 +1209,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
system.newConstraint(fieldKey, assignOperator, rhs);
}
}
};
}
public void newFieldWrite(CGNode opNode, int objVn, int fieldsVn, final PointerKey rhs) {
newFieldOperation(opNode, objVn, fieldsVn, false, new NormalWriter(rhs));

View File

@ -1385,7 +1385,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
public static enum ScopeType {
LOCAL, GLOBAL, SCRIPT, FUNCTION, TYPE
};
}
private static final boolean DEBUG = false;
@ -1556,7 +1556,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
public Scope getDefiningScope() {
return definingScope;
}
};
}
public abstract class AbstractScope implements Scope {
private final Scope parent;
@ -1711,7 +1711,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
@Override
public abstract CAstEntity getEntity();
};
}
protected AbstractScope makeScriptScope(final CAstEntity s, Scope parent) {
return new AbstractScope(parent) {
@ -2982,7 +2982,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
return false;
}
};
}
/**
* record that in entity e, the access is performed.
@ -4784,7 +4784,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
return globalScope;
}
};
}
/**
* translate module, represented by {@link CAstEntity} N

View File

@ -215,6 +215,6 @@ public interface TranslatorToCAst {
breakNode);
}
}
};
}
}

View File

@ -199,7 +199,7 @@ public abstract class AstMethod implements IMethod {
return (o instanceof LexicalParent) && getName().equals(((LexicalParent) o).getName())
&& getMethod().equals(((LexicalParent) o).getMethod());
}
};
}
public abstract LexicalParent[] getParents();

View File

@ -22,4 +22,4 @@ public interface CAstReference {
CAstType type();
};
}

View File

@ -67,7 +67,7 @@ public abstract class CAstBasicRewriter
public NoKey parent() {
return null;
}
};
}
protected CAstBasicRewriter(CAst Ast, boolean recursive) {
super(Ast, recursive, new NonCopyingContext());

View File

@ -71,7 +71,7 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
*/
Self parent();
};
}
/**
* interface to be implemented by contexts used while traversing the AST
@ -83,7 +83,7 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
*/
K key();
};
}
/**
* represents a rewritten CAst

View File

@ -84,7 +84,7 @@ org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled

View File

@ -28,7 +28,7 @@ public class GetMethodContext {
}
public void baz() {
}
};
}
public static class B extends A {
@Override
@ -40,7 +40,7 @@ public class GetMethodContext {
@Override
public void baz() {
}
};
}
public static class C extends B {
@Override
@ -49,7 +49,7 @@ public class GetMethodContext {
@Override
public void bar() {
}
};
}
public static void main(String[] args) throws IllegalAccessException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
Method m;

View File

@ -83,7 +83,7 @@ org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled

View File

@ -36,7 +36,6 @@ public final class SemiSparseMutableIntSetTest extends WalaTestCase {
// --- Test cases
@SuppressWarnings("static-method")
@Test public void testCase1() {
final SemiSparseMutableIntSet ssmIntSet = new SemiSparseMutableIntSet();
ssmIntSet.add(1);

View File

@ -93,7 +93,7 @@ org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled

View File

@ -66,11 +66,11 @@ public class ArrayBoundsGraphBuilder {
this.lowerBoundGraph.updateNodeEdges();
this.upperBoundGraph.updateNodeEdges();
this.bundleDeadEnds(this.lowerBoundGraph);
this.bundleDeadEnds(this.upperBoundGraph);
bundleDeadEnds(this.lowerBoundGraph);
bundleDeadEnds(this.upperBoundGraph);
this.collapseNonPhiEdges(this.lowerBoundGraph);
this.collapseNonPhiEdges(this.upperBoundGraph);
collapseNonPhiEdges(this.lowerBoundGraph);
collapseNonPhiEdges(this.upperBoundGraph);
this.lowerBoundGraph.updateNodeEdges();
this.upperBoundGraph.updateNodeEdges();
@ -185,7 +185,7 @@ public class ArrayBoundsGraphBuilder {
*
* @param graph
*/
private void bundleDeadEnds(ArrayBoundsGraph graph) {
private static void bundleDeadEnds(ArrayBoundsGraph graph) {
final Set<HyperNode<Integer>> nodes = new HashSet<>();
nodes.addAll(graph.getNodes().values());
@ -207,7 +207,7 @@ public class ArrayBoundsGraphBuilder {
*
* @param graph
*/
private void collapseNonPhiEdges(ArrayBoundsGraph graph) {
private static void collapseNonPhiEdges(ArrayBoundsGraph graph) {
final Map<HyperNode<Integer>, DirectedHyperEdge<Integer>> inEdges = new HashMap<HyperNode<Integer>, DirectedHyperEdge<Integer>>();
final Set<DirectedHyperEdge<Integer>> edges = new HashSet<>();
edges.addAll(graph.getEdges());

View File

@ -51,10 +51,10 @@ public class ConditionNormalizer {
if (i == 0) {
// make sure the other is lhs
this.op = this.swapOperator(this.op);
this.op = swapOperator(this.op);
}
if (!branchIsTaken) {
this.op = this.negateOperator(this.op);
this.op = negateOperator(this.op);
}
this.rhs = var;
}
@ -73,7 +73,7 @@ public class ConditionNormalizer {
return this.rhs;
}
private Operator negateOperator(Operator op) {
private static Operator negateOperator(Operator op) {
switch (op) {
case EQ:
return Operator.NE;
@ -93,7 +93,7 @@ public class ConditionNormalizer {
}
}
private Operator swapOperator(Operator op) {
private static Operator swapOperator(Operator op) {
switch (op) {
case EQ:
return op;

View File

@ -23,5 +23,5 @@ public class SoftFinalHyperNode<T> extends HyperNode<T> {
if (weight.equals(Weight.NOT_SET) || this.getWeight().equals(Weight.NOT_SET)) {
super.setWeight(weight);
}
};
}
}

View File

@ -31,7 +31,7 @@ public class InitializedBitVectorSolver extends BitVectorSolver<CGNode> {
return newBV();
}
private BitVectorVariable newBV() {
private static BitVectorVariable newBV() {
/*
* If we do not initialize BitVectorVariable, with a BitVector, it contains
* null, which may crash in combination with {@link BitVectorMinusVector}

View File

@ -129,7 +129,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
return EmptyIterator.instance();
}
private SSAInstruction[] makeStatements(JavaTypeContext context) {
private static SSAInstruction[] makeStatements(JavaTypeContext context) {
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
// vn1 is the string parameter
@ -149,7 +149,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
return result;
}
private IR makeIR(IMethod method, JavaTypeContext context) {
private static IR makeIR(IMethod method, JavaTypeContext context) {
SSAInstruction instrs[] = makeStatements(context);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), null);
}

View File

@ -173,7 +173,7 @@ public class ClassNewInstanceContextInterpreter extends AbstractReflectionInterp
return null;
}
private IMethod getPublicDefaultCtor(IClass klass) {
private static IMethod getPublicDefaultCtor(IClass klass) {
IMethod ctorMethod = klass.getMethod(defCtorSelector);
if (ctorMethod != null && ctorMethod.isPublic() && ctorMethod.getDeclaringClass() == klass) {
return ctorMethod;

View File

@ -47,7 +47,7 @@ class ClassNewInstanceContextSelector implements ContextSelector {
return null;
}
private boolean isTypeConstant(InstanceKey instance) {
private static boolean isTypeConstant(InstanceKey instance) {
if (instance instanceof ConstantKey) {
ConstantKey c = (ConstantKey) instance;
if (c.getValue() instanceof IClass) {

View File

@ -106,7 +106,7 @@ public class GetClassContextInterpeter implements SSAContextInterpreter {
return EmptyIterator.instance();
}
private SSAInstruction[] makeStatements(JavaTypeContext context) {
private static SSAInstruction[] makeStatements(JavaTypeContext context) {
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
int nextLocal = 2;
int retValue = nextLocal++;
@ -126,7 +126,7 @@ public class GetClassContextInterpeter implements SSAContextInterpreter {
return result;
}
private IR makeIR(IMethod method, JavaTypeContext context) {
private static IR makeIR(IMethod method, JavaTypeContext context) {
SSAInstruction instrs[] = makeStatements(context);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), null);
}

View File

@ -150,7 +150,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
* @param cls the class
* @param name the name
*/
private Collection<IMethod> getDeclaredNormalMethods(IClass cls,Atom name) {
private static Collection<IMethod> getDeclaredNormalMethods(IClass cls,Atom name) {
Collection<IMethod> result = HashSetFactory.make();
for (IMethod m : cls.getDeclaredMethods()) {
if (!m.isInit() && !m.isClinit() && m.getSelector().getName().equals(name)) {
@ -166,7 +166,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
* @param cls the class
* @param name the name
*/
private Collection<IMethod> getAllNormalPublicMethods(IClass cls,Atom name) {
private static Collection<IMethod> getAllNormalPublicMethods(IClass cls,Atom name) {
Collection<IMethod> result = HashSetFactory.make();
Collection<IMethod> allMethods = null;
allMethods = cls.getAllMethods();
@ -186,7 +186,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
* @param returnValues the possible return values for this method
* @return the statements
*/
private SSAInstruction[] getParticularMethodStatements
private static SSAInstruction[] getParticularMethodStatements
(
MethodReference ref,
Collection<IMethod> returnValues,
@ -217,7 +217,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
return result;
}
private SSAInstruction[] makeGetMethodStatements
private static SSAInstruction[] makeGetMethodStatements
(
GetMethodContext context,
Map<Integer,ConstantValue> constants,
@ -234,7 +234,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
/**
* Create statements for {@link Class#getDeclaredMethod(String, Class...)}.
*/
private SSAInstruction[] makeGetDeclaredMethodStatements(GetMethodContext context, Map<Integer, ConstantValue> constants,Atom name) {
private static SSAInstruction[] makeGetDeclaredMethodStatements(GetMethodContext context, Map<Integer, ConstantValue> constants,Atom name) {
IClass cls = context.getType().getType();
if (cls == null) {
return getParticularMethodStatements(GET_DECLARED_METHOD, null, context, constants);

View File

@ -114,7 +114,7 @@ public class GetMethodContextSelector implements ContextSelector {
* If <tt>instance</tt> is a {@link ConstantKey} and its value is an instance of {@link IClass},
* return that value. Otherwise, return <tt>null</tt>.
*/
private IClass getTypeConstant(InstanceKey instance) {
private static IClass getTypeConstant(InstanceKey instance) {
if (instance instanceof ConstantKey) {
ConstantKey c = (ConstantKey) instance;
if (c.getValue() instanceof IClass) {
@ -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 boolean mayUnderstand(CGNode caller,CallSiteReference site,IMethod targetMethod,InstanceKey instance) {
private static boolean mayUnderstand(CGNode caller,CallSiteReference site,IMethod targetMethod,InstanceKey instance) {
return UNDERSTOOD_METHOD_REFS.contains(targetMethod.getReference())
&& getTypeConstant(instance) != null;
}

View File

@ -128,7 +128,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
return getIR(node);
}
private IR makeIR(IMethod method, JavaTypeContext context) {
private static IR makeIR(IMethod method, JavaTypeContext context) {
Map<Integer, ConstantValue> constants = HashMapFactory.make();
if (method.getReference().equals(GET_CONSTRUCTOR)) {
SSAInstruction instrs[] = makeGetCtorStatements(context, constants);
@ -224,7 +224,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* Get all non-constructor, non-class-initializer methods declared by a class
*/
private Collection<IMethod> getDeclaredNormalMethods(IClass cls) {
private static Collection<IMethod> getDeclaredNormalMethods(IClass cls) {
Collection<IMethod> result = HashSetFactory.make();
for (IMethod m : cls.getDeclaredMethods()) {
if (!m.isInit() && !m.isClinit()) {
@ -237,7 +237,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* Get all non-constructor, non-class-initializer methods declared by a class and all its superclasses
*/
private Collection<IMethod> getAllNormalPublicMethods(IClass cls) {
private static Collection<IMethod> getAllNormalPublicMethods(IClass cls) {
Collection<IMethod> result = HashSetFactory.make();
Collection<IMethod> allMethods = null;
allMethods = cls.getAllMethods();
@ -252,7 +252,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* Get all the constructors of a class
*/
private Collection<IMethod> getConstructors(IClass cls) {
private static Collection<IMethod> getConstructors(IClass cls) {
Collection<IMethod> result = HashSetFactory.make();
for (IMethod m : cls.getDeclaredMethods()) {
if (m.isInit()) {
@ -265,7 +265,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* Get all the public constructors of a class
*/
private Collection<IMethod> getPublicConstructors(IClass cls) {
private static Collection<IMethod> getPublicConstructors(IClass cls) {
Collection<IMethod> result = HashSetFactory.make();
for (IMethod m : cls.getDeclaredMethods()) {
if (m.isInit() && m.isPublic()) {
@ -280,7 +280,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
*
* @param returnValues the possible return values for this method.
*/
private SSAInstruction[] getMethodArrayStatements(MethodReference ref, Collection<IMethod> returnValues, JavaTypeContext context,
private static SSAInstruction[] getMethodArrayStatements(MethodReference ref, Collection<IMethod> returnValues, JavaTypeContext context,
Map<Integer, ConstantValue> constants) {
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
int nextLocal = ref.getNumberOfParameters() + 2;
@ -327,7 +327,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
*
* @param returnValues the possible return values for this method.
*/
private SSAInstruction[] getParticularMethodStatements(MethodReference ref, Collection<IMethod> returnValues,
private static SSAInstruction[] getParticularMethodStatements(MethodReference ref, Collection<IMethod> returnValues,
JavaTypeContext context, Map<Integer, ConstantValue> constants) {
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
int nextLocal = ref.getNumberOfParameters() + 2;
@ -356,7 +356,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getConstructor()
*/
private SSAInstruction[] makeGetCtorStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetCtorStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getParticularMethodStatements(GET_CONSTRUCTOR, null, context, constants);
@ -366,7 +366,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
// TODO
private SSAInstruction[] makeGetCtorsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetCtorsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getMethodArrayStatements(GET_DECLARED_CONSTRUCTORS, null, context, constants);
@ -375,7 +375,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
}
private SSAInstruction[] makeGetMethodStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetMethodStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getParticularMethodStatements(GET_METHOD, null, context, constants);
@ -384,7 +384,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
}
private SSAInstruction[] makeGetMethodsStatments(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetMethodsStatments(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getMethodArrayStatements(GET_METHODS, null, context, constants);
@ -396,7 +396,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getConstructor()
*/
private SSAInstruction[] makeGetDeclCtorStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetDeclCtorStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getParticularMethodStatements(GET_DECLARED_CONSTRUCTOR, null, context, constants);
@ -405,7 +405,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
}
private SSAInstruction[] makeGetDeclCtorsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetDeclCtorsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getMethodArrayStatements(GET_DECLARED_CONSTRUCTORS, null, context, constants);
@ -417,7 +417,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getDeclaredMethod()
*/
private SSAInstruction[] makeGetDeclaredMethodStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetDeclaredMethodStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getParticularMethodStatements(GET_DECLARED_METHOD, null, context, constants);
@ -429,7 +429,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getDeclaredMethod()
*/
private SSAInstruction[] makeGetDeclaredMethodsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
private static SSAInstruction[] makeGetDeclaredMethodsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
if (cls == null) {
return getMethodArrayStatements(GET_DECLARED_METHODS, null, context, constants);

View File

@ -56,7 +56,7 @@ class JavaLangClassContextSelector implements ContextSelector {
return null;
}
private IClass getTypeConstant(InstanceKey instance) {
private static IClass getTypeConstant(InstanceKey instance) {
if (instance instanceof ConstantKey) {
ConstantKey c = (ConstantKey) instance;
if (c.getValue() instanceof IClass) {
@ -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 boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance) {
private static boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance) {
return UNDERSTOOD_METHOD_REFS.contains(targetMethod.getReference()) && getTypeConstant(instance) != null;
}

View File

@ -105,7 +105,7 @@ class ReflectiveInvocationSelector implements ContextSelector {
/**
* This object may understand a dispatch to Constructor.newInstance().
*/
private boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance) {
private static boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance) {
if (instance instanceof ConstantKey) {
if (targetMethod.getReference().equals(ReflectiveInvocationInterpreter.METHOD_INVOKE) ||
isConstructorConstant(instance)
@ -116,7 +116,7 @@ class ReflectiveInvocationSelector implements ContextSelector {
return false;
}
private boolean isConstructorConstant(InstanceKey instance) {
private static boolean isConstructorConstant(InstanceKey instance) {
if (instance instanceof ConstantKey) {
ConstantKey c = (ConstantKey) instance;
if (c.getConcreteType().getReference().equals(TypeReference.JavaLangReflectConstructor)) {

View File

@ -346,7 +346,7 @@ public abstract class AbstractIntStackMachine 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);
@ -362,7 +362,7 @@ public abstract class AbstractIntStackMachine 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 = meetStacksAtCatchBlock(lhs, bb, meeter);
changed |= meetLocals(lhs, rhs, bb, meeter);
@ -377,7 +377,7 @@ public abstract class AbstractIntStackMachine implements FixedPointConstants {
* @param bb the basic block at whose entry the meet occurs
* @return true if the lhs value changes. false otherwise.
*/
private boolean meetStacksAtCatchBlock(IVariable lhs, BasicBlock bb, Meeter meeter) {
private static boolean meetStacksAtCatchBlock(IVariable lhs, BasicBlock bb, Meeter meeter) {
boolean changed = false;
MachineState L = (MachineState) lhs;
@ -412,7 +412,7 @@ public abstract class AbstractIntStackMachine implements FixedPointConstants {
* @param bb the basic block at whose entry the meet occurs
* @return true if the lhs value changes. false otherwise.
*/
private boolean meetStacks(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
private static boolean meetStacks(IVariable lhs, IVariable[] rhs, BasicBlock bb, Meeter meeter) {
boolean changed = false;
MachineState L = (MachineState) lhs;
@ -465,7 +465,7 @@ public abstract class AbstractIntStackMachine 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;

View File

@ -267,7 +267,7 @@ public class TypeInference extends SSAInference<TypeVariable> implements FixedPo
return "delared type := " + type;
}
public boolean isNullary() {
public static boolean isNullary() {
return true;
}

View File

@ -129,7 +129,7 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
clearPis(getInstructions());
}
private void clearPis(SSAInstruction[] instructions) {
private static void clearPis(SSAInstruction[] instructions) {
for (int i = 0; i < instructions.length; i++) {
if (instructions[i] instanceof SSAPiInstruction) {
instructions[i] = null;
@ -216,7 +216,7 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
/**
* set to null any slots in the array with phi instructions
*/
private void clearPhis(SSAInstruction[] instructions) {
private static void clearPhis(SSAInstruction[] instructions) {
for (int i = 0; i < instructions.length; i++) {
if (instructions[i] instanceof SSAPhiInstruction) {
instructions[i] = null;

View File

@ -31,7 +31,7 @@ public class NullPointerState extends AbstractVariable<NullPointerState> {
* Inital state is UNKNOWN.
* Lattice: BOTH < { NULL, NOT_NULL } < UNKNOWN
*/
public enum State { UNKNOWN, BOTH, NULL, NOT_NULL };
public enum State { UNKNOWN, BOTH, NULL, NOT_NULL }
// maps ssa variable number -> State
private final State[] vars;

View File

@ -181,7 +181,7 @@ public class ClassLoaderImpl implements IClassLoader {
/**
* 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();
@ -345,7 +345,7 @@ public class ClassLoaderImpl implements IClassLoader {
return result;
}
private byte[] getEntryBytes(JarEntry entry, Long size, InputStream is) throws IOException {
private static byte[] getEntryBytes(JarEntry entry, Long size, InputStream is) throws IOException {
if (size == null) {
return null;
}
@ -556,7 +556,7 @@ public class ClassLoaderImpl implements IClassLoader {
/**
* get the contents of a jar file. if any IO exceptions occur, catch and return null.
*/
private void getJarFileContents(JarFileModule archive) {
private static void getJarFileContents(JarFileModule archive) {
String jarFileName = archive.getJarFile().getName();
InputStream s = null;
try {

View File

@ -496,7 +496,7 @@ public abstract class ShrikeBTMethod implements IMethod, BytecodeConstants {
copyVisitorSetsToArrays(simpleVisitor, info);
}
private void copyVisitorSetsToArrays(SimpleVisitor simpleVisitor, BytecodeInfo info) {
private static void copyVisitorSetsToArrays(SimpleVisitor simpleVisitor, BytecodeInfo info) {
info.newSites = new NewSiteReference[simpleVisitor.newSites.size()];
int i = 0;
for (Iterator<NewSiteReference> it = simpleVisitor.newSites.iterator(); it.hasNext();) {

View File

@ -343,7 +343,7 @@ public final class ShrikeCTMethod extends ShrikeBTMethod implements IBytecodeMet
ClassReader.AttrIterator iter = new AttrIterator();
getClassReader().initMethodAttributeIterator(shrikeMethodIndex, iter);
return ((ShrikeClass)getDeclaringClass()).getReader(iter, attrName, reader);
return ShrikeClass.getReader(iter, attrName, reader);
}
private CodeReader getCodeReader() {

View File

@ -305,7 +305,7 @@ public final class ShrikeClass extends JVMClass<IClassLoader> {
T getReader(ClassReader.AttrIterator iter) throws InvalidClassFileException;
}
<T> T getReader(ClassReader.AttrIterator iter, String attrName, GetReader<T> reader) {
static <T> T getReader(ClassReader.AttrIterator iter, String attrName, GetReader<T> reader) {
// search for the attribute
try {
for (; iter.isValid(); iter.advance()) {

View File

@ -148,7 +148,7 @@ public class CallFlowEdges {
}
// TODO optimize
private IntSet getDomain(IBinaryNaturalRelation r) {
private static IntSet getDomain(IBinaryNaturalRelation r) {
MutableIntSet result = MutableSparseIntSet.makeEmpty();
int maxKeyValue = r.maxKeyValue();
for (int i = 0; i <= maxKeyValue; i++) {

View File

@ -229,7 +229,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
* The budget specified in the {@link RefinementPolicy} was exceeded on all refinement passes
*/
BUDGETEXCEEDED
};
}
/**
* re-initialize state for a new query
@ -501,7 +501,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
/**
* do all instance keys in p2set pass ikeyPred?
*/
private boolean passesPred(Collection<InstanceKeyAndState> curP2Set, final Predicate<InstanceKey> ikeyPred) {
private static boolean passesPred(Collection<InstanceKeyAndState> curP2Set, final Predicate<InstanceKey> ikeyPred) {
return Util.forAll(curP2Set, new Predicate<InstanceKeyAndState>() {
@Override
@ -2000,11 +2000,11 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
}
}
private SSAAbstractInvokeInstruction[] getCallInstrs(CGNode node, CallSiteReference site) {
private static SSAAbstractInvokeInstruction[] getCallInstrs(CGNode node, CallSiteReference site) {
return node.getIR().getCalls(site);
}
private boolean hasNullIR(CGNode node) {
private static boolean hasNullIR(CGNode node) {
boolean ret = node.getMethod().isNative();
assert node.getIR() != null || ret;
return ret;
@ -2457,7 +2457,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
return true;
}
private boolean predHoldsForPk(PointerKey curPk, Predicate<InstanceKey> pred, PointerAnalysis<InstanceKey> pa) {
private static boolean predHoldsForPk(PointerKey curPk, Predicate<InstanceKey> pred, PointerAnalysis<InstanceKey> pa) {
PointerKey curPkForPAHeapModel = convertToHeapModel(curPk, pa.getHeapModel());
OrdinalSet<InstanceKey> pointsToSet = pa.getPointsToSet(curPkForPAHeapModel);
for (InstanceKey ik : pointsToSet) {
@ -2468,7 +2468,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
return true;
}
private PointerKey convertToHeapModel(PointerKey curPk, HeapModel heapModel) {
private static PointerKey convertToHeapModel(PointerKey curPk, HeapModel heapModel) {
return AbstractFlowGraph.convertPointerKeyToHeapModel(curPk, heapModel);
}

View File

@ -336,7 +336,7 @@ public abstract class AbstractDemandFlowGraph extends AbstractFlowGraph {
protected abstract FlowStatementVisitor makeVisitor(CGNode node);
private void debugPrintIR(IR ir) {
private static void debugPrintIR(IR ir) {
if (DEBUG) {
if (ir == null) {
System.err.println("\n No statements\n");

View File

@ -531,7 +531,7 @@ public class SimpleDemandPointerFlowGraph extends SlowSparseNumberedGraph<Object
return new StatementVisitor(node, ir, du);
}
private void debugPrintIR(IR ir) {
private static void debugPrintIR(IR ir) {
if (DEBUG) {
if (ir == null) {
System.err.println("\n No statements\n");

View File

@ -133,7 +133,7 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
return result;
}
private void convertStmtsToMemoryAccess(Collection<Statement> stmts, Collection<MemoryAccess> result) {
private static void convertStmtsToMemoryAccess(Collection<Statement> stmts, Collection<MemoryAccess> result) {
if (stmts == null) {
return;
}

View File

@ -57,7 +57,7 @@ public class AllApplicationEntrypoints extends HashSet<Entrypoint> {
/**
* @return true iff klass is loaded by the application loader.
*/
private boolean isApplicationClass(AnalysisScope scope, IClass klass) {
private static boolean isApplicationClass(AnalysisScope scope, IClass klass) {
return scope.getApplicationLoader().equals(klass.getClassLoader().getReference());
}
}

View File

@ -209,7 +209,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
public void visitArrayLoad(SSAArrayLoadInstruction instruction) {
pointsToSet = analysis.computeImplicitPointsToSetAtALoad(node, instruction);
}
};
}
protected ImplicitPointsToSetVisitor makeImplicitPointsToVisitor(LocalPointerKey lpk) {
return new ImplicitPointsToSetVisitor(this, lpk);

View File

@ -70,7 +70,7 @@ public class PointerKeyComparator implements Comparator {
}
}
private int compareLocalKey(LocalPointerKey key1, Object key2) {
private static int compareLocalKey(LocalPointerKey key1, Object key2) {
if (key2 instanceof LocalPointerKey) {
int l1 = key1.getValueNumber();
int l2 = ((LocalPointerKey)key2).getValueNumber();
@ -91,7 +91,7 @@ public class PointerKeyComparator implements Comparator {
else return -1;
}
private int compareReturnValueKey(ReturnValueKey key1, Object key2) {
private static int compareReturnValueKey(ReturnValueKey key1, Object key2) {
if (key2 instanceof ReturnValueKey) {
int n1 = key1.getNode().getGraphNodeId();
int n2 = ((ReturnValueKey)key2).getNode().getGraphNodeId();
@ -106,7 +106,7 @@ public class PointerKeyComparator implements Comparator {
else return -1;
}
private int compareExceptionKey(ExceptionReturnValueKey key1, Object key2) {
private static int compareExceptionKey(ExceptionReturnValueKey key1, Object key2) {
if (key2 instanceof ExceptionReturnValueKey) {
int n1 = key1.getNode().getGraphNodeId();
int n2 = ((ExceptionReturnValueKey)key2).getNode().getGraphNodeId();

View File

@ -1490,6 +1490,6 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
@Override
public IAnalysisCacheView getAnalysisCache() {
return analysisCache;
};
}
}

View File

@ -97,7 +97,7 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
/**
* @return a relation in map m corresponding to a key
*/
private IBinaryNaturalRelation findOrCreateRelation(Map<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation> m,
private static IBinaryNaturalRelation findOrCreateRelation(Map<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation> m,
UnaryOperator<PointsToSetVariable> key) {
IBinaryNaturalRelation result = m.get(key);
if (result == null) {
@ -110,7 +110,7 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
/**
* @return a Relation object to track implicit equations using the operator
*/
private IBinaryNaturalRelation makeRelation(AbstractOperator op) {
private static IBinaryNaturalRelation makeRelation(AbstractOperator op) {
byte[] implementation = null;
if (op instanceof AssignOperator) {
// lots of assignments.
@ -225,7 +225,7 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
/**
* @return true iff this equation should be represented implicitly in this data structure
*/
private boolean useImplicitRepresentation(IFixedPointStatement s) {
private static boolean useImplicitRepresentation(IFixedPointStatement s) {
AbstractStatement eq = (AbstractStatement) s;
AbstractOperator op = eq.getOperator();
return (op instanceof AssignOperator || op instanceof PropagationCallGraphBuilder.FilterOperator);

View File

@ -499,7 +499,7 @@ public class PropagationSystem extends DefaultFixedPointSolver<PointsToSetVariab
}
}
private TypeReference makeArray(TypeReference element, int dim) {
private static TypeReference makeArray(TypeReference element, int dim) {
TypeReference iArrayRef = element;
for (int i = 0; i < dim; i++) {
iArrayRef = TypeReference.findOrCreateArrayOf(iArrayRef);

View File

@ -108,7 +108,7 @@ public class ReflectionHandler {
*
* @return set of nodes whose interpretation has changed.
*/
private Set<CGNode> modifyFactoryInterpreter(Statement returnStatement, Collection<Statement> casts,
private static Set<CGNode> modifyFactoryInterpreter(Statement returnStatement, Collection<Statement> casts,
RTAContextInterpreter contextInterpreter, IClassHierarchy cha) {
HashSet<CGNode> result = HashSetFactory.make();

View File

@ -727,7 +727,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
}
protected boolean isRootType(IClass klass) {
return getBuilder().isRootType(klass);
return SSAPropagationCallGraphBuilder.isRootType(klass);
}
/*
@ -2184,12 +2184,12 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
return true;
}
private boolean isRootType(IClass klass) {
private static boolean isRootType(IClass klass) {
return klass.getClassHierarchy().isRootClass(klass);
}
@SuppressWarnings("unused")
private boolean isRootType(FilteredPointerKey.TypeFilter filter) {
private static boolean isRootType(FilteredPointerKey.TypeFilter filter) {
if (filter instanceof FilteredPointerKey.SingleClassFilter) {
return isRootType(((FilteredPointerKey.SingleClassFilter) filter).getConcreteType());
} else {

View File

@ -72,7 +72,6 @@ public class TargetMethodContextSelector implements ContextSelector {
return (o instanceof MethodDispatchContext) && ((MethodDispatchContext) o).getTargetMethod().equals(M);
}
}
;
return new MethodDispatchContext();
}

View File

@ -72,7 +72,7 @@ public abstract class CallStringContextSelector implements ContextSelector {
public CallString getCallString() {
return cs;
}
};
}
protected final ContextSelector base;

View File

@ -268,7 +268,7 @@ public class ZeroXInstanceKeys implements InstanceKeyFactory {
}
}
private boolean isReflectiveType(TypeReference type) {
private static boolean isReflectiveType(TypeReference type) {
return type.equals(TypeReference.JavaLangReflectConstructor) || type.equals(TypeReference.JavaLangReflectMethod);
}

View File

@ -264,6 +264,6 @@ public class DelegatingExplicitCallGraph extends ExplicitCallGraph {
@Override
protected ExplicitEdgeManager makeEdgeManger() {
return new DelegatingEdgeManager();
};
}
}

View File

@ -34,7 +34,7 @@ public class ExceptionPrunedCFG {
public boolean hasExceptionalEdge(T src, T dst) {
return false;
}
};
}
public static <I, T extends IBasicBlock<I>> PrunedCFG<I, T> make(ControlFlowGraph<I, T> cfg) {
return PrunedCFG.make(cfg, new ExceptionEdgePruner<I, T>(cfg));

View File

@ -38,7 +38,7 @@ implements EdgeFilter<Block> {
.contains(dst);
final SSAInstruction relevantInstruction = src.getLastInstruction();
if (hasExceptionalEdge && relevantInstruction != null) {
if (this.weKnowAllExceptions(relevantInstruction)) {
if (weKnowAllExceptions(relevantInstruction)) {
final Collection<TypeReference> thrownExceptions = relevantInstruction
.getExceptionTypes();
@ -79,7 +79,7 @@ implements EdgeFilter<Block> {
* @return if we know all exceptions, that can occur at this address from
* getExceptionTypes()
*/
private boolean weKnowAllExceptions(SSAInstruction instruction) {
private static boolean weKnowAllExceptions(SSAInstruction instruction) {
return !((instruction instanceof SSAAbstractInvokeInstruction) || (instruction instanceof SSAAbstractThrowInstruction));
}
}

View File

@ -595,7 +595,7 @@ public class ClassHierarchy implements IClassHierarchy {
* @param selector method selector
* @return the method if found, else null
*/
private IMethod findMethod(IClass clazz, Selector selector) {
private static IMethod findMethod(IClass clazz, Selector selector) {
return clazz.getMethod(selector);
}
@ -787,7 +787,7 @@ public class ClassHierarchy implements IClassHierarchy {
}
}
private Set<IClass> getSuperclasses(IClass c) throws ClassHierarchyException {
private static Set<IClass> getSuperclasses(IClass c) throws ClassHierarchyException {
HashSet<IClass> result = HashSetFactory.make(3);
while (c.getSuperclass() != null) {
result.add(c.getSuperclass());

View File

@ -77,7 +77,7 @@ import com.ibm.wala.util.intset.OrdinalSet;
public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
/** BEGIN Custom change: control deps */
public enum Dependency {CONTROL_DEP, DATA_AND_CONTROL_DEP};
public enum Dependency {CONTROL_DEP, DATA_AND_CONTROL_DEP}
private final SlowSparseNumberedLabeledGraph<Statement, Dependency> delegate =
new SlowSparseNumberedLabeledGraph<Statement, Dependency>(Dependency.DATA_AND_CONTROL_DEP);
@ -738,7 +738,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
}
}
private boolean hasBasePointer(SSAInstruction use) {
private static boolean hasBasePointer(SSAInstruction use) {
if (use instanceof SSAFieldAccessInstruction) {
SSAFieldAccessInstruction f = (SSAFieldAccessInstruction) use;
return !f.isStatic();
@ -751,7 +751,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
}
}
private int getBasePointer(SSAInstruction use) {
private static int getBasePointer(SSAInstruction use) {
if (use instanceof SSAFieldAccessInstruction) {
SSAFieldAccessInstruction f = (SSAFieldAccessInstruction) use;
return f.getRef();
@ -788,7 +788,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
/**
* @return {@link IntSet} representing instruction indices of each PEI in the ir
*/
private IntSet getPEIs(final IR ir) {
private static IntSet getPEIs(final IR ir) {
BitVectorIntSet result = new BitVectorIntSet();
for (int i = 0; i < ir.getInstructions().length; i++) {
if (ir.getInstructions()[i] != null && ir.getInstructions()[i].isPEI()) {
@ -852,7 +852,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
/**
* Convert a NORMAL or PHI Statement to an SSAInstruction
*/
private SSAInstruction statement2SSAInstruction(SSAInstruction[] instructions, Statement s) {
private static SSAInstruction statement2SSAInstruction(SSAInstruction[] instructions, Statement s) {
SSAInstruction statement = null;
switch (s.getKind()) {
case NORMAL:
@ -1040,7 +1040,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
/**
* @return the set of all locations read by any callee at a call site.
*/
private OrdinalSet<PointerKey> unionHeapLocations(CallGraph cg, CGNode n, SSAAbstractInvokeInstruction call,
private static OrdinalSet<PointerKey> unionHeapLocations(CallGraph cg, CGNode n, SSAAbstractInvokeInstruction call,
Map<CGNode, OrdinalSet<PointerKey>> loc) {
BitVectorIntSet bv = new BitVectorIntSet();
for (CGNode t : cg.getPossibleTargets(n, call.getCallSite())) {

View File

@ -172,7 +172,7 @@ public class MethodBypass {
* @param type
* @return Atom that represents the package name, or null if this is the unnamed package.
*/
private Atom extractPackage(TypeReference type) {
private static Atom extractPackage(TypeReference type) {
String s = type.getName().toString();
int index = s.lastIndexOf('/');
if (index == -1) {

View File

@ -56,7 +56,7 @@ public class SyntheticIR extends IR {
/**
* throw an assertion if the instruction array contains a phi instruction
*/
private void repOK(SSAInstruction[] instructions) {
private static void repOK(SSAInstruction[] instructions) {
for (SSAInstruction s : instructions) {
if (s instanceof SSAPhiInstruction) {
Assertions.UNREACHABLE();

View File

@ -751,5 +751,5 @@ public abstract class IR implements IRView {
*/
public SSAOptions getOptions() {
return options;
};
}
}

View File

@ -1050,7 +1050,7 @@ public class SSABuilder extends AbstractIntStackMachine {
/**
* @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) {
assert x != null;
int count = 0;
for (int i = 0; i < x.length; i++) {

View File

@ -234,7 +234,7 @@ public final class Descriptor {
return result.toString();
}
private void appendSemicolonIfNeeded(StringBuffer result, TypeName p) {
private static void appendSemicolonIfNeeded(StringBuffer result, TypeName p) {
if (p.isArrayType()) {
TypeName e = p.getInnermostElementType();
String x = e.toUnicodeString();

View File

@ -48,7 +48,7 @@ public class FormalTypeParameter extends Signature {
interfaceBounds = parseForInterfaceBounds(s);
}
private TypeSignature parseForClassBound(String s) {
private static TypeSignature parseForClassBound(String s) {
int start = s.indexOf(':');
if (start == s.length() - 1) {
return null;
@ -64,7 +64,7 @@ public class FormalTypeParameter extends Signature {
}
}
private TypeSignature[] parseForInterfaceBounds(String s) {
private static TypeSignature[] parseForInterfaceBounds(String s) {
List<TypeSignature> list = new LinkedList<TypeSignature>();
int start = s.indexOf(':');
@ -85,7 +85,7 @@ public class FormalTypeParameter extends Signature {
return list.toArray(result);
}
private String parseForId(String s) throws IllegalArgumentException {
private static String parseForId(String s) throws IllegalArgumentException {
if (s.indexOf(':') == -1) {
throw new IllegalArgumentException(s);
}

View File

@ -87,7 +87,7 @@ public class ShrikeClassReaderHandle {
* Read is into bytes
* @throws IOException
*/
private void readBytes(InputStream is, ByteArrayOutputStream bytes) throws IOException {
private static void readBytes(InputStream is, ByteArrayOutputStream bytes) throws IOException {
int n = 0;
byte[] buffer = new byte[1024];
while (n > -1) {

View File

@ -416,7 +416,7 @@ public class SSAValueManager {
throw new IllegalArgumentException("The argument key may not be null");
}
final SSAValue cand;;
final SSAValue cand;
currentScope--;
assert(currentScope >= 0 );
cand = getCurrent(key);

View File

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

View File

@ -121,7 +121,7 @@ public class IrViewer extends JPanel{
static final int NA = -1;
private int parseIrLine(String line) {
private static int parseIrLine(String line) {
int firstSpace = line.indexOf(' ');
if (firstSpace > 0) {
String pcString = line.substring(0, firstSpace);

View File

@ -61,7 +61,7 @@ import com.ibm.wala.util.functions.Function;
public class EclipseJavaScriptAnalysisEngine<I extends InstanceKey> extends EclipseProjectSourceAnalysisEngine<IJavaScriptProject, I> {
public enum BuilderType { PESSIMISTIC, OPTIMISTIC, REFLECTIVE };
public enum BuilderType { PESSIMISTIC, OPTIMISTIC, REFLECTIVE }
private final BuilderType builderType;

View File

@ -73,7 +73,7 @@ public class JsdtUtil {
public static class CGInfo {
public final Graph<IMember> cg = SlowSparseNumberedGraph.make();
public final Set<FunctionInvocation> calls = HashSetFactory.make();
};
}
public static Set<ModuleEntry> getJavaScriptCodeFromProject(String project) throws IOException, CoreException {
IJavaScriptProject p = JavaScriptHeadlessUtil.getJavaScriptProjectFromWorkspace(project);

View File

@ -74,7 +74,7 @@ public abstract class EclipseProjectPath<E, P> {
public interface ILoader {
ClassLoaderReference ref();
};
}
/**
* Eclipse projects are modeled with 3 loaders, as described above.
@ -93,7 +93,7 @@ public abstract class EclipseProjectPath<E, P> {
public ClassLoaderReference ref() {
return ref;
}
};
}
public enum AnalysisScopeType {
NO_SOURCE, SOURCE_FOR_PROJ, SOURCE_FOR_PROJ_AND_LINKED_PROJS

View File

@ -45,7 +45,7 @@ public final class Debug {
public boolean isHigherPriority(LogLevel l) {
return priority > l.priority;
}
};
}
private static PrintStream OUT_STREAM = System.out;

View File

@ -52,7 +52,7 @@ public class Topological {
finishTime = null;
Graph<T> G_T = GraphInverter.invert(graph);
return DFS.iterateFinishTime(G_T, rev);
};
}
};
}
}

View File

@ -339,7 +339,6 @@ public class SemiSparseMutableIntSet implements MutableIntSet {
return next;
}
}
;
if (sparsePart.isEmpty()) {
if (densePart == null || densePart.isZero()) {