Commit Graph

61 Commits

Author SHA1 Message Date
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 191904d607 Remove "throws XYZ" declarations where XYZ cannot be thrown
Unnecessary "throws" declarations tend to cascade.  If foo() calls
bar() and bar() falsely declares that it might throw IOException, that
often leads a programmer to declare that foo() might throw IOException
as well.  Fixing the bar() throws declaration then reveals that we can
fix the foo() throws declaration too.  By the time we reach a fixed
point with cleaning these up, we have removed roughly 320 unnecessary
throws declarations.

In a few cases, this cleanup even lets us remove entire "try
... catch" statements where the only thing being caught was an
exception that we now statically know cannot be thrown.  Nice!

In Eclipse project configurations, upgrade any future such shenanigans
from warnings to errors.  Now that we've fixed this, we don't want it
coming back again.

There is a potential drawback to this change.  Conceivably some public
WALA API entry point might have declared that it could throw some
exception merely to reserve the *option* of throwing that exception in
third-party code that subclasses and overrides the API entry point in
question.  I have no idea whether this is a significant concern in
practice, though.
2017-07-28 10:20:28 -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 554a6e7ee9 Add options to ignore inter-procedural control dependence
In certain cases, one may want to ignore inter-procedural control
dependence.  Consider the following example:

    flag = getFlagVal();
    if (flag) {
      doStuff();
    }

If we are ignoring interprocedural control dependence, a forward slice
from the first statement will *not* include statements inside doStuff()
and its transitive callees.

This option is useful in scenarios where the effects of statements
inside control-dependent callees can be accounted for via some cheaper
effect analysis.  E.g., if you only care about heap effects of control-
dependent callees, you can compute that using mod-ref analysis,
rather than sucking all the control-dependent callee statements into the
slice.

