Commit Graph

27 Commits

Author SHA1 Message Date
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 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
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 9267003c5b changes for language and solver work 2015-12-09 17:28:45 -05:00
Julian Dolby ab22d9abb0 enable specialization of source extractor for Web pages 2015-11-30 21:28:40 -05:00
Julian Dolby 50373e122d 1) handle files with byte order marks
2) ignore code in comment blocks
2014-05-28 13:33:49 -04:00
Julian Dolby 92bec0cc0b move to Reader API to help with annoying /r/n issues is source mapping 2014-04-29 11:21:01 -04:00
Julian Dolby 99512c5cd0 uuse PrinterWriter; make DOM model optional 2014-04-11 10:00:05 -04:00
Julian Dolby 0964104dde use java functionality to handle urls 2014-02-08 22:50:59 -05:00
Julian Dolby dd4d794517 merge 2013-09-18 14:00:04 -04:00
Julian Dolby 42714d9bf3 fixes for getting original source code for included locations 2013-09-18 13:55:17 -04:00
Manu Sridharan 898e1c3810 add modeling of window.onload invocation 2013-09-16 09:37:18 -07:00
Julian Dolby 080325b5f6 merge 2013-06-25 11:57:37 -04:00
Manu Sridharan 4f7ec12edd Expose temporary file created by source extractor. Fixes #19 2013-04-10 12:22:57 -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
Manu Sridharan 256cd06460 Convert all Java source files to use Unix line endings; no semantic change 2012-09-04 15:56:05 -07:00
dolby f7eb9bd174 apply changes for WALA git issue 3 2012-07-03 19:22:08 -04:00
dolby dfe06b8ff3 changes to Web source mapping to exploit rhino 1.7R3 source offsets 2012-05-08 13:17:01 -04:00
dolby-oss ab0bf42f4a fixes to make forms work better for analysis, and to deal with better handling of function scoping in JS
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4119 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-13 16:19:55 +00:00
dolby-oss c82117149d new names for handler functions that include tag name and attribute name
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4112 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-08 19:23:10 +00:00
dolby-oss 565f9ca663 hack for CDATA
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4111 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-07 16:58:58 +00:00
dolby-oss 032f82f713 typing cleanups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4105 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-05 16:41:43 +00:00
dolby-oss b7f3f8b7a8 make getStream accessible
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4104 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-05 10:46:53 +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
yinnon_haviv fb6f25ce37 Put entrypoint code also under main method - required for having correct "this" pointer (window).
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3963 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-10-03 11:52:22 +00:00
yinnon_haviv 02842ff765 Adding Generators (Extracting js source from html) that support line numbering. Currently used only from within the JsViewerDriver.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3957 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-09-29 15:29:55 +00:00