Commit Graph

67 Commits

Author SHA1 Message Date
Ben Liblit a888a49fdd Fix all Eclipse warnings about unnecessary semicolons
I have *not* upgraded this problem to be treated as an error in the
future.  Unfortunately Eclipse uses a single configuration setting for
both unnecessary semicolons and also for empty control-flow statements
like `while (p) ;`.  I'm not convinced that it's worth rewriting all
instances of the latter into `while (p) { }`.  So this is just going
to stay as a warning for now.
2017-07-14 22:39:01 -07:00
Ben Liblit e316471d88 Fix nearly all Eclipse warnings about using raw types
Along the way, I also converted many "for (;;)" loops into modern
"for (:)" loops.  I didn't systematically look for all opportunities
to do this, though.  I merely made this change where I was already
converting raw Iterator uses into modern Iterator<...> uses.

Better use of generics also allowed many casts to become statically
redundant.  I have removed all such redundant casts.

Only three raw-types warnings remain after this batch of fixes.  All
three involve raw uses of CallGraphBuilder.  I've tried to fix these
too, but it quickly snowballs into a cascade of changes that may or
may not eventually reach a statically-type-save fixed point.  I may
give these last few problem areas another go in the future.  For now,
though, the hundreds of other fixes seem worth keeping even if there
are a few stragglers.

This commit may change some public APIs, but only by making weaker
type signatures stronger by replacing raw types with generic types.
For example, we may change something like "Set" into "Set<String>",
but we're not adding new arguments, changing any
underlying (post-generics-erasure) types, etc.
2017-07-12 10:39:06 -07:00
Manu Sridharan b82e808b32 Merge pull request #156 from liblit/warning-fixes-unnecessary-code-uncontroversial
Fix 265 Eclipse warnings about unnecessary code
2017-03-23 17:48:10 -07:00
Ben Liblit 16492c7b78 Revert "Suppress 157 Eclipse warnings about unused exception parameters"
This reverts commit fe9f7a793a.
2017-03-23 16:32:00 -05:00
Ben Liblit 323224504a Suppress several unfixable warnings about unresolved type references
Fixing these Javadoc comments would require adding packages to various
other packages' build paths.  In some of the cases suppressed,
changing build paths in that manner would create circular build
dependencies.  In other cases, it would simply add a Javadoc-motivated
dependency that does not exist for the real code, which seems
undesirable.  For a few cases, the reference seems to be to types in
code we don't even have here, such as code from "android" or
"org.mozilla" packages.
2017-03-22 20:40:52 -05:00
Ben Liblit fe9f7a793a Suppress 157 Eclipse warnings about unused exception parameters
In the cases addressed here, the caught exception is truly not needed
by the handling code.
2017-03-20 00:44:06 -05:00
Ben Liblit 6766f1e261 Fix 42 Eclipse warnings about unused imports 2017-03-20 00:43:48 -05:00
Ben Liblit 296657a394 Suppress 88 Eclipse warnings about dead code
All of these involve conditionals that check some static, final debug
flag or debug level.  The code will indeed be dead if WALA is built
with those debug facilities turned off.  But we still want the code
present in case someone needs to turn some aspect of debugging on for
a while.
2017-03-17 21:49:34 -05:00
Ben Liblit 994a70500f Remove redundant generic type parameters where possible
Instead, rely on Java's ability to infer type parameters in many
contexts.  This removes 665 Eclipse warnings.

Note: a few of these changes are to files under "test" subdirectories.
Presumably those are files that serve as test inputs rather than being
part of WALA code proper.  As far as I can tell, these changes do not
break any WALA tests.  But if any of those tests were specifically
intended to exercise WALA on code with non-inferred generic type
parameters, then I really should be leaving those alone.
2017-03-11 21:20:51 -06:00
Julian Dolby f595eb357e add some abstraction to IR, using IRView 2017-03-11 13:22:45 -05:00
Julian Dolby d24519e974 cross-cutting changes to make more of WALA runnable with TeaVM. The biggest change is refactoring to AnalysisCache and friends; since TeaVM does not support SoftReference, I needed to add a layer of interfaces so that I can use a more simpleminded caching implementation for TeaVM. There are other changes to Module and friends to break connections with File and URL, which also cause TeaVM grief. I also organized imports in many places to remove unused types that caused trouble. 2017-02-02 20:33:27 -05:00
Julian Dolby 8b2ab22335 support for full CPA, when desired. 2016-09-15 21:32:35 -04:00
Julian Dolby 563b6ba6aa fixes for for ... in ... form in JavaScript 2015-07-24 22:44:10 -04:00
Julian Dolby 0975441a43 changes for hybrid analysis 2015-04-05 21:19:56 -04:00
Julian Dolby c9ad359d65 new test to remind me that prototype no longer works with correlation tracking:
com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestPrototypeCallGraphShapeRhino.java
com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPrototypeCallGraphShape.java
com.ibm.wala.cast.js.test.data/examples-src/pages/prototype.html

