Merge branch 'master' of https://github.com/wala/WALA
This commit is contained in:
commit
11585f3d34
|
@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
|
|
@ -287,16 +287,13 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
|
|||
|
||||
private final T fSourcePosition;
|
||||
|
||||
private final Set<CAstAnnotation> annotations;
|
||||
|
||||
public ClassEntity(ITypeBinding jdtType, String name, Collection<CAstQualifier> quals, Collection<CAstEntity> entities,
|
||||
T pos, Set<CAstAnnotation> annotations) {
|
||||
T pos) {
|
||||
fName = name;
|
||||
fQuals = quals;
|
||||
fEntities = entities;
|
||||
fJdtType = jdtType;
|
||||
fSourcePosition = pos;
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -534,9 +531,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
|
|||
|
||||
Collection<CAstQualifier> quals = JDT2CAstUtils.mapModifiersToQualifiers(modifiers, isInterface, isAnnotation);
|
||||
|
||||
Set<CAstAnnotation> annotations = handleAnnotations(typeBinding);
|
||||
|
||||
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n), annotations);
|
||||
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n));
|
||||
}
|
||||
|
||||
private CAstEntity visit(AnonymousClassDeclaration n, WalkContext context) {
|
||||
|
|
|
@ -15,10 +15,6 @@ public class Monitor2 {
|
|||
|
||||
public void incr() { synchronized(this) { i++; } }
|
||||
|
||||
private static boolean test(Object o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void main(String[] a) {
|
||||
new Monitor2().incr();
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
private 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, cache));
|
||||
result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -272,6 +272,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
return flowGraph.getReachingSet(functionParam, monitor);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
|
||||
SSAAbstractInvokeInstruction invoke = callVertex.getInstruction();
|
||||
assert invoke.getDeclaredTarget().getName().equals(JavaScriptMethods.ctorAtom);
|
||||
|
|
|
@ -37,7 +37,7 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
|
|||
|
||||
SSAContextInterpreter contextInterpreter = setupSSAContextInterpreter(cha, options, cache, appContextInterpreter);
|
||||
|
||||
setupMethodTargetSelector(cha, options, cache);
|
||||
setupMethodTargetSelector(cha, options);
|
||||
|
||||
setupContextSelector(options, appContextSelector, doOneCFA);
|
||||
|
||||
|
@ -70,11 +70,11 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
|
|||
}
|
||||
|
||||
|
||||
private void setupMethodTargetSelector(IClassHierarchy cha, JSAnalysisOptions options, IAnalysisCacheView cache) {
|
||||
private void setupMethodTargetSelector(IClassHierarchy cha, JSAnalysisOptions options) {
|
||||
MethodTargetSelector targetSelector = new JavaScriptConstructTargetSelector(cha, options
|
||||
.getMethodTargetSelector());
|
||||
if (options.handleCallApply()) {
|
||||
targetSelector = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(targetSelector, cache));
|
||||
targetSelector = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(targetSelector));
|
||||
}
|
||||
if (options.useLoadFileTargetSelector()) {
|
||||
targetSelector = new LoadFileTargetSelector(targetSelector, this);
|
||||
|
|
|
@ -62,11 +62,8 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
|
|||
private static final TypeName CALL_TYPE_NAME = TypeName.findOrCreate("Lprologue.js/Function_prototype_call");
|
||||
private final MethodTargetSelector base;
|
||||
|
||||
private IAnalysisCacheView cache;
|
||||
|
||||
public JavaScriptFunctionDotCallTargetSelector(MethodTargetSelector base, IAnalysisCacheView cache2) {
|
||||
public JavaScriptFunctionDotCallTargetSelector(MethodTargetSelector base) {
|
||||
this.base = base;
|
||||
this.cache = cache2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -377,7 +377,7 @@ public class JSAstTranslator extends AstTranslator {
|
|||
resultVal, context.currentScope().getConstantValue( null )));
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
throw new RuntimeException("Cannot translate primitive " + primitiveCall.getChild(0).getValue());
|
||||
throw new RuntimeException("Cannot translate primitive " + primitiveCall.getChild(0).getValue(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,10 +83,6 @@ public class AstCallGraph extends ExplicitCallGraph {
|
|||
public class AstCGNode extends ExplicitNode {
|
||||
private Set<Function<Object, Object>> callbacks;
|
||||
|
||||
private IR cachedIR;
|
||||
|
||||
private DefUse cachedDU;
|
||||
|
||||
private AstCGNode(IMethod method, Context context) {
|
||||
super(method, context);
|
||||
}
|
||||
|
|
|
@ -740,13 +740,6 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isEqual(Object a, Object b) {
|
||||
if (a == null)
|
||||
return b == null;
|
||||
else
|
||||
return a.equals(b);
|
||||
}
|
||||
|
||||
private Set<PointerKey> discoveredUpwardFunargs = HashSetFactory.make();
|
||||
|
||||
/**
|
||||
|
|
|
@ -135,8 +135,6 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
private class CopyPropagationRecord {
|
||||
final int rhs;
|
||||
|
||||
final int lhs;
|
||||
|
||||
final int instructionIndex;
|
||||
|
||||
final Set<Object> renamedUses = HashSetFactory.make(2);
|
||||
|
@ -163,11 +161,10 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
return (o instanceof CopyPropagationRecord) && instructionIndex == ((CopyPropagationRecord) o).instructionIndex;
|
||||
}
|
||||
|
||||
private CopyPropagationRecord(int instructionIndex, int lhs, int rhs) {
|
||||
private CopyPropagationRecord(int instructionIndex, int rhs) {
|
||||
if (DEBUG_UNDO)
|
||||
System.err.println(("new copy record for instruction #" + instructionIndex + ", rhs value is " + rhs));
|
||||
this.rhs = rhs;
|
||||
this.lhs = lhs;
|
||||
this.instructionIndex = instructionIndex;
|
||||
}
|
||||
|
||||
|
@ -445,7 +442,7 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
|
||||
assignments.put(rhs, lhs);
|
||||
|
||||
CopyPropagationRecord rec = new CopyPropagationRecord(index, lhs, newRhs);
|
||||
CopyPropagationRecord rec = new CopyPropagationRecord(index, newRhs);
|
||||
push(R[lhs], rec);
|
||||
if (topR(rhs) != null) {
|
||||
topR(rhs).addChild(rec);
|
||||
|
|
|
@ -79,7 +79,7 @@ public class NullPointerExceptionInterTest extends WalaTestCase {
|
|||
CallGraphBuilder builder = Util.makeNCFABuilder(1, options, cache, cha, scope);
|
||||
cg = builder.makeCallGraph(options, null);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class NullPointerExceptionIntraTest extends WalaTestCase {
|
|||
try {
|
||||
cha = ClassHierarchyFactory.make(scope, factory);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class GetTargetsTest extends WalaTestCase {
|
|||
try {
|
||||
cha = ClassHierarchyFactory.make(scope, factory);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class InnerClassesTest extends WalaTestCase {
|
|||
try {
|
||||
cha = ClassHierarchyFactory.make(scope, factory);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class InterfaceTest extends WalaTestCase {
|
|||
try {
|
||||
cha = ClassHierarchyFactory.make(scope, factory);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public class LocalNamesTest extends WalaTestCase {
|
|||
try {
|
||||
cha = ClassHierarchyFactory.make(scope, factory);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class TypeInferenceTest extends WalaTestCase {
|
|||
try {
|
||||
cha = ClassHierarchyFactory.make(scope, factory);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,10 +63,10 @@ public class ContextSensitiveReachingDefs {
|
|||
*/
|
||||
private final ReachingDefsDomain domain = new ReachingDefsDomain();
|
||||
|
||||
public ContextSensitiveReachingDefs(CallGraph cg, IAnalysisCacheView cache) {
|
||||
public ContextSensitiveReachingDefs(CallGraph cg) {
|
||||
this.cha = cg.getClassHierarchy();
|
||||
// we use an ICFGSupergraph, which basically adapts ExplodedInterproceduralCFG to the ISupergraph interface
|
||||
this.supergraph = ICFGSupergraph.make(cg, cache);
|
||||
this.supergraph = ICFGSupergraph.make(cg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,7 +90,7 @@ public class DataflowTest extends WalaTestCase {
|
|||
try {
|
||||
cha = ClassHierarchyFactory.make(scope);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception();
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,8 +184,7 @@ public class DataflowTest extends WalaTestCase {
|
|||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
IAnalysisCacheView cache = new AnalysisCacheImpl();
|
||||
ContextSensitiveReachingDefs reachingDefs = new ContextSensitiveReachingDefs(cg, cache);
|
||||
ContextSensitiveReachingDefs reachingDefs = new ContextSensitiveReachingDefs(cg);
|
||||
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, Pair<CGNode, Integer>> result = reachingDefs.analyze();
|
||||
ISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode> supergraph = reachingDefs.getSupergraph();
|
||||
for (BasicBlockInContext<IExplodedBasicBlock> bb : supergraph) {
|
||||
|
|
|
@ -83,8 +83,7 @@ public class InitializerTest {
|
|||
|
||||
System.out.println("Start");
|
||||
|
||||
IAnalysisCacheView cache = new AnalysisCacheImpl();
|
||||
StaticInitializer reachingDefs = new StaticInitializer(cg, cache);
|
||||
StaticInitializer reachingDefs = new StaticInitializer(cg);
|
||||
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, IClass> result = reachingDefs.analyze();
|
||||
ISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode> supergraph = reachingDefs.getSupergraph();
|
||||
for (BasicBlockInContext<IExplodedBasicBlock> bb : supergraph) {
|
||||
|
|
|
@ -68,9 +68,9 @@ public class StaticInitializer {
|
|||
return initialized;
|
||||
}
|
||||
|
||||
public StaticInitializer(CallGraph cg, IAnalysisCacheView cache) {
|
||||
public StaticInitializer(CallGraph cg) {
|
||||
cha = cg.getClassHierarchy();
|
||||
supergraph = ICFGSupergraph.make(cg, cache);
|
||||
supergraph = ICFGSupergraph.make(cg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -198,15 +198,9 @@ public class PDFCallGraph {
|
|||
private static class ApplicationLoaderFilter extends Predicate<CGNode> {
|
||||
|
||||
@Override public boolean test(CGNode o) {
|
||||
if (o instanceof CGNode) {
|
||||
CGNode n = (CGNode) o;
|
||||
return n.getMethod().getDeclaringClass().getClassLoader().getReference().equals(ClassLoaderReference.Application);
|
||||
} else if (o instanceof LocalPointerKey) {
|
||||
LocalPointerKey l = (LocalPointerKey) o;
|
||||
return test(l.getNode());
|
||||
} else {
|
||||
if (o == null)
|
||||
return false;
|
||||
}
|
||||
return o.getMethod().getDeclaringClass().getClassLoader().getReference().equals(ClassLoaderReference.Application);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
|
||||
solver.solve(progress);
|
||||
|
||||
final Graph<T> deleted = createDeletedGraph(solver);
|
||||
final Graph<T> deleted = createDeletedGraph();
|
||||
|
||||
for (final T ch : catched) {
|
||||
deleted.addNode(ch);
|
||||
|
@ -161,8 +161,8 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
}
|
||||
}
|
||||
|
||||
private Graph<T> createDeletedGraph(NullPointerSolver<T> solver) {
|
||||
NegativeCFGBuilderVisitor nCFGbuilder = new NegativeCFGBuilderVisitor(solver);
|
||||
private Graph<T> createDeletedGraph() {
|
||||
NegativeCFGBuilderVisitor nCFGbuilder = new NegativeCFGBuilderVisitor();
|
||||
for (T bb : cfg) {
|
||||
nCFGbuilder.work(bb);
|
||||
}
|
||||
|
@ -201,10 +201,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
private class NegativeCFGBuilderVisitor implements IVisitor {
|
||||
|
||||
private final Graph<T> deleted;
|
||||
private final NullPointerSolver<T> solver;
|
||||
|
||||
private NegativeCFGBuilderVisitor(NullPointerSolver<T> solver) {
|
||||
this.solver = solver;
|
||||
private NegativeCFGBuilderVisitor() {
|
||||
this.deleted = new SparseNumberedGraph<T>(2);
|
||||
for (T bb : cfg) {
|
||||
deleted.addNode(bb);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class SourceFileModule extends FileModule implements Module, ModuleEntry,
|
|||
try {
|
||||
return getFile().toURI().toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
throw new Error("error making URL for " + getFile());
|
||||
throw new Error("error making URL for " + getFile(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,17 +50,14 @@ import com.ibm.wala.util.intset.IntSet;
|
|||
*/
|
||||
public class ICFGSupergraph implements ISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode> {
|
||||
|
||||
private final IAnalysisCacheView analysisCache;
|
||||
|
||||
private final ExplodedInterproceduralCFG icfg;
|
||||
|
||||
protected ICFGSupergraph(ExplodedInterproceduralCFG icfg, IAnalysisCacheView cache) {
|
||||
protected ICFGSupergraph(ExplodedInterproceduralCFG icfg) {
|
||||
this.icfg = icfg;
|
||||
this.analysisCache = cache;
|
||||
}
|
||||
|
||||
public static ICFGSupergraph make(CallGraph cg, IAnalysisCacheView cache) {
|
||||
ICFGSupergraph w = new ICFGSupergraph(ExplodedInterproceduralCFG.make(cg), cache);
|
||||
public static ICFGSupergraph make(CallGraph cg) {
|
||||
ICFGSupergraph w = new ICFGSupergraph(ExplodedInterproceduralCFG.make(cg));
|
||||
return w;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,10 +239,6 @@ public class SimpleMemoryAccessMap implements MemoryAccessMap {
|
|||
this.node = node;
|
||||
}
|
||||
|
||||
protected int getInstructionIndex() {
|
||||
return instructionIndex;
|
||||
}
|
||||
|
||||
protected void setInstructionIndex(int instructionIndex) {
|
||||
this.instructionIndex = instructionIndex;
|
||||
}
|
||||
|
|
|
@ -1890,6 +1890,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
|
|||
*/
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void handleAllReceivers(MutableIntSet receiverVals, InstanceKey[] keys, MutableBoolean sideEffect) {
|
||||
assert keys[0] == null;
|
||||
IntIterator receiverIter = receiverVals.intIterator();
|
||||
|
|
|
@ -95,7 +95,7 @@ public class SymbolTable implements Cloneable {
|
|||
assert vn < nextFreeValueNumber;
|
||||
values[vn] = val;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid vn: " + vn);
|
||||
throw new IllegalArgumentException("invalid vn: " + vn, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return parameters[i];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid i: " + i);
|
||||
throw new IllegalArgumentException("invalid i: " + i, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ public class SymbolTable implements Cloneable {
|
|||
}
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid i: " + i);
|
||||
throw new IllegalArgumentException("invalid i: " + i, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return v < values.length && values[v] instanceof ConstantValue;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).isZeroConstant();
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).isOneConstant();
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).isTrueConstant();
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).isFalseConstant();
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).getValue() instanceof Boolean;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && (((ConstantValue) values[v]).getValue() instanceof Integer);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && (((ConstantValue) values[v]).getValue() instanceof Long);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).getValue() instanceof Float;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).getValue() instanceof Double;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).getValue() instanceof Number;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values[v] instanceof ConstantValue) && ((ConstantValue) values[v]).getValue() instanceof String;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (values.length > v) && (values[v] instanceof ConstantValue) && (((ConstantValue) values[v]).getValue() == null);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid v: " + v);
|
||||
throw new IllegalArgumentException("invalid v: " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,9 +355,9 @@ public class SymbolTable implements Cloneable {
|
|||
try {
|
||||
return (PhiValue) values[valueNumber];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid valueNumber: " + valueNumber);
|
||||
throw new IllegalArgumentException("invalid valueNumber: " + valueNumber, e);
|
||||
} catch (ClassCastException e) {
|
||||
throw new IllegalArgumentException("invalid valueNumber: " + valueNumber);
|
||||
throw new IllegalArgumentException("invalid valueNumber: " + valueNumber, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class Selector {
|
|||
String desc = selectorStr.substring(selectorStr.indexOf('('));
|
||||
return new Selector(Atom.findOrCreateUnicodeAtom(methodName), Descriptor.findOrCreateUTF8(l, desc));
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid selectorStr: " + selectorStr);
|
||||
throw new IllegalArgumentException("invalid selectorStr: " + selectorStr, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ public class ProgressMaster implements IProgressMonitor {
|
|||
try {
|
||||
ManagementFactory.getPlatformMBeanServer().addNotificationListener(gcbean.getObjectName(), listener, null, null);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new Error("cannot find existing bean");
|
||||
throw new Error("cannot find existing bean", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class ProgressMaster implements IProgressMonitor {
|
|||
try {
|
||||
ManagementFactory.getPlatformMBeanServer().removeNotificationListener(gcbean.getObjectName(), listener);
|
||||
} catch (InstanceNotFoundException | ListenerNotFoundException e) {
|
||||
throw new Error("cannot find existing bean");
|
||||
throw new Error("cannot find existing bean", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ public class FileProvider {
|
|||
try {
|
||||
return new JarFileModule(new JarFile(fileName, false));
|
||||
} catch (ZipException e) {
|
||||
throw new IOException("Could not find file: " + fileName);
|
||||
throw new IOException("Could not find file: " + fileName, e);
|
||||
}
|
||||
}
|
||||
if (url.getProtocol().equals("jar")) {
|
||||
|
|
|
@ -146,8 +146,6 @@ public class ParameterAccessor {
|
|||
* @since 2013-10-19
|
||||
*/
|
||||
public static class Parameter extends SSAValue {
|
||||
/** Is Accessor constructed with IMethod or MethodReference */
|
||||
private final BasedOn basedOn;
|
||||
/** Implicit this or regular parameter? */
|
||||
private final ParamerterDisposition disp;
|
||||
/** Add to number to get position in descriptor */
|
||||
|
@ -205,7 +203,6 @@ public class ParameterAccessor {
|
|||
}
|
||||
|
||||
this.disp = disp;
|
||||
this.basedOn = basedOn;
|
||||
this.descriptorOffset = descriptorOffset;
|
||||
super.isAssigned();
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ public final class Atom implements Serializable {
|
|||
}
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalStateException("not an array: " + this);
|
||||
throw new IllegalStateException("not an array: " + this, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ public final class Atom implements Serializable {
|
|||
}
|
||||
return findOrCreate(val, i, val.length - i);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalStateException("not an array: " + this);
|
||||
throw new IllegalStateException("not an array: " + this, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ public final class Atom implements Serializable {
|
|||
try {
|
||||
return val[i];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("Illegal index: " + i + " length is " + val.length);
|
||||
throw new IllegalArgumentException("Illegal index: " + i + " length is " + val.length, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class ImmutableByteArray {
|
|||
try {
|
||||
System.arraycopy(b, start, this.b, 0, length);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("illegal parameters " + b.length + " " + start + " " + length);
|
||||
throw new IllegalArgumentException("illegal parameters " + b.length + " " + start + " " + length, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public final class ImmutableByteArray {
|
|||
try {
|
||||
System.arraycopy(b, i, result, 0, length);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("Invalid combination: " + i + " " + length);
|
||||
throw new IllegalArgumentException("Invalid combination: " + i + " " + length, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ public class StringStuff {
|
|||
}
|
||||
return new ImmutableByteArray(name.b, start + 1 + dim, lastSlash - start - 1 - dim);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid name " + name + " start: " + start + " length: " + length);
|
||||
throw new IllegalArgumentException("invalid name " + name + " start: " + start + " length: " + length, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ public class StringStuff {
|
|||
return new ImmutableByteArray(name.b, lastSlash + 1, L);
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("Malformed name: " + name + " " + start + " " + length);
|
||||
throw new IllegalArgumentException("Malformed name: " + name + " " + start + " " + length, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ public class StringStuff {
|
|||
}
|
||||
return code;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("ill-formed array descriptor " + b);
|
||||
throw new IllegalArgumentException("ill-formed array descriptor " + b, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ public class StringStuff {
|
|||
}
|
||||
return new ImmutableByteArray(b.b, i, length - (i - start));
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid element desciptor: " + b);
|
||||
throw new IllegalArgumentException("invalid element desciptor: " + b, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ public class StringStuff {
|
|||
|
||||
return name.b[start] != 'L';
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException(name.toString());
|
||||
throw new IllegalArgumentException(name.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
|
|||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
|
|
|
@ -533,6 +533,7 @@ public class Instantiator implements IInstantiator {
|
|||
/**
|
||||
* Path back to Object (including T itself).
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private List<TypeReference> getAllSuper(final TypeReference T) {
|
||||
if (T.isPrimitiveType()) {
|
||||
throw new IllegalArgumentException("Not you that call primitive type on :P");
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
*/
|
||||
package com.ibm.wala.dalvik.ipa.callgraph.propagation.cfa;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -58,7 +56,6 @@ import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
|||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.types.Selector;
|
||||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
import com.ibm.wala.util.intset.EmptyIntSet;
|
||||
import com.ibm.wala.util.intset.IntSet;
|
||||
import com.ibm.wala.util.intset.IntSetUtil;
|
||||
|
@ -82,7 +79,6 @@ public class IntentContextSelector implements ContextSelector {
|
|||
private final IntentMap intents = new IntentMap();
|
||||
private final ContextSelector parent;
|
||||
private final IntentStarters intentStarters;
|
||||
private final Map<InstanceKey, AndroidContext> seenContext;
|
||||
|
||||
public IntentContextSelector(final IClassHierarchy cha) {
|
||||
this(null, cha);
|
||||
|
@ -93,7 +89,6 @@ public class IntentContextSelector implements ContextSelector {
|
|||
*/
|
||||
public IntentContextSelector(final ContextSelector parent, final IClassHierarchy cha) {
|
||||
this.parent = parent;
|
||||
this.seenContext = HashMapFactory.make();
|
||||
this.intentStarters = new IntentStarters(cha);
|
||||
}
|
||||
|
||||
|
@ -203,14 +198,12 @@ public class IntentContextSelector implements ContextSelector {
|
|||
final Selector calleeSel = callee.getSelector();
|
||||
|
||||
boolean isExplicit = false;
|
||||
final InstanceKey uriKey;
|
||||
final InstanceKey actionKey;
|
||||
{ // fetch actionKey, uriKey
|
||||
switch (callee.getNumberOfParameters()) {
|
||||
case 1:
|
||||
logger.debug("Handling Intent()");
|
||||
actionKey = null;
|
||||
uriKey = null;
|
||||
break;
|
||||
case 2:
|
||||
if (calleeSel.equals(Selector.make("<init>(Ljava/lang/String;)V"))) {
|
||||
|
@ -231,41 +224,34 @@ public class IntentContextSelector implements ContextSelector {
|
|||
logger.error("No handling implemented for: {}", callee);
|
||||
actionKey = null;
|
||||
}
|
||||
uriKey = null;
|
||||
break;
|
||||
case 3:
|
||||
if (calleeSel.equals(Selector.make("<init>(Ljava/lang/String;Landroid/net/Uri;)V"))) {
|
||||
logger.debug("Handling Intent(String action, Uri uri)");
|
||||
// TODO: Use Information of the URI...
|
||||
actionKey = actualParameters[1];
|
||||
uriKey = actualParameters[2];
|
||||
} else if (calleeSel.equals(Selector.make("<init>(Landroid/content/Context;Ljava/lang/Class;)V"))) {
|
||||
logger.debug("Handling Intent(Context, Class)");
|
||||
actionKey = actualParameters[2];
|
||||
uriKey = null;
|
||||
isExplicit = true;
|
||||
} else {
|
||||
logger.error("No handling implemented for: {}", callee);
|
||||
actionKey = null;
|
||||
uriKey = null;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (calleeSel.equals(Selector.make("<init>(Ljava/lang/String;Landroid/net/Uri;Landroid/content/Context;Ljava/lang/Class;)V"))) {
|
||||
logger.debug("Handling Intent(String action, Uri uri, Context, Class)");
|
||||
actionKey = actualParameters[4];
|
||||
uriKey = actualParameters[2];
|
||||
isExplicit = true;
|
||||
} else {
|
||||
logger.error("No handling implemented for: {}", callee);
|
||||
actionKey = null;
|
||||
uriKey = null;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logger.error("Can't extract Info from Intent-Constructor: {} (not implemented)", site);
|
||||
actionKey = null;
|
||||
uriKey = null;
|
||||
}
|
||||
} // of fetch actionKey
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class AndroidAnalysisScope {
|
|||
scope.addClassFileToScope(loader, f);
|
||||
} catch (InvalidClassFileException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid class file");
|
||||
"Invalid class file", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,6 +289,7 @@ public class AndroidManifestXMLReader {
|
|||
/**
|
||||
* All Tags in this Enum but UNIMPORTANT are relevant.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public boolean isRelevant() {
|
||||
return (this != Tag.UNIMPORTANT);
|
||||
}
|
||||
|
@ -314,6 +315,7 @@ public class AndroidManifestXMLReader {
|
|||
/**
|
||||
* The Tag appears in the XML File using this name.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public String getName() {
|
||||
return this.tagName;
|
||||
}
|
||||
|
@ -344,6 +346,7 @@ public class AndroidManifestXMLReader {
|
|||
this.attrName = attrName;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public boolean isRelevantIn(Tag tag) {
|
||||
return tag.isRelevant(this);
|
||||
}
|
||||
|
|
|
@ -370,7 +370,7 @@ public class JdtUtil {
|
|||
return result;
|
||||
}
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid selector: " + selector);
|
||||
throw new IllegalArgumentException("invalid selector: " + selector, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ public class JdtUtil {
|
|||
}
|
||||
}
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("error parsing selector " + selector);
|
||||
throw new IllegalArgumentException("error parsing selector " + selector, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,14 +91,14 @@ public class JsdtUtil {
|
|||
|
||||
public static CGInfo buildJSDTCallGraph(Set<ModuleEntry> mes) {
|
||||
final CGInfo info = new CGInfo();
|
||||
HeadlessUtil.parseModules(mes, new EclipseCompiler<IJavaScriptUnit, JavaScriptUnit>() {
|
||||
HeadlessUtil.parseModules(mes, new EclipseCompiler<IJavaScriptUnit>() {
|
||||
@Override
|
||||
public IJavaScriptUnit getCompilationUnit(IFile file) {
|
||||
return JavaScriptCore.createCompilationUnitFrom(file);
|
||||
}
|
||||
@Override
|
||||
public Parser<IJavaScriptUnit, JavaScriptUnit> getParser() {
|
||||
return new Parser<IJavaScriptUnit, JavaScriptUnit>() {
|
||||
public Parser<IJavaScriptUnit> getParser() {
|
||||
return new Parser<IJavaScriptUnit>() {
|
||||
IJavaScriptProject project;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,7 +65,7 @@ public class IFDSExplorerExample {
|
|||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
System.out.println("done with CG");
|
||||
System.out.println("computing reaching defs");
|
||||
ContextSensitiveReachingDefs reachingDefs = new ContextSensitiveReachingDefs(cg, cache);
|
||||
ContextSensitiveReachingDefs reachingDefs = new ContextSensitiveReachingDefs(cg);
|
||||
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, Pair<CGNode, Integer>> result = reachingDefs.analyze();
|
||||
System.out.println("done with reaching defs");
|
||||
IFDSExplorer.setDotExe(p.getProperty("dotExe"));
|
||||
|
|
|
@ -148,7 +148,7 @@ public class EclipseFileProvider extends FileProvider {
|
|||
url = fixupFileURLSpaces(url);
|
||||
return url;
|
||||
} catch (ExceptionInInitializerError e) {
|
||||
throw new IOException("failure to get file URL for " + fileName);
|
||||
throw new IOException("failure to get file URL for " + fileName, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,19 +73,19 @@ public class HeadlessUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
public interface EclipseCompiler<Unit,CompiledUnit> {
|
||||
public interface EclipseCompiler<Unit> {
|
||||
Unit getCompilationUnit(IFile file);
|
||||
|
||||
Parser<Unit,CompiledUnit> getParser();
|
||||
Parser<Unit> getParser();
|
||||
}
|
||||
|
||||
public interface Parser<Unit, CompiledUnit> {
|
||||
public interface Parser<Unit> {
|
||||
void setProject(IProject project);
|
||||
|
||||
void processASTs(Map<Unit,EclipseSourceFileModule> files, Function<Object[], Boolean> errors);
|
||||
}
|
||||
|
||||
public static <Unit, CompiledUnit> void parseModules(Set<ModuleEntry> modules, EclipseCompiler<Unit, CompiledUnit> compiler) {
|
||||
public static <Unit> void parseModules(Set<ModuleEntry> modules, EclipseCompiler<Unit> compiler) {
|
||||
// sort files into projects
|
||||
Map<IProject, Map<Unit,EclipseSourceFileModule>> projectsFiles = new HashMap<>();
|
||||
for (ModuleEntry m : modules) {
|
||||
|
@ -99,7 +99,7 @@ public class HeadlessUtil {
|
|||
}
|
||||
}
|
||||
|
||||
final Parser<Unit,CompiledUnit> parser = compiler.getParser();
|
||||
final Parser<Unit> parser = compiler.getParser();
|
||||
|
||||
for (final Map.Entry<IProject,Map<Unit,EclipseSourceFileModule>> proj : projectsFiles.entrySet()) {
|
||||
parser.setProject(proj.getKey());
|
||||
|
|
|
@ -10,5 +10,6 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
|||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
|
|
@ -86,7 +86,7 @@ import com.ibm.wala.ssa.SSAInvokeInstruction;
|
|||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class InflowAnalysis <E extends ISSABasicBlock> {
|
||||
public class InflowAnalysis {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E extends ISSABasicBlock>
|
||||
|
|
|
@ -48,19 +48,15 @@
|
|||
*/
|
||||
package org.scandroid.flow.functions;
|
||||
|
||||
import org.scandroid.domain.IFDSTaintDomain;
|
||||
|
||||
import com.ibm.wala.dataflow.IFDS.IUnaryFlowFunction;
|
||||
import com.ibm.wala.ssa.ISSABasicBlock;
|
||||
import com.ibm.wala.util.intset.IntSet;
|
||||
import com.ibm.wala.util.intset.IntSetAction;
|
||||
|
||||
public class TracingFlowFunction<E extends ISSABasicBlock> implements IUnaryFlowFunction {
|
||||
private final IFDSTaintDomain<E> domain;
|
||||
private final IUnaryFlowFunction function;
|
||||
|
||||
public TracingFlowFunction(IFDSTaintDomain<E> domain, IUnaryFlowFunction function) {
|
||||
this.domain = domain;
|
||||
public TracingFlowFunction(IUnaryFlowFunction function) {
|
||||
this.function = function;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ public class StringBuilderUseAnalysis {
|
|||
|
||||
public final Map<ISSABasicBlock, ISSABasicBlock> blockOrdering;
|
||||
|
||||
private final InstanceKey sbik;
|
||||
private final CGNode node;
|
||||
private final PointerAnalysis<InstanceKey> pa;
|
||||
private final Set<LocalPointerKey> localPointerKeys = new HashSet<>();
|
||||
|
@ -83,7 +82,6 @@ public class StringBuilderUseAnalysis {
|
|||
public StringBuilderUseAnalysis(final InstanceKey ik, final PointerAnalysis<InstanceKey> pa) throws Exception {
|
||||
assert(ik.getConcreteType().getName().toString().equals("Ljava/lang/StringBuilder"));
|
||||
|
||||
this.sbik = ik;
|
||||
this.pa = pa;
|
||||
this.node = findCGNode(ik, pa);
|
||||
this.instructions = findInstructions();
|
||||
|
|
|
@ -205,7 +205,7 @@ public class CGAnalysisContext<E extends ISSABasicBlock> {
|
|||
}
|
||||
});
|
||||
if (options.includeLibrary()) {
|
||||
graph = (ISupergraph) ICFGSupergraph.make(cg, cache);
|
||||
graph = (ISupergraph) ICFGSupergraph.make(cg);
|
||||
} else {
|
||||
|
||||
Collection<CGNode> nodes = HashSetFactory.make();
|
||||
|
@ -213,7 +213,7 @@ public class CGAnalysisContext<E extends ISSABasicBlock> {
|
|||
nodes.add(nIter.next());
|
||||
}
|
||||
CallGraph pcg = PartialCallGraph.make(cg, cg.getEntrypointNodes(), nodes);
|
||||
graph = (ISupergraph) ICFGSupergraph.make(pcg, cache);
|
||||
graph = (ISupergraph) ICFGSupergraph.make(pcg);
|
||||
}
|
||||
|
||||
oneLevelGraph = GraphSlicer.prune(cg, new Predicate<CGNode>() {
|
||||
|
|
|
@ -168,7 +168,7 @@ public class DexDotUtil extends DotUtil {
|
|||
return f;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new WalaException("Error writing dot file " + dotfile);
|
||||
throw new WalaException("Error writing dot file " + dotfile, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class AddBytecodeDebug {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
instrumenter = new OfflineInstrumenter(true);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
|
||||
try (final Writer w = new BufferedWriter(new FileWriter("report", false))) {
|
||||
args = instrumenter.parseStandardArgs(args);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Bench {
|
|||
doException = true;
|
||||
}
|
||||
}
|
||||
instrumenter = new OfflineInstrumenter(!doException);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
instrumenter.setPassUnmodifiedClasses(true);
|
||||
instrumenter.beginTraversal();
|
||||
ClassInstrumenter ci;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class InterfaceAnalyzer {
|
|||
final static HashMap<String, TypeStats> typeStats = new HashMap<>();
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
OfflineInstrumenter instrumenter = new OfflineInstrumenter(true);
|
||||
OfflineInstrumenter instrumenter = new OfflineInstrumenter();
|
||||
|
||||
try (final Writer w = new BufferedWriter(new OutputStreamWriter(System.out))) {
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Mangler {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
instrumenter = new OfflineInstrumenter(true);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
|
||||
try (final Writer w = new BufferedWriter(new FileWriter("report", false))) {
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Statistics {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
instrumenter = new OfflineInstrumenter(true);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
|
||||
try (Writer w = new BufferedWriter(new FileWriter("report", false))) {
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class OfflineDynamicCallGraph {
|
|||
patchCalls = true;
|
||||
} else if ("--rt-jar".equals(args[i])) {
|
||||
System.err.println("using " + args[i+1] + " as stdlib");
|
||||
OfflineInstrumenter libReader = new OfflineInstrumenter(true);
|
||||
OfflineInstrumenter libReader = new OfflineInstrumenter();
|
||||
libReader.addInputJar(new File(args[i+1]));
|
||||
while ((ci = libReader.nextClass()) != null) {
|
||||
CTUtils.addClassToHierarchy(cha, ci.getReader());
|
||||
|
@ -94,7 +94,7 @@ public class OfflineDynamicCallGraph {
|
|||
}
|
||||
}
|
||||
|
||||
instrumenter = new OfflineInstrumenter(true);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
args = instrumenter.parseStandardArgs(args);
|
||||
|
||||
instrumenter.setPassUnmodifiedClasses(true);
|
||||
|
|
|
@ -23,7 +23,7 @@ public class OnlineDynamicCallGraph implements ClassFileTransformer {
|
|||
private Writer out = new PrintWriter(System.err);
|
||||
|
||||
public OnlineDynamicCallGraph() throws IllegalArgumentException, IOException, InvalidClassFileException {
|
||||
OfflineInstrumenter libReader = new OfflineInstrumenter(true);
|
||||
OfflineInstrumenter libReader = new OfflineInstrumenter();
|
||||
for (String cps : new String[]{ System.getProperty("java.class.path"), System.getProperty("sun.boot.class.path") }) {
|
||||
for (String cp : cps.split(File.pathSeparator)) {
|
||||
File x = new File(cp);
|
||||
|
@ -50,7 +50,7 @@ public class OnlineDynamicCallGraph implements ClassFileTransformer {
|
|||
if (className.contains("com/ibm/wala") || className.contains("java/lang") || (className.contains("java/") && !className.matches("java/util/[A-Z]")) || className.contains("sun/")) {
|
||||
return classfileBuffer;
|
||||
} else {
|
||||
ClassInstrumenter ci = new ClassInstrumenter(className, classfileBuffer, cha, false);
|
||||
ClassInstrumenter ci = new ClassInstrumenter(className, classfileBuffer, cha);
|
||||
return OfflineDynamicCallGraph.doClass(ci, out).makeBytes();
|
||||
}
|
||||
} catch (InvalidClassFileException | IOException | FailureException e) {
|
||||
|
|
|
@ -93,7 +93,7 @@ public class CopyWriter {
|
|||
|
||||
final ArrayList<ZipEntry> entries = new ArrayList<>();
|
||||
|
||||
instrumenter = new OfflineInstrumenter(true);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
instrumenter.setManifestBuilder(new OfflineInstrumenter.ManifestBuilder() {
|
||||
@Override
|
||||
public void addEntry(ZipEntry ze) {
|
||||
|
|
|
@ -415,7 +415,7 @@ public final class MethodEditor {
|
|||
}
|
||||
patchCount++;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid i");
|
||||
throw new IllegalArgumentException("invalid i", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ public final class MethodEditor {
|
|||
instructionHandlerPatches[i] = new HandlerPatch(instructionHandlerPatches[i], catchClass, allocateLabel(), p);
|
||||
patchCount++;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid i: " + i);
|
||||
throw new IllegalArgumentException("invalid i: " + i, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ public final class Util {
|
|||
}
|
||||
return count;
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid type: " + type);
|
||||
throw new IllegalArgumentException("invalid type: " + type, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,13 +63,11 @@ final public class ClassInstrumenter {
|
|||
|
||||
private final ClassHierarchyProvider cha;
|
||||
|
||||
private final boolean reuseStackMaps;
|
||||
|
||||
/**
|
||||
* Create a class instrumenter from raw bytes.
|
||||
*/
|
||||
public ClassInstrumenter(String inputName, byte[] bytes, ClassHierarchyProvider cha, boolean reuseStackMaps) throws InvalidClassFileException {
|
||||
this(inputName, new ClassReader(bytes), cha, reuseStackMaps);
|
||||
public ClassInstrumenter(String inputName, byte[] bytes, ClassHierarchyProvider cha) throws InvalidClassFileException {
|
||||
this(inputName, new ClassReader(bytes), cha);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,13 +91,12 @@ final public class ClassInstrumenter {
|
|||
*
|
||||
* @throws IllegalArgumentException if cr is null
|
||||
*/
|
||||
public ClassInstrumenter(String inputName, ClassReader cr, ClassHierarchyProvider cha, boolean reuseStackMaps) throws InvalidClassFileException {
|
||||
public ClassInstrumenter(String inputName, ClassReader cr, ClassHierarchyProvider cha) throws InvalidClassFileException {
|
||||
if (cr == null) {
|
||||
throw new IllegalArgumentException("cr is null");
|
||||
}
|
||||
this.cr = cr;
|
||||
this.cha = cha;
|
||||
this.reuseStackMaps = reuseStackMaps;
|
||||
methods = new MethodData[cr.getMethodCount()];
|
||||
oldCode = new CodeReader[methods.length];
|
||||
cpr = CTDecoder.makeConstantPoolReader(cr);
|
||||
|
|
|
@ -24,20 +24,13 @@ import com.ibm.wala.shrikeCT.InvalidClassFileException;
|
|||
* specialization of OfflineInstrumenterBase to use the shrikeCT functionality.
|
||||
*/
|
||||
final public class OfflineInstrumenter extends OfflineInstrumenterBase {
|
||||
private final boolean reuseStackMaps;
|
||||
/**
|
||||
* Create an empty collection of classes to instrument.
|
||||
*/
|
||||
public OfflineInstrumenter(boolean reuseStackMaps) {
|
||||
this.reuseStackMaps = reuseStackMaps;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object makeClassFromStream(String inputName, BufferedInputStream s) throws IOException {
|
||||
byte[] bytes = new byte[s.available()];
|
||||
Util.readFully(s, bytes);
|
||||
try {
|
||||
return new ClassInstrumenter(inputName, bytes, cha, reuseStackMaps);
|
||||
return new ClassInstrumenter(inputName, bytes, cha);
|
||||
} catch (InvalidClassFileException e) {
|
||||
throw new IOException("Class is invalid: " + e.getMessage());
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class BatchVerifier {
|
|||
private static int errors = 0;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter(true);
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter();
|
||||
args = oi.parseStandardArgs(args);
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BootstrapDumper {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter(true);
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter();
|
||||
String[] classpathEntries = oi.parseStandardArgs(args);
|
||||
|
||||
PrintWriter w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
|
||||
|
|
|
@ -57,7 +57,7 @@ public class BootstrapInstrumentor {
|
|||
}
|
||||
|
||||
public void doit(String[] args) throws Exception {
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter(true);
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter();
|
||||
oi.parseStandardArgs(args);
|
||||
|
||||
oi.setPassUnmodifiedClasses(true);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ClassPrinter {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter(true);
|
||||
OfflineInstrumenter oi = new OfflineInstrumenter();
|
||||
args = oi.parseStandardArgs(args);
|
||||
|
||||
PrintWriter w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ClassSearcher {
|
|||
private static int scanned = 0;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
instrumenter = new OfflineInstrumenter(true);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
|
||||
try (final Writer w = new BufferedWriter(new FileWriter("report", true))) {
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MethodTracer {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
instrumenter = new OfflineInstrumenter(true);
|
||||
instrumenter = new OfflineInstrumenter();
|
||||
|
||||
try (final Writer w = new BufferedWriter(new FileWriter("report", false))) {
|
||||
|
||||
|
|
|
@ -952,7 +952,7 @@ public class ClassWriter implements ClassConstants {
|
|||
try {
|
||||
buf[offset] = (byte) v;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid offset: " + offset);
|
||||
throw new IllegalArgumentException("invalid offset: " + offset, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -971,7 +971,7 @@ public class ClassWriter implements ClassConstants {
|
|||
buf[offset + 2] = (byte) (v >> 8);
|
||||
buf[offset + 3] = (byte) v;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("illegal offset " + offset);
|
||||
throw new IllegalArgumentException("illegal offset " + offset, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ public class ClassWriter implements ClassConstants {
|
|||
buf[offset] = (byte) (v >> 8);
|
||||
buf[offset + 1] = (byte) v;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid offset: " + offset);
|
||||
throw new IllegalArgumentException("invalid offset: " + offset, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public final class LocalVariableTableWriter extends ClassWriter.Element {
|
|||
return r;
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("malformed varMap");
|
||||
throw new IllegalArgumentException("malformed varMap", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ public class DefaultFixedPointSystem<T extends IVariable<?>> implements IFixedPo
|
|||
public Iterator<T> getVariables() {
|
||||
return new FilterIterator<>(graph.iterator(), new Predicate<T>() {
|
||||
@Override public boolean test(T x) {
|
||||
return x instanceof IVariable;
|
||||
return x != null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ public class ArraySet<T> extends AbstractSet<T> {
|
|||
_curIndex--;
|
||||
return true;
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid ind: " + ind);
|
||||
throw new IllegalArgumentException("invalid ind: " + ind, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ public class ImmutableStack<T> implements Iterable<T> {
|
|||
try {
|
||||
return entries[i];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid i: " + i);
|
||||
throw new IllegalArgumentException("invalid i: " + i, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ObjectArrayMapping<T> implements OrdinalSetMapping<T> {
|
|||
try {
|
||||
return array[n];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid n: " + n);
|
||||
throw new IllegalArgumentException("invalid n: " + n, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class SmallMap<K, V> implements Map<K, V> {
|
|||
try {
|
||||
return (K) keysAndValues[i];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid i: " + i);
|
||||
throw new IllegalArgumentException("invalid i: " + i, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class SmallMap<K, V> implements Map<K, V> {
|
|||
try {
|
||||
return keysAndValues[size() + i];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("illegal i: " + i);
|
||||
throw new IllegalArgumentException("illegal i: " + i, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class DelegatingNumberedNodeManager<T extends INodeWithNumber> implements
|
|||
try {
|
||||
return (T) nodes[number];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("Invalid number " + number);
|
||||
throw new IllegalArgumentException("Invalid number " + number, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public final class FixedSizeBitVector implements Cloneable, java.io.Serializable
|
|||
int shiftBits = bit & LOW_MASK;
|
||||
bits[subscript(bit)] |= (1 << shiftBits);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid bit " + bit);
|
||||
throw new IllegalArgumentException("invalid bit " + bit, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public final class FixedSizeBitVector implements Cloneable, java.io.Serializable
|
|||
int shiftBits = bit & LOW_MASK;
|
||||
bits[subscript(bit)] &= ~(1 << shiftBits);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid bit: " + bit);
|
||||
throw new IllegalArgumentException("invalid bit: " + bit, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class MutableMapping<T> implements OrdinalSetMapping<T>, Serializable {
|
|||
try {
|
||||
return (T) array[n];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("n out of range " + n);
|
||||
throw new IllegalArgumentException("n out of range " + n, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class Table<T> {
|
|||
SimpleVector<T> r = rows.get(row);
|
||||
return r.get(column);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("row: " + row + " column: " + column);
|
||||
throw new IllegalArgumentException("row: " + row + " column: " + column, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ public class DotUtil {
|
|||
return f;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new WalaException("Error writing dot file " + dotfile);
|
||||
throw new WalaException("Error writing dot file " + dotfile, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue