Commit Graph

67 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 5b6e6aefa0 Remove some unnecessary warning suppression annotations 2017-08-28 11:55:56 -07:00
Ben Liblit ba84b5a403 Fix warning about unchecked cast to generic by being less specific
Casting to `Foo<Bar>` results in an unchecked-cast warning due to Java
generics type erasure.  However, sometimes we don't really need a
`Foo<Bar>`, but could simply use any `Foo<?>`.  Casting to the latter
creates no warning.
2017-08-15 09:16:59 -07:00
Julian Dolby eaba8d59b7 Merge branch 'master' of https://github.com/wala/WALA 2017-08-05 21:09:34 -04:00
Julian Dolby 9dda017450 Merge branch 'master' of https://github.com/wala/WALA 2017-07-28 13:42:45 -04: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
Julian Dolby 163e10f5e4 Merge branch 'warning-fixes-plug-in-development-misc' of https://github.com/liblit/WALA 2017-06-22 09:27:47 +02:00
Ben Liblit 72c754e874 Declare private methods static wherever possible
If a method is private, there's no risk that a subclass elsewhere
might be overriding it and depending on dynamic dispatch to choose the
right implementation.  So all of these private methods can safely be
declared static without risk of regression in either WALA code or
unseen third-party code.
2017-06-07 08:29:23 -07:00
Julian Dolby 11585f3d34 Merge branch 'master' of https://github.com/wala/WALA 2017-03-30 21:58:56 -04:00
Ben Liblit aaf66705e1 Fix 65 Eclipse warnings about unused exception parameters
In the cases addressed here, the caught exception was being "handled"
by throwing some new exception.  Instead of discarding the old
exception, pass it to the new exception's constructor to indicate the
original cause of the newly-created exception.  This practice, called
"exception chaining", can often be useful in debugging.
2017-03-20 00:44:39 -05:00
Julian Dolby eca53cd0c2 Merge branch 'master' of https://github.com/wala/WALA 2017-03-19 08:18:25 -04:00
Ben Liblit 7cbbeb1d81 Fix 92 deprecation warnings
All of these fixes involve replacing junit.framework.Assert with
org.junit.Assert for JUnit 4.x and later.
2017-03-17 21:18:26 -05:00
Julian Dolby 6cdeedd5e9 changes for analysis cache view 2017-03-15 22:06:19 -04:00
Julian Dolby bb0f38338e Merge branch 'warning-fixes-resource-management' of https://github.com/liblit/WALA 2017-03-13 10:44:38 -04: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
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 db65c16863 Merge branch 'pull-request__typeannotations' of https://github.com/joana-team/WALA 2017-03-11 16:19:50 -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
Martin Hecker 5f617c19e3 Tests for the new JSR 308 type annotations implementation. 2016-12-05 18:52:38 +01:00
Julian Dolby 26b126203d fix imports; restructure annotations tests 2015-09-16 13:25:21 -04:00
Julian Dolby 63ec46f67d 1) changes for mobile
a) serializable added for use by Android services
  b) test classes refactored to allow Android variants to use JUnit 3
2) shrike instrumentation now uses java.lang.instrument
  a) refactoring
  b) online variants of call graph tracing
2015-05-25 19:00:51 -04:00
Julian Dolby 0975441a43 changes for hybrid analysis 2015-04-05 21:19:56 -04:00
Julian Dolby de26484098 java annotations support for dalvik 2015-03-04 13:49:58 -05:00
Cosmin Radoi a97df8ceec test revealing SSA cache problem 2014-11-10 11:59:06 -06:00
Manu Sridharan b984760100 support for reading method parameter annotations from Java bytecodes 2013-06-28 11:44:47 -04:00
Manu Sridharan 3b1889121b add missing copyright headers 2013-05-22 15:39:19 -07:00
Manu Sridharan 9549da9954 read runtime-visible annotations for fields 2013-04-08 13:50:26 -07: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
Manu Sridharan 2edb070437 changed FileProvider to have instance methods 2012-04-16 14:57:14 -04:00
msridhar1 7630cd79c9 Revamped support for reading Java annotation information from .class files.
The code should handle all cases now, and the APIs are improved.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4422 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-11 17:11:59 +00:00
dolby-oss 7a6af352b9 moved IR-independent visualization of graphs to util project
added DFS path find that finds all paths in sequence rather than just one
moved the WalaException out of warnings subpackage

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4257 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-08-16 16:51:11 +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
msridhar1 9aa9187edc fix for CFG bug reported by Benedikt N on mailing list, plus test case
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4077 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-03-24 19:41:46 +00:00
msridhar1 c0b30598f4 added another test
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4060 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-02-10 00:01:32 +00:00
msridhar1 06b652d1fb fix bug reported by Benedikt Nordhoff on mailing list: for cases where an enclosing exception handler catches all exception types, don't add an exceptional edge from a throw instruction to method exit.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4057 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-02-08 23:41:03 +00:00
msridhar1 7a5d3baacd bug fix for CFGSanitizer
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3984 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-10-20 20:38:44 +00:00
msridhar1 ab47cddadf more speedups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3749 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-07-28 01:47:06 +00:00
msridhar1 93a4571961 undo WalaTestCase extending TestCase; dependent projects will have to be switched to JUnit 4. Also, more optimizations.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3742 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-07-27 22:43:06 +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 31a8bf2575 add a test for TryFinally IR construction
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3458 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-14 20:05:23 +00:00
dolby-oss e80dc6ef8c refactor handling of constants in Shrike to abstract away from Java bytecode
introduce factories to create SSAInstruction objects


git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3433 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-10 18:33:07 +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
yinnon_haviv ddbbcac07b Added support for reading runtime visible annotations
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3360 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-22 07:51:11 +00:00
dolby-oss 7118bd6573 adapt to core changes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3232 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-02-19 16:01:24 +00:00
sjfink 48170df6c4 tweak semantics of multinewarry length parameters ... don't use 0 to indicate missing dimensions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2978 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-07-28 21:02:23 +00:00
sjfink c74560050e fix multinewarray bug
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2975 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-07-28 18:43:02 +00:00
msridhar1 f660841a6e new test case for multinewarray. commented out, since it currently fails
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2973 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-07-28 18:02:30 +00:00
sjfink 444d3a92b0 more cleanup of util packages
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2463 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-01-24 22:54:05 +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