work (not yet finished) on fixes to property accesses for JavaScript:
com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/AstSSAPropagationCallGraphBuilder.java
com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/callgraph/AstJavaSSAPropagationCallGraphBuilder.java
com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSSSAPropagationCallGraphBuilder.java

currently unused tests to remind me to fix bugs:
com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java
com.ibm.wala.cast.js.test.data/examples-src/tests/loops.js
com.ibm.wala.cast.js.test.data/examples-src/tests/primitive_strings.js

fixes to exception handler code generation in JavaScript:
com.ibm.wala.cast.js.rhino/source/com/ibm/wala/cast/js/translator/RhinoToAstTranslator.java
com.ibm.wala.cast.js.test.data/examples-src/tests/try.js
com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java

fixes to make the system build on both juno and luna
com.ibm.wala.cast.js.test.data/pom.xml
pom.xml
targets/e42/e42.target
targets/e44/e44.target
targets/pom.xml
com.ibm.wala.core.tests/META-INF/MANIFEST.MF
com.ibm.wala.dalvik.test/META-INF/MANIFEST.MF
com.ibm.wala.ide.jdt.test/META-INF/MANIFEST.MF
com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/FakeExceptionTypeBinding.java
com.ibm.wala.ide.jdt/source/com/ibm/wala/ide/util/JavaEclipseProjectPath.java
com.ibm.wala.ide.jsdt.tests/META-INF/MANIFEST.MF
com.ibm.wala.ide.jsdt.tests/src/com/ibm/wala/ide/jsdt/tests/AbstractJSProjectScopeTest.java
com.ibm.wala.ide/src/com/ibm/wala/ide/util/EclipseProjectPath.java
com.ibm.wala.ide/src/com/ibm/wala/ide/util/ProgressMonitorDelegate.java

beginnings of "pointer analysis" on top of field-based analysis
com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/FlowGraph.java
com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/vertices/PropVertex.java
com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/vertices/RetVertex.java
com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/vertices/VarVertex.java
com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/vertices/VertexFactory.java
com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/PointerAnalysis.java
com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/cfa/ExceptionReturnValueKey.java

fixes for crashes in correlartion tracking
com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ClosureExtractor.java

fixes for Dalvik IR generation
com.ibm.wala.core/src/com/ibm/wala/cfg/BytecodeCFG.java
com.ibm.wala.core/src/com/ibm/wala/cfg/ShrikeCFG.java
com.ibm.wala.core/src/com/ibm/wala/ssa/SSACFG.java
com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/drivers/APKCallGraphDriver.java
com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/JVMLDalvikComparison.java
com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/DexCFG.java
com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/UnaryOperation.java
com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/ssa/AbstractIntRegisterMachine.java
com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/ssa/DexSSABuilder.java

fixes to stack map generation when instrumenting for Java 7
com.ibm.wala.shrike/src/com/ibm/wala/shrike/cg/DynamicCallGraph.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/ConstantInstruction.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Analyzer.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/ClassHierarchy.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Verifier.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/ClassInstrumenter.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/StackMapConstants.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/StackMapTableReader.java
com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/StackMapTableWriter.java
2014-10-15 16:01:38 +09:00
Julian Dolby 774be73672 Merge https://github.com/jgf/wala-mirror 2014-09-11 10:43:13 -04:00
Julian Dolby 26f5254e3e more support for Java 7:
analysis now understands and propagates MethodHandle objects
  fixes to Shrike InvokeDynamic instruction


Former-commit-id: fb826f124423bcbca08f729cee1794fbda711d16
2014-08-07 16:02:48 -04:00
Juergen Graf 4772f36d47 add standard type parameter to most pointer analysis references. When it breaks we move back to ? extends InstanceKey. 2014-05-20 22:00:06 +02:00
Julian Dolby 080325b5f6 merge 2013-06-25 11:57:37 -04:00
Manu Sridharan dcc7cd206d bug fix: allow each language to determine when a CGNode represents the "definer" method for a lexical access 2013-04-29 20:34:40 -07:00
Manu Sridharan 11c6619c7f Variety of changes to JS front end.
- crash fixes
- small enhancements to prologue and preamble
- tighter handling of timeouts during CG construction
2013-04-09 15:47:22 -07:00
Julian Dolby 9aa474fdb1 1) added InstanceKey.getCreation sites and its implementations
2) fixes for issues with keys representing dynamic properties
  i) all properties are converted to strings, in an approximation of JS