Also added some more detailed comments, a new unit test, and removed
some trailing whitespace.
2017-05-26 15:29:08 -07:00
Ben Liblit 9159ea7636 Remove unnecessary `klass` argument and propagate back to callers (#174) 2017-05-03 16:25:00 -07:00
Manu Sridharan 88bd0c01cd more aggressive exclusions 2017-04-16 21:30:44 -07:00
Manu Sridharan 6bf0108964 actually add an assertion 2017-04-16 20:45:14 -07:00
Manu Sridharan ed4b0e45ee add test case for mailing list issue 2017-04-16 20:40:41 -07:00
Ben Liblit fde65340d2 Fix 132 Eclipse warnings about using raw generic types 2017-03-15 11:08:20 -05:00
Ben Liblit b1678882b3 Plug numerous potential resource leaks
This fixes 33 out of 37 Eclipse "Potential resource leak: '...' may
not be closed" warnings.  It also fixes 3 out of 37 Eclipse "Resource
'...' should be managed by try-with-resource" warnings, although that
was not the main focus of this effort.

The remaining 4 warnings about potential resource leaks all involve a
leaked JarFile instance that is passed to a JarFileModule constructor
call.  JarFileModile never attempts to close its underlying JarFile;
this code is written as though JarFile cleanup were the caller's
responsibility.  However, the JarFile often cannot be closed by the
code that creates the JarFileModule either, since the JarFile needs to
remain open while the JarFileModule is in use, and some of these
JarFileModules stay around beyond the lifetime of the code that
created them.  Truly fixing this would essentially require making
JarFileModule implement Closeable, which in turn would probably
require that Module implement Closeable, which in turn would require
changes to lots of code that deals with Module instances to arrange
for them to be properly closed.  That's more invasive than I'm
prepared to take on right now.
2017-03-12 21:38:43 -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 c9b1006305 changes for allowing seq. and conc. CHAs 2017-01-12 16:34:54 -05:00
Manu Sridharan 0eabfa2d05 Add slicer test
This test relates to a mailing list question from 
Gebrehiwet Biyane Welearegai:

https://groups.google.com/forum/#!topic/wala-sourceforge-net/lS7lyCHfAaw
2015-12-14 10:34:10 -08:00
Manu Sridharan 077cabc4eb Revert "update version to 1.3.8"
This reverts commit 4aac703ee5.
2015-10-09 11:03:46 -07:00
Manu Sridharan 4aac703ee5 update version to 1.3.8 2015-10-09 10:45:57 -07:00
Manu Sridharan 13a46d8ea3 Fixes #82
PrunedCFG had been changed to always include an entry and exit node.
The logic for detecting an "empty" ExceptionPrunedCFG inside the PDG
construction code had not been updated appropriately.
2015-08-06 11:08:27 -07:00
Julian Dolby 0ccaae3b2c pull exclusions file support into util project and then share it with
the shrike-based dynamic call graph builder so that static and dynamic
graphs can be built consistently more easily.
2013-11-14 13:02:56 -05:00
Manu Sridharan 878cfa615d changes to get tests passing on Java 7 2013-05-26 10:07:46 -07:00
Manu Sridharan d149ca2c73 Revert fix for tests; we need to figure out the right fix here.
This reverts commit cab3c6c0c4.
2013-05-02 10:55:45 -07:00
Cosmin Radoi edbdf989a9 right classloader for call graph tests 2013-04-29 13:13:23 +02:00
Manu Sridharan 256cd06460 Convert all Java source files to use Unix line endings; no semantic change 2012-09-04 15:56:05 -07:00
msridhar1 cbd8b63142 undo change to SlicerTest
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4291 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-12-28 17:03:42 +00:00
msridhar1 59e46916ce Generalize certain IR data structures to be less Java-specific. Generalize annotations code to allow for reading annotation parameters. Various other fixes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4290 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-12-28 17:03:27 +00:00
msridhar1 e9199401c9 change to remove time blowup in test on recent Java versions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4231 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-07-22 21:48:15 +00:00
msridhar1 857e456806 organize imports
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4081 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-03 04:08:05 +00:00
msridhar1 0ca5dc1c0e better fix for PDG bug reported by Ravi Chandran
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3967 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-10-06 17:03:35 +00:00
msridhar1 029b1fc1fd Fix for bug reported by Ravi Chandran on the mailing list (10/01/2010). Properly add edges from method entry in the PDG
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3965 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-10-05 18:45:43 +00:00
msridhar1 460477e074 fix bug in PDG contruction for a case involving infeasible bytecodes; add corresponding test
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3843 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-05-17 16:57:52 +00:00
dolby-oss b7a6299afb change a test to handle differing heap deps in different versions of the std lib
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3808 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-04-21 14:46:12 +00:00
msridhar1 19bcb326a4 slicer bug fix: properly include the actual call statement (along with various PARAM_CALLER statements) in the set of call statements
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3807 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-04-19 23:03:47 +00:00
msridhar1 24d28210e8 more caching of class hierarchies
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3750 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-07-28 02:26:03 +00:00
msridhar1 02e7bf2894 switch to jUnit 4
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3739 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-07-27 20:38:48 +00:00
sjfink a0efbee8ff Major refactoring to introduce com.ibm.wala.ide. Many related changes and patches from Marcelo Paternostro.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3693 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-06-22 15:06:12 +00:00
msridhar1 98c651fee4 rename a bunch of things from GV to PDF. Fix up example launchers to take input from workspace_loc instead of c:\temp.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3412 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-03 18:25:05 +00:00
dolby-oss 9d0131b0be add test for control dependence of phi nodes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2968 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-07-27 21:38:50 +00:00
sjfink 9f96656dc2 bug fixes for ExplodedCFG for some synthetic methods
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2924 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-06-27 18:43:01 +00:00
sjfink d6c5b3bb55 thread IProgressMonitor and CancelException through many APIs
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2578 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-02-13 22:34:50 +00:00
sjfink b5a21d45aa generalize support for partially balanced tabulation
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2538 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-02-05 15:56:20 +00:00
sjfink 4f0c72599f just refactoring ... introduce 2 new packages in wala.util.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2450 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-01-24 22:06:31 +00:00
sjfink d0394f3ef9 change criteria for test2
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2401 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-01-16 21:12:29 +00:00
sjfink 3f623ac0a7 bug fixes with InducedCFGs and context-sensitive slicing
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2306 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-01-07 20:31:17 +00:00
sjfink bfbe4fdd2f clean up and refactor some APIs surrounding file I/O and exclusions files. Needed in order to allow clients to use some APIs with application-specific exclusions.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2248 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-01-02 22:27:45 +00:00
sjfink 6fb624701f fix bug [ 1850456 ] error "I is null" when slicing
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2183 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-12-14 14:29:44 +00:00
sjfink 5c175e7898 more EMF obliteration
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2037 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-11-16 19:41:32 +00:00
sjfink 0e041c99f2 add CancelException to interact with Eclipse progress monitors and thread it through some APIs
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2004 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-11-13 16:19:01 +00:00
sjfink 7826d12a77 more aggressive exclusions in order to run quickly against Java 6.0 libraries
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1859 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-10-11 16:05:17 +00:00
dolby-oss f693ef03ed test to expose data dependence issue for GetCaughtException in slicer
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1772 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-09-19 18:01:59 +00:00
dolby-oss 1166ba459b slight extension to slicing test
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1748 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-09-13 15:12:17 +00:00
sjfink c0aab9e7ed decouple IR caching from AnalysisOptions with a new AnalysisCache object
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1516 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-07-20 15:19:57 +00:00
sjfink f499379791 change accept criterion due to presumed bug fix
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1500 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-07-17 13:47:00 +00:00