Sable/soot — pull request #213 by lazaroclapp (2014-06-10 00:46:05+00:00)
Title: Issue109fix

This is intended to be a fix for Issue 109 (https://github.com/Sable/soot/issues/109 ).

It works by allowing the user to specify a different throw analysis to be used during validation inside soot.Body. In particular, '-check-init-throw-analysis dalvik' will use DalvikThrowAnalysis instead of PedanticThrowAnalysis during Body validation. This makes many Android apps pass validation that would otherwise not because PedanticThrowAnalysis is overly conservative for such applications (e.g. some versions of Google's Ad library seem to be running into this problem).

Things to note:

- This adds a new command line option to soot ('check-init-throw-analysis') with three possible arguments ('pedantic' [current behavior; used by default], 'unit' and 'dalvik').

- This imports 'soot.dexpler.DalvikThrowAnalysis' inside soot.Body. I am not sure whether it's OK to have soot.Body depend on soot.dexpler.* (e.g. are there versions of soot which do not include dexpler?). If this is a problem, let me know and I will make a new version of this patch that dynamically loads DalvikThrowAnalysis via reflection and throws an error when it is not available (of course, if there is a better way to do this, I would be glad to know).

- Included with this patch there is a small fix in which 'Objects.hash(from, to)' (available only in Java 7+) is replaced by 'Arrays.hashCode(new Object[]{from,to})' (the corresponding Java 6 compatible idiom).