remove warnings from com.ibm.wala.dalvik

This commit is contained in:
Juergen Graf 2013-03-12 01:24:38 +01:00
parent 6401269da1
commit 5a06c07ca7
28 changed files with 88 additions and 83 deletions

View File

@ -76,8 +76,8 @@ public class ActivityModelMethod extends DexIMethod {
} catch (Exception e) { } catch (Exception e) {
throw new IllegalArgumentException(e); throw new IllegalArgumentException(e);
} }
Section<ClassDefItem> cldeff = activityModelDF @SuppressWarnings("unchecked")
.getSectionForType(TYPE_CLASS_DEF_ITEM); Section<ClassDefItem> cldeff = activityModelDF.getSectionForType(TYPE_CLASS_DEF_ITEM);
for (ClassDefItem cdefitems : cldeff.getItems()) { for (ClassDefItem cdefitems : cldeff.getItems()) {
if (cdefitems.getClassType().getTypeDescriptor() if (cdefitems.getClassType().getTypeDescriptor()
.equals("Lactivity/model/ActivityModelActivity;")) { .equals("Lactivity/model/ActivityModelActivity;")) {

View File

@ -162,7 +162,8 @@ public class DexCFG extends AbstractCFG<Instruction, DexCFG.BasicBlock>{
boolean[] r = new boolean[getInstructions().length]; boolean[] r = new boolean[getInstructions().length];
boolean[] catchers = new boolean[getInstructions().length]; boolean[] catchers = new boolean[getInstructions().length];
// we initially start with both the entry and exit block. // we initially start with both the entry and exit block.
int blockCount = 2; @SuppressWarnings("unused")
int blockCount = 2;
// Compute r so r[i] == true iff instruction i begins a basic block. // Compute r so r[i] == true iff instruction i begins a basic block.
// While doing so count the number of blocks. // While doing so count the number of blocks.
@ -663,8 +664,8 @@ public class DexCFG extends AbstractCFG<Instruction, DexCFG.BasicBlock>{
@Override @Override
public String toString() { public String toString() {
StringBuffer s = new StringBuffer(""); StringBuffer s = new StringBuffer("");
for (Iterator it = iterator(); it.hasNext();) { for (Iterator<BasicBlock> it = iterator(); it.hasNext();) {
BasicBlock bb = (BasicBlock) it.next(); BasicBlock bb = it.next();
s.append("BB").append(getNumber(bb)).append("\n"); s.append("BB").append(getNumber(bb)).append("\n");
for (int j = bb.getFirstInstructionIndex(); j <= bb.getLastInstructionIndex(); j++) { for (int j = bb.getFirstInstructionIndex(); j <= bb.getLastInstructionIndex(); j++) {
s.append(" ").append(j).append(" ").append(getInstructions()[j]).append("\n"); s.append(" ").append(j).append(" ").append(getInstructions()[j]).append("\n");

View File

@ -81,8 +81,8 @@ public class DexFileModule implements Module {
// create ModuleEntries from ClassDefItem // create ModuleEntries from ClassDefItem
entries = new HashSet<ModuleEntry>(); entries = new HashSet<ModuleEntry>();
Section<ClassDefItem> cldeff = dexfile @SuppressWarnings("unchecked")
.getSectionForType(TYPE_CLASS_DEF_ITEM); Section<ClassDefItem> cldeff = dexfile.getSectionForType(TYPE_CLASS_DEF_ITEM);
for (ClassDefItem cdefitems : cldeff.getItems()) { for (ClassDefItem cdefitems : cldeff.getItems()) {
logger.debug("DexFileModule adding class: " + cdefitems.getConciseIdentity()); logger.debug("DexFileModule adding class: " + cdefitems.getConciseIdentity());

View File

@ -34,7 +34,8 @@ public class DexIRFactory extends DefaultIRFactory {
public final static boolean buildLocalMap = false; public final static boolean buildLocalMap = false;
@Override @SuppressWarnings("rawtypes")
@Override
public ControlFlowGraph makeCFG(IMethod method, Context C) throws IllegalArgumentException { public ControlFlowGraph makeCFG(IMethod method, Context C) throws IllegalArgumentException {
if (method == null) { if (method == null) {
throw new IllegalArgumentException("null method"); throw new IllegalArgumentException("null method");

View File

@ -71,7 +71,7 @@ import com.ibm.wala.util.warnings.Warnings;
public class WDexClassLoaderImpl extends ClassLoaderImpl { public class WDexClassLoaderImpl extends ClassLoaderImpl {
private static final Logger logger = LoggerFactory.getLogger(WDexClassLoaderImpl.class); private static final Logger logger = LoggerFactory.getLogger(WDexClassLoaderImpl.class);
private SetOfClasses lExclusions; // private SetOfClasses lExclusions;
private IClassLoader lParent; private IClassLoader lParent;
@ -90,7 +90,7 @@ public class WDexClassLoaderImpl extends ClassLoaderImpl {
SetOfClasses exclusions, IClassHierarchy cha) { SetOfClasses exclusions, IClassHierarchy cha) {
super(loader, cha.getScope().getArrayClassLoader(), parent, exclusions, cha); super(loader, cha.getScope().getArrayClassLoader(), parent, exclusions, cha);
lParent = parent; lParent = parent;
lExclusions = exclusions; // lExclusions = exclusions;
//DEBUG_LEVEL = 0; //DEBUG_LEVEL = 0;
} }

View File

@ -252,7 +252,7 @@ public class DexFakeRootMethod extends AbstractRootMethod {
* @return true iff block is a basic block in the fake root method * @return true iff block is a basic block in the fake root method
* @throws IllegalArgumentException if block is null * @throws IllegalArgumentException if block is null
*/ */
public static boolean isFromFakeRoot(IBasicBlock block) { public static boolean isFromFakeRoot(IBasicBlock<?> block) {
if (block == null) { if (block == null) {
throw new IllegalArgumentException("block is null"); throw new IllegalArgumentException("block is null");
} }

View File

@ -73,6 +73,7 @@ import com.ibm.wala.util.debug.UnimplementedError;
* <p> * <p>
* In this implementation, each dataflow variable value is an integer, and the "meeter" object provides the meets * In this implementation, each dataflow variable value is an integer, and the "meeter" object provides the meets
*/ */
@SuppressWarnings("rawtypes")
public abstract class AbstractIntRegisterMachine implements FixedPointConstants { public abstract class AbstractIntRegisterMachine implements FixedPointConstants {
private static final Logger logger = LoggerFactory.getLogger(AbstractIntRegisterMachine.class); private static final Logger logger = LoggerFactory.getLogger(AbstractIntRegisterMachine.class);
@ -587,7 +588,8 @@ public abstract class AbstractIntRegisterMachine implements FixedPointConstants
* @return the height of stacks that are being meeted. Return -1 if there is no stack meet necessary. * @return the height of stacks that are being meeted. Return -1 if there is no stack meet necessary.
* @param operands The operands for this operator. operands[0] is the left-hand side. * @param operands The operands for this operator. operands[0] is the left-hand side.
*/ */
private static int computeMeetStackHeight(IVariable[] operands) { @SuppressWarnings("unused")
private static int computeMeetStackHeight(IVariable[] operands) {
MachineState lhs = (MachineState) operands[0]; MachineState lhs = (MachineState) operands[0];
int height = -1; int height = -1;
if (lhs.stack != null) { if (lhs.stack != null) {

View File

@ -60,7 +60,6 @@ import com.ibm.wala.shrikeBT.IConditionalBranchInstruction;
import com.ibm.wala.shrikeBT.IGetInstruction; import com.ibm.wala.shrikeBT.IGetInstruction;
import com.ibm.wala.shrikeBT.IInvokeInstruction; import com.ibm.wala.shrikeBT.IInvokeInstruction;
import com.ibm.wala.shrikeBT.IUnaryOpInstruction; import com.ibm.wala.shrikeBT.IUnaryOpInstruction;
import com.ibm.wala.shrikeBT.IndirectionData;
import com.ibm.wala.shrikeBT.InstanceofInstruction; import com.ibm.wala.shrikeBT.InstanceofInstruction;
import com.ibm.wala.shrikeBT.MonitorInstruction; import com.ibm.wala.shrikeBT.MonitorInstruction;
import com.ibm.wala.shrikeBT.NewInstruction; import com.ibm.wala.shrikeBT.NewInstruction;
@ -134,7 +133,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
/** /**
* information about indirect use of local variables in the bytecode * information about indirect use of local variables in the bytecode
*/ */
private final IndirectionData bytecodeIndirections; // private final IndirectionData bytecodeIndirections;
private final ShrikeIndirectionData shrikeIndirections; private final ShrikeIndirectionData shrikeIndirections;
@ -147,7 +146,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
this.method = method; this.method = method;
this.symbolTable = symbolTable; this.symbolTable = symbolTable;
this.insts = method.getDeclaringClass().getClassLoader().getInstructionFactory(); this.insts = method.getDeclaringClass().getClassLoader().getInstructionFactory();
this.bytecodeIndirections = method.getIndirectionData(); // this.bytecodeIndirections = method.getIndirectionData();
this.shrikeIndirections = new ShrikeIndirectionData(instructions.length); this.shrikeIndirections = new ShrikeIndirectionData(instructions.length);
assert cfg != null : "Null CFG"; assert cfg != null : "Null CFG";
} }
@ -156,7 +155,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
final SSACFG cfg; final SSACFG cfg;
final SSAInstruction[] instructions; // final SSAInstruction[] instructions;
final SymbolTable symbolTable; final SymbolTable symbolTable;
@ -164,7 +163,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
SymbolTableMeeter(SymbolTable symbolTable, SSACFG cfg, SSAInstruction[] instructions, DexCFG dexCFG) { SymbolTableMeeter(SymbolTable symbolTable, SSACFG cfg, SSAInstruction[] instructions, DexCFG dexCFG) {
this.cfg = cfg; this.cfg = cfg;
this.instructions = instructions; // this.instructions = instructions;
this.symbolTable = symbolTable; this.symbolTable = symbolTable;
this.dexCFG = dexCFG; this.dexCFG = dexCFG;
} }
@ -372,7 +371,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
*/ */
private SSAInstruction[] creators; private SSAInstruction[] creators;
final SSA2LocalMap localMap; // final SSA2LocalMap localMap;
final SSAPiNodePolicy piNodePolicy; final SSAPiNodePolicy piNodePolicy;
@ -386,7 +385,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
this.instructions = instructions; this.instructions = instructions;
this.symbolTable = symbolTable; this.symbolTable = symbolTable;
this.loader = dexCFG.getMethod().getDeclaringClass().getClassLoader().getReference(); this.loader = dexCFG.getMethod().getDeclaringClass().getClassLoader().getReference();
this.localMap = localMap; // this.localMap = localMap;
init(this.new NodeVisitor(), this.new EdgeVisitor()); init(this.new NodeVisitor(), this.new EdgeVisitor());
} }
@ -1105,7 +1104,8 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
private Dominators<ISSABasicBlock> dom = null; private Dominators<ISSABasicBlock> dom = null;
private int findRethrowException() { @SuppressWarnings("unused")
private int findRethrowException() {
int index = getCurrentInstructionIndex(); int index = getCurrentInstructionIndex();
SSACFG.BasicBlock bb = cfg.getBlockForInstruction(index); SSACFG.BasicBlock bb = cfg.getBlockForInstruction(index);
if (bb.isCatchBlock()) { if (bb.isCatchBlock()) {
@ -1431,7 +1431,8 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
* Record the beginning of a new range, starting at the given program counter, in which a particular value number corresponds to * Record the beginning of a new range, starting at the given program counter, in which a particular value number corresponds to
* a particular local number * a particular local number
*/ */
void startRange(int pc, int localNumber, int valueNumber) { @SuppressWarnings("unused")
void startRange(int pc, int localNumber, int valueNumber) {
int max = ((DexIMethod)dexCFG.getMethod()).getMaxLocals(); int max = ((DexIMethod)dexCFG.getMethod()).getMaxLocals();
if (localNumber >= max) { if (localNumber >= max) {
assert false : "invalid local " + localNumber + ">" + max; assert false : "invalid local " + localNumber + ">" + max;
@ -1444,8 +1445,8 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
* Finish populating the map of local variable information * Finish populating the map of local variable information
*/ */
private void finishLocalMap(DexSSABuilder builder) { private void finishLocalMap(DexSSABuilder builder) {
for (Iterator it = dexCFG.iterator(); it.hasNext();) { for (Iterator<BasicBlock> it = dexCFG.iterator(); it.hasNext();) {
BasicBlock bb = (BasicBlock) it.next(); BasicBlock bb = it.next();
MachineState S = builder.getIn(bb); MachineState S = builder.getIn(bb);
int number = bb.getNumber(); int number = bb.getNumber();
block2LocalState[number] = S.getLocals(); block2LocalState[number] = S.getLocals();

View File

@ -40,6 +40,7 @@ package org.scandroid.domain;
import org.scandroid.flow.types.FlowType; import org.scandroid.flow.types.FlowType;
@SuppressWarnings("rawtypes")
public class DomainElement { public class DomainElement {
// the code element in question // the code element in question
// alternate framing: the /current/ fact about the element // alternate framing: the /current/ fact about the element

View File

@ -80,11 +80,12 @@ import com.ibm.wala.ssa.ISSABasicBlock;
import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAInvokeInstruction; import com.ibm.wala.ssa.SSAInvokeInstruction;
@SuppressWarnings("rawtypes")
public class InflowAnalysis <E extends ISSABasicBlock> { public class InflowAnalysis <E extends ISSABasicBlock> {
private static final Logger logger = LoggerFactory.getLogger(InflowAnalysis.class); private static final Logger logger = LoggerFactory.getLogger(InflowAnalysis.class);
public static <E extends ISSABasicBlock> @SuppressWarnings("unchecked")
public static <E extends ISSABasicBlock>
void addDomainElements( void addDomainElements(
Map<BasicBlockInContext<E>, Map<FlowType<E>,Set<CodeElement>>> taintMap, Map<BasicBlockInContext<E>, Map<FlowType<E>,Set<CodeElement>>> taintMap,
BasicBlockInContext<E> block, BasicBlockInContext<E> block,
@ -261,7 +262,7 @@ public class InflowAnalysis <E extends ISSABasicBlock> {
for(CodeElement o:e2.getValue()) for(CodeElement o:e2.getValue())
{ {
if (e2.getKey() instanceof IKFlow) { if (e2.getKey() instanceof IKFlow) {
InstanceKey e2IK = ((IKFlow)e2.getKey()).getIK(); InstanceKey e2IK = ((IKFlow<?>)e2.getKey()).getIK();
if (prefixes.containsKey(e2IK)) if (prefixes.containsKey(e2IK))
logger.debug("Uri Prefix: " + prefixes.get(e2IK)); logger.debug("Uri Prefix: " + prefixes.get(e2IK));
} }

View File

@ -73,6 +73,7 @@ public class LocalSinkPoint implements ISinkPoint {
this.sinkFlow = sinkFlow; this.sinkFlow = sinkFlow;
} }
@SuppressWarnings("unchecked")
@Override @Override
public Set<FlowType<IExplodedBasicBlock>> findSources(CGAnalysisContext<IExplodedBasicBlock> ctx, public Set<FlowType<IExplodedBasicBlock>> findSources(CGAnalysisContext<IExplodedBasicBlock> ctx,
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult, TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult,

View File

@ -130,6 +130,7 @@ public class OutflowAnalysis {
logger.debug("added edge from {} to {}", source, dest); logger.debug("added edge from {} to {}", source, dest);
} }
@SuppressWarnings({ "unused", "unchecked" })
private void processArgSinks( private void processArgSinks(
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult, TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult,
IFDSTaintDomain<IExplodedBasicBlock> domain, IFDSTaintDomain<IExplodedBasicBlock> domain,
@ -234,6 +235,7 @@ public class OutflowAnalysis {
} }
} }
@SuppressWarnings({ "unused", "unchecked" })
private void processEntryArgs( private void processEntryArgs(
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult, TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult,
IFDSTaintDomain<IExplodedBasicBlock> domain, IFDSTaintDomain<IExplodedBasicBlock> domain,
@ -324,6 +326,7 @@ public class OutflowAnalysis {
} }
} }
@SuppressWarnings({ "unused", "unchecked" })
private void processEntryRets( private void processEntryRets(
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult, TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, DomainElement> flowResult,
IFDSTaintDomain<IExplodedBasicBlock> domain, IFDSTaintDomain<IExplodedBasicBlock> domain,

View File

@ -48,8 +48,6 @@ import org.scandroid.flow.types.FlowType;
import org.scandroid.flow.types.StaticFieldFlow; import org.scandroid.flow.types.StaticFieldFlow;
import org.scandroid.spec.StaticFieldSinkSpec; import org.scandroid.spec.StaticFieldSinkSpec;
import org.scandroid.util.CGAnalysisContext; import org.scandroid.util.CGAnalysisContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.ibm.wala.classLoader.IField; import com.ibm.wala.classLoader.IField;
@ -63,8 +61,8 @@ import com.ibm.wala.ssa.analysis.IExplodedBasicBlock;
* *
*/ */
public class StaticFieldSinkPoint implements ISinkPoint { public class StaticFieldSinkPoint implements ISinkPoint {
private static final Logger logger = LoggerFactory // private static final Logger logger = LoggerFactory
.getLogger(StaticFieldSinkPoint.class); // .getLogger(StaticFieldSinkPoint.class);
private final IField field; private final IField field;
private final FlowType<IExplodedBasicBlock> flow; private final FlowType<IExplodedBasicBlock> flow;
@ -84,6 +82,7 @@ public class StaticFieldSinkPoint implements ISinkPoint {
* CGAnalysisContext, com.ibm.wala.dataflow.IFDS.TabulationResult, * CGAnalysisContext, com.ibm.wala.dataflow.IFDS.TabulationResult,
* org.scandroid.domain.IFDSTaintDomain) * org.scandroid.domain.IFDSTaintDomain)
*/ */
@SuppressWarnings("unchecked")
@Override @Override
public Set<FlowType<IExplodedBasicBlock>> findSources( public Set<FlowType<IExplodedBasicBlock>> findSources(
CGAnalysisContext<IExplodedBasicBlock> ctx, CGAnalysisContext<IExplodedBasicBlock> ctx,
@ -95,7 +94,6 @@ public class StaticFieldSinkPoint implements ISinkPoint {
.getPossibleElements(new StaticFieldElement(field .getPossibleElements(new StaticFieldElement(field
.getReference()))) { .getReference()))) {
if (de.taintSource instanceof StaticFieldFlow<?>) { if (de.taintSource instanceof StaticFieldFlow<?>) {
@SuppressWarnings("unchecked")
StaticFieldFlow<IExplodedBasicBlock> source = (StaticFieldFlow<IExplodedBasicBlock>) de.taintSource; StaticFieldFlow<IExplodedBasicBlock> source = (StaticFieldFlow<IExplodedBasicBlock>) de.taintSource;
if (source.getField().equals(field)) { if (source.getField().equals(field)) {
continue; continue;

View File

@ -73,6 +73,7 @@ public final class CallNoneToReturnFunction <E extends ISSABasicBlock> implement
// this effectively taints everything in the heap that we've seen before. // this effectively taints everything in the heap that we've seen before.
DomainElement de = domain.getMappedObject(d); DomainElement de = domain.getMappedObject(d);
@SuppressWarnings("unchecked")
FlowType<E> taint = de.taintSource; FlowType<E> taint = de.taintSource;
for (CodeElement ce : domain.codeElements() ){ for (CodeElement ce : domain.codeElements() ){

View File

@ -280,7 +280,6 @@ implements IFlowFunctionMap<BasicBlockInContext<E>> {
UseDefSetPair p, IClassHierarchy ch) { UseDefSetPair p, IClassHierarchy ch) {
SSAPutInstruction pi = (SSAPutInstruction)instruction; SSAPutInstruction pi = (SSAPutInstruction)instruction;
PointerKey pk; PointerKey pk;
boolean isStatic;
Set<CodeElement> elements = Sets.newHashSet(); Set<CodeElement> elements = Sets.newHashSet();
if (pi.isStatic()) { if (pi.isStatic()) {
p.uses.addAll(CodeElement.valueElements(pa, bb.getNode(), instruction.getUse(0))); p.uses.addAll(CodeElement.valueElements(pa, bb.getNode(), instruction.getUse(0)));
@ -291,7 +290,6 @@ implements IFlowFunctionMap<BasicBlockInContext<E>> {
} else { } else {
pk = new StaticFieldKey(staticField); pk = new StaticFieldKey(staticField);
} }
isStatic = true;
} else { } else {
p.uses.addAll( p.uses.addAll(
CodeElement.valueElements(pa, bb.getNode(), instruction.getUse(1))); CodeElement.valueElements(pa, bb.getNode(), instruction.getUse(1)));
@ -302,7 +300,6 @@ implements IFlowFunctionMap<BasicBlockInContext<E>> {
//MyLogger.log(LogLevel.DEBUG, " instruction: "+instruction); //MyLogger.log(LogLevel.DEBUG, " instruction: "+instruction);
isStatic = false;
// add the object that holds the field that was modified // add the object that holds the field that was modified
// to the list of things tainted by this flow: // to the list of things tainted by this flow:
p.defs.addAll(CodeElement.valueElements(pa, bb.getNode(), valueNumber)); p.defs.addAll(CodeElement.valueElements(pa, bb.getNode(), valueNumber));
@ -332,21 +329,19 @@ implements IFlowFunctionMap<BasicBlockInContext<E>> {
SSAGetInstruction gi = (SSAGetInstruction)instruction; SSAGetInstruction gi = (SSAGetInstruction)instruction;
PointerKey pk; PointerKey pk;
boolean isStatic;
FieldReference declaredField = gi.getDeclaredField(); FieldReference declaredField = gi.getDeclaredField();
if ( gi.isStatic()) { if ( gi.isStatic()) {
IField staticField = IField staticField =
getStaticIField(ch, declaredField); getStaticIField(ch, declaredField);
if (staticField == null) if (staticField == null) {
pk = null; pk = null;
else } else {
pk = new StaticFieldKey(staticField); pk = new StaticFieldKey(staticField);
isStatic = true; }
} else { } else {
int valueNumber = instruction.getUse(0); int valueNumber = instruction.getUse(0);
pk = new LocalPointerKey(bb.getNode(), valueNumber); pk = new LocalPointerKey(bb.getNode(), valueNumber);
isStatic = false;
} }
if (pk!=null) { if (pk!=null) {
@ -407,6 +402,7 @@ implements IFlowFunctionMap<BasicBlockInContext<E>> {
} }
} }
@SuppressWarnings("unchecked")
public IntSet getTargets(int d1) { public IntSet getTargets(int d1) {
//System.out.println(this.toString()+".getTargets("+d1+") "+bb); //System.out.println(this.toString()+".getTargets("+d1+") "+bb);
//BitVectorIntSet set = new BitVectorIntSet(); //BitVectorIntSet set = new BitVectorIntSet();
@ -428,7 +424,7 @@ implements IFlowFunctionMap<BasicBlockInContext<E>> {
final SSAInvokeInstruction instruction = (SSAInvokeInstruction) src.getLastInstruction(); final SSAInvokeInstruction instruction = (SSAInvokeInstruction) src.getLastInstruction();
String signature = dest.getMethod().getSignature(); // String signature = dest.getMethod().getSignature();
// if ( dest.getMethod().isSynthetic() ) { // if ( dest.getMethod().isSynthetic() ) {
// System.out.println("Synthetic: "+signature); // System.out.println("Synthetic: "+signature);
// } else { // } else {
@ -482,7 +478,7 @@ implements IFlowFunctionMap<BasicBlockInContext<E>> {
// TODO: Look up summary for this method, or warn if it doesn't exist. // TODO: Look up summary for this method, or warn if it doesn't exist.
assert (src.getNode().equals(dest.getNode())); assert (src.getNode().equals(dest.getNode()));
final SSAInvokeInstruction instruction = (SSAInvokeInstruction) src.getLastInstruction(); // final SSAInvokeInstruction instruction = (SSAInvokeInstruction) src.getLastInstruction();
// System.out.println("call to return(no callee) method inside call graph: " + src.getNode()+"--" + instruction.getDeclaredTarget()); // System.out.println("call to return(no callee) method inside call graph: " + src.getNode()+"--" + instruction.getDeclaredTarget());
// System.out.println("call to system: " + instruction.getDeclaredTarget()); // System.out.println("call to system: " + instruction.getDeclaredTarget());

View File

@ -42,8 +42,6 @@ import java.util.List;
import org.scandroid.domain.CodeElement; import org.scandroid.domain.CodeElement;
import org.scandroid.domain.DomainElement; import org.scandroid.domain.DomainElement;
import org.scandroid.domain.IFDSTaintDomain; import org.scandroid.domain.IFDSTaintDomain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ibm.wala.dataflow.IFDS.IUnaryFlowFunction; import com.ibm.wala.dataflow.IFDS.IUnaryFlowFunction;
import com.ibm.wala.ssa.ISSABasicBlock; import com.ibm.wala.ssa.ISSABasicBlock;
@ -52,8 +50,8 @@ import com.ibm.wala.util.intset.MutableSparseIntSet;
final class PairBasedFlowFunction <E extends ISSABasicBlock> implements IUnaryFlowFunction { final class PairBasedFlowFunction <E extends ISSABasicBlock> implements IUnaryFlowFunction {
private static final Logger logger = // private static final Logger logger =
LoggerFactory.getLogger(PairBasedFlowFunction.class); // LoggerFactory.getLogger(PairBasedFlowFunction.class);
private final List<UseDefPair> useToDefList; private final List<UseDefPair> useToDefList;
private final IFDSTaintDomain<E> domain; private final IFDSTaintDomain<E> domain;

View File

@ -48,7 +48,6 @@ import org.scandroid.domain.ReturnElement;
import com.ibm.wala.dataflow.IFDS.IUnaryFlowFunction; import com.ibm.wala.dataflow.IFDS.IUnaryFlowFunction;
import com.ibm.wala.ssa.ISSABasicBlock; import com.ibm.wala.ssa.ISSABasicBlock;
import com.ibm.wala.util.intset.IntSet; import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableSparseIntSet;
import com.ibm.wala.util.intset.SparseIntSet; import com.ibm.wala.util.intset.SparseIntSet;
/** /**

View File

@ -117,7 +117,8 @@ public abstract class FlowType<E extends ISSABasicBlock> {
* @param b * @param b
* @return * @return
*/ */
private boolean compareBlocks(BasicBlockInContext<E> a, @SuppressWarnings("unused")
private boolean compareBlocks(BasicBlockInContext<E> a,
BasicBlockInContext<E> b) { BasicBlockInContext<E> b) {
// delegate to the defined implementation, but only if it's true. // delegate to the defined implementation, but only if it's true.
if (a.equals(b)) { if (a.equals(b)) {

View File

@ -40,7 +40,6 @@ package org.scandroid.prefixtransfer;
import com.ibm.wala.dataflow.graph.AbstractMeetOperator; import com.ibm.wala.dataflow.graph.AbstractMeetOperator;
import com.ibm.wala.dataflow.graph.ITransferFunctionProvider; import com.ibm.wala.dataflow.graph.ITransferFunctionProvider;
import com.ibm.wala.fixpoint.UnaryOperator; import com.ibm.wala.fixpoint.UnaryOperator;
import com.ibm.wala.fixpoint.IVariable;
public class PrefixTransferFunctionProvider implements ITransferFunctionProvider<InstanceKeySite, PrefixVariable> { public class PrefixTransferFunctionProvider implements ITransferFunctionProvider<InstanceKeySite, PrefixVariable> {
@ -50,7 +49,6 @@ public class PrefixTransferFunctionProvider implements ITransferFunctionProvider
public UnaryOperator<PrefixVariable> getEdgeTransferFunction( public UnaryOperator<PrefixVariable> getEdgeTransferFunction(
InstanceKeySite src, InstanceKeySite dst) { InstanceKeySite src, InstanceKeySite dst) {
// TODO Auto-generated method stub
return null; return null;
} }
@ -67,14 +65,12 @@ public class PrefixTransferFunctionProvider implements ITransferFunctionProvider
public byte evaluate(PrefixVariable lhs, PrefixVariable[] rhs) { public byte evaluate(PrefixVariable lhs, PrefixVariable[] rhs) {
// System.out.println("Evaluating meet"); // System.out.println("Evaluating meet");
boolean changed = false; boolean changed = false;
for(IVariable iv:rhs)
{ for (final PrefixVariable rhsTPV : rhs) {
PrefixVariable rhsTPV = (PrefixVariable)iv;
changed = lhs.updateAll(rhsTPV) || changed; changed = lhs.updateAll(rhsTPV) || changed;
} }
if(changed)
return 1; return (changed ? (byte) 1 : (byte) 0);
return 0;
} }
@Override @Override

View File

@ -128,8 +128,8 @@ public class PrefixTransferGraph implements Graph<InstanceKeySite> {
{ {
if(k instanceof ConstantKey) if(k instanceof ConstantKey)
{ {
logger.debug("ConstantKey: "+((ConstantKey)k).getValue()); logger.debug("ConstantKey: "+((ConstantKey<?>)k).getValue());
node = new ConstantString(pa.getInstanceKeyMapping().getMappedIndex(k), (String)((ConstantKey)k).getValue()); node = new ConstantString(pa.getInstanceKeyMapping().getMappedIndex(k), (String)((ConstantKey<?>)k).getValue());
addNode(node); addNode(node);
nodeMap.put(k, node); nodeMap.put(k, node);
} }

View File

@ -133,7 +133,7 @@ public class UriPrefixTransferGraph implements Graph<InstanceKeySite> {
{ {
if(k instanceof ConstantKey) if(k instanceof ConstantKey)
{ {
node = new ConstantString(pa.getInstanceKeyMapping().getMappedIndex(k), (String)((ConstantKey)k).getValue()); node = new ConstantString(pa.getInstanceKeyMapping().getMappedIndex(k), (String)((ConstantKey<?>)k).getValue());
addNode(node); addNode(node);
// logger.debug(node); // logger.debug(node);
nodeMap.put(k, node); nodeMap.put(k, node);

View File

@ -43,18 +43,15 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.scandroid.model.AppModelMethod;
import org.scandroid.util.LoaderUtils; import org.scandroid.util.LoaderUtils;
import com.ibm.wala.classLoader.IClass; import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod; import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.cha.ClassHierarchy; import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.ClassLoaderReference;
public class AndroidSpecs implements ISpecs { public class AndroidSpecs implements ISpecs {
private AppModelMethod appEntrySummary; // private AppModelMethod appEntrySummary;
static String act = "Landroid/app/Activity"; static String act = "Landroid/app/Activity";
static String svc = "Landroid/app/Service"; static String svc = "Landroid/app/Service";
@ -146,9 +143,9 @@ public class AndroidSpecs implements ISpecs {
static MethodNamePattern httpExecute = static MethodNamePattern httpExecute =
new MethodNamePattern(http, "execute"); new MethodNamePattern(http, "execute");
private static MethodNamePattern[] callbackModelEntry = { // private static MethodNamePattern[] callbackModelEntry = {
new MethodNamePattern("Lcom/SCanDroid/AppModel", "entry") // new MethodNamePattern("Lcom/SCanDroid/AppModel", "entry")
}; // };
static MethodNamePattern llLocChanged = static MethodNamePattern llLocChanged =
new MethodNamePattern(ll, "onLocationChanged"); new MethodNamePattern(ll, "onLocationChanged");

View File

@ -40,13 +40,13 @@ package org.scandroid.spec;
class ResolvedSpec { class ResolvedSpec {
ResolvedSpec() { ResolvedSpec() {
AndroidSpecs spec = new AndroidSpecs(); // AndroidSpecs spec = new AndroidSpecs();
//
for(MethodNamePattern m: spec.getEntrypointSpecs()) { // for(MethodNamePattern m: spec.getEntrypointSpecs()) {
} // }
for(SourceSpec s: spec.getSourceSpecs()) { // for(SourceSpec s: spec.getSourceSpecs()) {
} // }
for(ISinkSpec s: spec.getSinkSpecs()) { // for(ISinkSpec s: spec.getSinkSpecs()) {
} // }
} }
} }

View File

@ -480,7 +480,8 @@ public class SSAtoXMLVisitor implements SSAInstruction.IVisitor {
return summary; return summary;
} }
private String typeRefToStr(TypeReference fieldType) @SuppressWarnings("unused")
private String typeRefToStr(TypeReference fieldType)
throws UTFDataFormatException { throws UTFDataFormatException {
Atom className = fieldType.getName().getClassName(); Atom className = fieldType.getName().getClassName();
Atom pkgName = fieldType.getName().getPackage(); Atom pkgName = fieldType.getName().getPackage();

View File

@ -123,6 +123,7 @@ public class CGAnalysisContext<E extends ISSABasicBlock> {
this(analysisContext, specifier, new ArrayList<InputStream>()); this(analysisContext, specifier, new ArrayList<InputStream>());
} }
@SuppressWarnings({ "rawtypes", "unchecked" })
public CGAnalysisContext(AndroidAnalysisContext analysisContext, public CGAnalysisContext(AndroidAnalysisContext analysisContext,
IEntryPointSpecifier specifier, IEntryPointSpecifier specifier,
Collection<InputStream> extraSummaries) throws IOException { Collection<InputStream> extraSummaries) throws IOException {

View File

@ -210,7 +210,7 @@ public class DexDotUtil extends DotUtil {
result.append(fontnameStr); result.append(fontnameStr);
result.append("]; \n"); result.append("]; \n");
Collection dotNodes = computeDotNodes(g); Collection<T> dotNodes = computeDotNodes(g);
outputNodes(labels, result, dotNodes); outputNodes(labels, result, dotNodes);
@ -230,8 +230,8 @@ public class DexDotUtil extends DotUtil {
return result; return result;
} }
private static void outputNodes(NodeDecorator labels, StringBuffer result, Collection dotNodes) throws WalaException { private static <T> void outputNodes(NodeDecorator labels, StringBuffer result, Collection<T> dotNodes) throws WalaException {
for (Iterator it = dotNodes.iterator(); it.hasNext();) { for (Iterator<T> it = dotNodes.iterator(); it.hasNext();) {
outputNode(labels, result, it.next()); outputNode(labels, result, it.next());
} }
} }

View File

@ -149,7 +149,8 @@ public class EntryPoints {
} }
} }
private void systemEntry(ClassHierarchy cha, AndroidAnalysisContext loader) { @SuppressWarnings("unused")
private void systemEntry(ClassHierarchy cha, AndroidAnalysisContext loader) {
String[] systemEntyPoints = { String[] systemEntyPoints = {
// "android.app.ActivityThread.main([Ljava/lang/String;)V" // "android.app.ActivityThread.main([Ljava/lang/String;)V"
// , "com.android.server.ServerThread.run()V" // , "com.android.server.ServerThread.run()V"
@ -279,7 +280,8 @@ public class EntryPoints {
} }
} }
private static String getTagValue(String sTag, Element eElement) { @SuppressWarnings("unused")
private static String getTagValue(String sTag, Element eElement) {
NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes(); NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes();
Node nValue = (Node) nlList.item(0); Node nValue = (Node) nlList.item(0);
@ -322,7 +324,8 @@ public class EntryPoints {
} }
} }
private void populateEntryPoints(ClassHierarchy cha) { @SuppressWarnings("unused")
private void populateEntryPoints(ClassHierarchy cha) {
String method = null; String method = null;
IMethod im = null; IMethod im = null;
for (String[] intent: ActivityIntentList) { for (String[] intent: ActivityIntentList) {
@ -349,7 +352,8 @@ public class EntryPoints {
//entries.add(new DefaultEntrypoint(im, cha)); //entries.add(new DefaultEntrypoint(im, cha));
} }
private String IntentToMethod(String intent) { @SuppressWarnings("unused")
private String IntentToMethod(String intent) {
if (intent.contentEquals("android.intent.action.MAIN") || if (intent.contentEquals("android.intent.action.MAIN") ||
intent.contentEquals("android.media.action.IMAGE_CAPTURE") || intent.contentEquals("android.media.action.IMAGE_CAPTURE") ||
intent.contentEquals("android.media.action.VIDEO_CAPTURE") || intent.contentEquals("android.media.action.VIDEO_CAPTURE") ||
@ -380,7 +384,8 @@ public class EntryPoints {
} }
} }
private void outputIntentList() { @SuppressWarnings("unused")
private void outputIntentList() {
if (ActivityIntentList != null) if (ActivityIntentList != null)
for (int i = 0; i < ActivityIntentList.size(); i++) for (int i = 0; i < ActivityIntentList.size(); i++)
logger.debug("Activity Intent: " + ActivityIntentList.get(i)[0] + " ~> " + ActivityIntentList.get(i)[1]); logger.debug("Activity Intent: " + ActivityIntentList.get(i)[0] + " ~> " + ActivityIntentList.get(i)[1]);

View File

@ -62,7 +62,8 @@ public class WalaGraphToJGraphT {
private DirectedGraph<CGNode, DefaultEdge> jgrapht; private DirectedGraph<CGNode, DefaultEdge> jgrapht;
private DijkstraShortestPath<CGNode, DefaultEdge> shortestpath; private DijkstraShortestPath<CGNode, DefaultEdge> shortestpath;
public <E extends ISSABasicBlock> @SuppressWarnings("rawtypes")
public <E extends ISSABasicBlock>
WalaGraphToJGraphT(TabulationResult<BasicBlockInContext<E>, CGNode, DomainElement> flowResult, WalaGraphToJGraphT(TabulationResult<BasicBlockInContext<E>, CGNode, DomainElement> flowResult,
IFDSTaintDomain<E> domain, IFDSTaintDomain<E> domain,
FlowType source, ISupergraph<BasicBlockInContext<E>, CGNode> graph, CallGraph cg) { FlowType source, ISupergraph<BasicBlockInContext<E>, CGNode> graph, CallGraph cg) {