Commit Graph

35 Commits

Author SHA1 Message Date
Erik Derr ee13713c4d Impl of IMethod.is(Wala)Synthetic and IClass.isSynthetic (#359)
* Impl of IMethod isSynthetic and isWalaSynthetic

So far IMethod.isSynthetic referred to WALA-generated helper functions
and there was no equivalent to check whether an IMethod is synthetic in
terms of compiler-generated.

To make naming consistent this patch first renames the isSynthetic to
isWalaSynthetic to clearly indicate that a given IMethod was generated
by WALA. Then, we re-introduce isSynthetic that from now on checks
whether an IMethod is synthetic/compiler-generated (referring to the
synthetic flag in bytecode)

* Implementation of IClass.isSynthetic

Complementary to IMethod.isSynthetic, this method checks whether
an IClass is compiler-generated.

* updated JavaDoc
2018-10-02 22:28:21 -07:00
Julian Dolby c8cdaf8616 further refactoring to enable more reuse
eliminate all non-jva 8 compilation
2018-02-05 15:18:37 -08:00
Ben Liblit 9c83e87cc1 Merge branch 'master' into modernization-java-8-lambdas-and-method-references 2017-11-29 10:51:33 -06:00
Ben Liblit ebfd885d22 Use modern for-each loops where possible
Java sources used as test data have been excluded from this mass
clean-up.
2017-11-28 14:44:53 -06:00
Ben Liblit 790d37781b Convert many single-method anonymous classes to lambdas
Eclipse's automated code clean-up tool did most of the heavy lifting
here: it specifically has a clean-up option for converting functional
interfaces to lambdas.  I merely had to revert the automated changes
for a single enumeration class for which it produced invalid results,
and for a few test inputs that apparently aren't set up to be compiled
with Java 8.
2017-11-27 11:31:15 -06:00
Ben Liblit 6087b73cee Fix or suppress all 242 Eclipse warnings about unused parameters
In general, my approach was to try to eliminate each unused parameter
using Eclipse's "Change Method Signature" refactoring.  That did not
always succeed: a parameter may be unused in some base class method,
but then be used in subclass's override of that method.  In cases
where refactoring to eliminate a parameter failed, I instead annotated
the parameter with '@SuppressWarnings("unused")' to silence the
warning.

Note: this group of changes creates a significant risk of
incompatibility for third-party WALA code.  Some removed parameters
change externally-visible APIs.  Furthermore, these changes do not
necessarily lead to Java compilation errors.  For example, suppose
third-party code subclasses a WALA class or interface, overrides a
method, but does not annotate that method as @Override.  Removing a
parameter means that the third-party method no longer overrides.  This
can quietly change code behavior without compile-time errors or
warnings.  This is exactly why one should use @Override wherever
possible, but we cannot guarantee that third-party WALA users have
done that.
2017-07-31 15:29:00 -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
Ben Liblit 6766f1e261 Fix 42 Eclipse warnings about unused imports 2017-03-20 00:43:48 -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 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
Michael Heilmann 0bb5e6998e Remove redundant casts and imports, improve doc comments 2014-06-26 17:51:26 +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
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
dolby-oss 81c12b97af cleanups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4189 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-06-30 15:41:40 +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
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
sjfink 957cb2b8ca deprecate Trace
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3432 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-09 20:31:14 +00:00
sjfink 300568f339 delete PointerFlowGraph
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2612 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-02-24 00:05:54 +00:00
dolby-oss b648bd3ceb committed patch from Evan Battaglia to support outer.new inner() form. Thanks!
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2591 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-02-18 15:17:16 +00:00
sjfink 07c0f9e485 clean up TypeInference API
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1908 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-10-19 14:39:15 +00:00
sjfink a193724b5f adapt to wala.core IteratorPlusOne change and clean up some generics
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1708 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-08-31 23:51:15 +00:00
yahave 8d5172fbc8 fixed bounds of iteration over symbol table using getMaxValueNumber. Loops should be iterating all the way to the MaxValueNumber returned (i.e., <=).
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1653 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-08-22 15:33:46 +00:00
dolby-oss d830347245 make enclosing object keys usable by others
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1579 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-08-07 13:47:16 +00:00
sjfink 3026eda8a3 decouple IR caching from AnalysisOptions with a new AnalysisCache object
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1517 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-07-20 15:20:06 +00:00
sjfink 192f06a387 massive overhaul of Warnings management
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1384 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-07-06 22:08:34 +00:00
sjfink f6edb9f1d3 misc. cleanups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1280 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-06-15 14:01:32 +00:00
dolby-oss cb8692477b support for cross-language call graphs
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1218 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-06-01 03:37:03 +00:00
sjfink c3c66d8e2b just format
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@943 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-04-12 14:54:43 +00:00
dolby-oss 66cd369ee7 Fix type inference for + operations that involve strings
skip synthetic code when trying to deal with enclosing types

fixes to invoke polyglot better so as to use its Unicode support

use constants directly when accessing fields said by polyglot to be constant

support static initializers

use exclusions file in the source analysis engine, if one is provided


git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@840 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-03-12 02:06:00 +00:00
dolby-oss 06c5431ba0 fixes to handling of enclosing objects for inner classes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@703 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-09 18:19:13 +00:00
sjfink 0cbace78e1 miscellaneous minor cleanups. eclipse build stuff. import statements.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@678 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-08 19:07:47 +00:00
dolby-oss 55e7a45e53 first cut at handling inner classes properly; moving around of code for analysis engines to make them provide a default way to build a call graph
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@657 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-07 18:51:19 +00:00
dolby-oss c4b9499bd2 Initial contribution of core script analysis code
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@618 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-02 17:20:09 +00:00