Commit Graph

105 Commits

Author SHA1 Message Date
Ben Liblit 6546d5d6a4 Resolve the last two Eclipse warnings about using raw types
Fixes bug #244.
2018-04-13 12:53:33 -05:00
Julian Dolby 41d254d547 more type parameters for analysis engine 2018-04-10 16:00:44 -04:00
Ben Liblit 0286c2b048 Use Iterator2Iterable helper to convert more loops to for-each 2017-12-04 14:04:39 -08:00
Ben Liblit 456b0e45c3 Remove additional unnecessary casts of lambda expressions 2017-11-27 15:00:13 -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
Julian Dolby 3083e6c06d new test 2017-09-12 07:13:35 +09: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 c1572ec3a5 Remove unnecessary warning-suppression annotations
These annotations used to suppress real Eclipse warnings.  However,
we've now turned those warnings off for the entire project.
2017-07-26 20:08:34 -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 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
Caius Brindescu 404a17c9cc When converting JDT AST to IR, a do-while loop in a case statement will throw NPE (#186)
* Fixed bug for source analysis

Do while in case statement would throw an NPE. Now it doesn't

* Added test case

The test will fail with an NPE if the fix is not applied.
2017-06-07 08:27:23 -07:00
Ben Liblit 24fb1f6d10 Suppress unused-local-variable warnings in test inputs
Test code can do many things we'd consider bad style in real
application code, including defining local variables that are never
subsequently used.
2017-05-26 14:25:03 -07:00
Ben Liblit fde65340d2 Fix 132 Eclipse warnings about using raw generic types 2017-03-15 11:08:20 -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 0f0c3d6bd9 add more functionality to analysis engine: create SDGs and
parameterize to do both regular and field-based analysis in JavaScript
2016-08-18 22:43:12 -04:00
Julian Dolby 73747cbb86 fixes for work with ECJ 2016-07-05 19:37:36 -04:00
Andreas Sewe e2e5bcf435 SecurityExceptions when analyzing JARs with broken/expired signatures
See <https://github.com/wala/WALA/issues/100>
2016-06-08 11:08:10 +02:00
Julian Dolby 0265a1c2dc Eclipse Java Compiler as a standalone source code front end 2015-10-14 13:32:34 -04:00
Julian Dolby 5cc870dd77 fixes to Dalvik support, and work on running Dalvik tests on Travis 2015-02-26 09:34:03 -05: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
Juergen Graf ef4513d377 revert PointerAnalysis hack that makes containsAny() and contains() methods in OrdinalSet unusable 2014-05-20 19:52:01 +02:00
Julian Dolby ba9aa51429 print less 2013-12-03 18:07:36 -05:00
Julian Dolby 62729613d7 less printing 2013-12-03 15:20:53 -05:00
Julian Dolby 1cc58c6e2f less printing 2013-12-03 13:09:35 -05:00
Julian Dolby 080325b5f6 merge 2013-06-25 11:57:37 -04:00
Julian Dolby 3015d1c5f9 added container access to ModuleEntry 2013-06-25 11:53:58 -04:00
Manu Sridharan dee324b609 add comment 2013-05-28 15:32:24 -07:00
Manu Sridharan 89803bc90c use updated API for getting library jars 2013-05-28 15:31:30 -07:00
Manu Sridharan 5f18830c3f changes to adjust for lack of null instruction at index 0 2013-04-29 20:34:08 -07:00
Julian Dolby 87b856928c fixes for handling parse errors in JS and HTML 2013-03-01 10:07:20 -05:00
Julian Dolby afccdd2189 Annotation support 2013-02-02 21:27:45 -05: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 319eacc529 merge changes and changes for atomic sets work 2012-08-29 16:35:34 -04:00
Manu Sridharan 9a0e105e51 fix so that new lexical scheme can be enabled with Java frontends 2012-07-12 10:27:24 -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
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 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
dolby-oss 5d1673011a killed obsolete class
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3798 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-01-25 15:01:33 +00:00
dolby-oss 8069fe81d8 fix issues with junit 3 vs. 4 by adding hacking method to get a name like the one junit 3 gives
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3790 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-01-06 13:57:06 +00:00
msridhar1 8025302fd0 update to JUnit 4
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3743 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-07-27 22:48:04 +00:00
dolby-oss cab3c60f7e fixes for JDT-based tests
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3730 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-07-16 18:08:29 +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
sjfink 6f96d41dc2 remove unnecessary InvalidClassFileException declarations
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3618 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-05-29 14:23:29 +00:00
sjfink 9939142eae switch from Assertions._assert to Java assertions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3555 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-30 13:16:52 +00:00
egeay 193fc85cdd - Updated test cases to 1.7 syntax
- Added one-level directory structure to separate the constructs tested.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3545 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-29 18:17:20 +00:00
egeay f5613864de git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3544 f5eafffb-2e1d-0410-98e4-8ec43c5233c4 2009-04-29 18:13:14 +00:00
dolby-oss e66d5ed88a approximate support for multithreaded code
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3532 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-23 18:00:20 +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
dolby-oss b2bae33bab generalize parsing of Descriptors to also handle languages other than Java
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3366 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-26 15:11:45 +00:00
sjfink b1cdc4fecf call new factories
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3305 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-13 17:06:09 +00:00