semantics
3) fix to handling of instance keys representing numbers in binary +;
now it understands that adding constant keys of type Number requires
adding a non-constant Number key to the lval
2013-01-07 20:18:27 -05:00
Manu Sridharan 5bcdb30014 add method to get a PointerKey for a global 2012-11-30 13:37:34 -05:00
Manu Sridharan 4a87d7b145 compare FieldValueDispatch objects based on CGNode as well 2012-11-30 11:04:48 -05:00
dolby 4b3cba710d changes from upstream 2012-06-29 15:47:54 -04:00
dolby-oss 44e7a02ac3 improve handling of binary expressions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4544 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-03-08 17:35:04 +00:00
dolby-oss a9ec87f360 Changes motivated by analysis issues in JavaScript. The main change is that calls of the form f.x() in JavaScript are now analyzed like 'method calls' so that the 'this' pointer in the receiver functions can be filtered based upon the types that actually have the method being invoked. This requires much more dynamic filtering than in a language like Java, since properties like 'x' are simply properties that happen to hold functions, and so can be assigned in a first-class manner. Thus, the filtering needs to handle variance in both the types and the values of their properties; this is implemented as multiple levels of abstract object directed side effect equations in the dataflow system.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4535 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-03-01 02:45:51 +00:00
msridhar1 a1a62d4793 Fixed a longstanding bug in the handling of arguments: both v1 _and_ v2
should be ignored when setting up the arguments array (the former is the
invoked function, the latter is the receiver).

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4480 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-02-17 20:18:32 +00:00
dolby-oss 4c6d062dbb blunt force trauma to CAst frond end:
1) Structural changes in the AstTranslator to allow retranslation and generation of custom IR.  This is mostly moving state from the translator itself into the context.
2) Some refactoring to share some AST generation code across the Java and JavaScript front ends.
3) Switching to the latest Rhino, release 1.7R3; this is a pervasive change to the JavaScript Rhino translator, since it involves switching to the new AST interface in Rhino.
4) Common code to, as an option, translate Do-style loops by replicating the loop body.  This allows the use of CAstNode.LOOP forms for such loops.
5) Some bug fixes to the mechanisms of the CAstRewriter to handle weird control flow cases.
6) An example of retranslation to specialize JavaScript methods based on how many arguments they receive at call sites.


git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4425 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-27 20:15:33 +00:00
msridhar1 c40917c3da remove unused imports
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4421 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 23:31:16 +00:00
msridhar1 7d6fe1d943 make field private again
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4403 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 21:47:23 +00:00
msridhar1 ce72e0fb93 make __proto__ not enumerable
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4391 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 21:44:25 +00:00
msridhar1 22f6ba3e0c extra diagnostics
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4354 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 21:31:44 +00:00
msridhar1 3172ba6b0f Fixed data flow propagation code for the arguments array: arguments[0]
is not the receiver, it is the first real argument.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4328 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 21:24:53 +00:00
msridhar1 eb73fac9e4 documentation of global object handling
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4326 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 21:24:25 +00:00
msridhar1 8ce7db97ea more global object handling; needs documentation
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4324 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 21:23:56 +00:00
msridhar1 306bc98bf5 progress on modeling the global object
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4321 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-06 21:22:58 +00:00
msridhar1 409a8f83b5 a little more debug info
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4206 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-07-02 15:34:21 +00:00
msridhar1 2b443852fc pull out hacked for-in context selector. add some debugging output
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4200 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-07-01 16:48:18 +00:00
dolby-oss 3e573a992d upgrades to lexical soping implements to address some performance issues
fixes to HTML model to capture use of local vars as window state in scripts


git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4176 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-05-23 16:27:07 +00:00
msridhar1 1f97edecc7 formatting, minor refactoring
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4168 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-05-04 21:06:35 +00:00
dolby-oss 4da02a9125 Changes to extend supported context sensitivity to CPA-style:
1) extend ContextSelector interface to allow it to specify parameters of interest
  2) extend filtering mechanism at call sites to allow CPA-style filtering when requested by contexts
  3) various related fixes and extensions:
    a) removed redundant code to handle dispatch for JavaScript, so now it shares the core mechanism
    b) tighten types for operators that take an array of args - now the array is T[] at the cost of a few array allocation methods
    c) a bit more support for empty int sets
    d) void function objects
    e) bug fixes for lexical scoping support, and adaptation to work with core dispatch mechanism
    f) example of CPA-style sensitivity to handle nastiness in a JavaScript for(.. in ...) loop
    

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4150 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-27 13:58:56 +00:00
dolby-oss 6b47bc0bd1 fix import warning
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4100 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-04 17:31:19 +00:00
dolby-oss 684524e4bc added recording of script tag locations from which script code is included into the analysis of a Web page
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4097 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-04 17:16:18 +00:00
dolby-oss cdd42a68b6 updates to processing of Web pages:
1) adopted the code from Rational for HTML handling
    i) extended it to integrate better source mapping into IR
    ii) integrated fixes from the old html processing to collect more info on forms
    iii) added some copyright comments
  2) updated version of jericho
  3) added support for nu.validator for html5
  4) added script to fetch html parser jars, and removed binary jar
  

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4090 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-04 15:23:58 +00:00
sjfink fa825de846 refactoring of fixpoint API
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4033 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-01-17 21:43:18 +00:00
dolby-oss c7558b3646 fixes for Rational
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3985 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-11-02 19:11:58 +00:00
dolby-oss 0ddb040987 bug fix for context-sensitive analysis of javascript functions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3935 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-09-14 20:28:04 +00:00
msridhar1 447823c629 kill unused supportRefinement option
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3833 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-05-12 18:30:55 +00:00
dolby-oss 2e724aac3e fixes for JavaScript motivated by Web examples
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3823 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-04-28 19:38:28 +00:00