Commit Graph

513 Commits

Author SHA1 Message Date
Julian Dolby 2d2d6070ff more talking 2018-10-20 12:16:43 -04:00
Julian Dolby 8381141e54 try out instead of err output 2018-10-19 22:31:10 -04:00
Julian Dolby a1649be85b talk to Travis 2018-10-18 23:23:24 -04:00
Julian Dolby 38c5de6160 fix for forName selector: use the CHA in getRelevantParameters to resolve
the declared target of the call site.  This is needed to make sure
forName targets loaded with the Application loader get resolved to point
to the real metod reference for forName.

this issue actually manifested itself in the Kawa Chess program, and so
I have added an assertion to make sure this resolution is done properly.
2018-10-18 22:25:21 -04:00
Julian Dolby bf3c419e1c test for presence of nodes in Kawa chess test that need method handles
and string constants to play nicely together.
2018-10-15 02:12:42 -04:00
Julian Dolby b2503628a4 1) a bit more source mappimg information
2) fixes to how Contexts are combined
2018-10-13 08:42:08 -04:00
Julian Dolby 1867b57425 move utility so other tests can use it 2018-09-20 14:48:06 -04:00
Julian Dolby c5cdb9e32a clean up MethodHandle support 2018-08-03 15:52:24 -04:00
Julian Dolby 7e6cfe84f6 more support for method handles, particularly for ones created with
reflection.
2018-08-02 19:35:32 -04:00
Julian Dolby 0ad11fefc3 work on Wala with Yannis' group 2018-07-22 16:19:32 -04:00
Manu Sridharan 2b1d82d1bb Expand missing super test 2018-07-19 18:17:59 +02:00
Manu Sridharan a78af3f67e
Add API to add an InputStream for a jar to an AnalysisScope (#330)
This is useful, e.g., if you have the bytes of a jar file in memory and want to load it into an `AnalysisScope`.
2018-07-19 17:01:51 +02:00
Manu Sridharan aeb17dfca4
Allow for classes with missing superclasses in class hierarchy (#329)
Fixes #322 

We add an option `createPhantomSuperclasses` to `ClassHierarchy`.  When set, if a superclass is missing, we create a new `PhantomClass` in its place and allow the subclass to be added.

To use, you can create the `ClassHierarchy` with the new `ClassHierarchyFactory.makeWithPhantom` methods.
2018-07-19 16:10:35 +02:00
Ben Liblit 5336a08af2 Avoid using deprecated boxing constructors
Boxing a primitive using the constructor ("new Integer(4)") always
creates a distinct new boxed instance.  That's rarely what you need,
and in fact all of those constructors have been deprecated in Java 9.
Using the static "valueOf" method instead ("Integer.valueOf(4)") can
give better performance by reusing existing instances.  You no longer
get a unique boxed object, but generally that's OK.
2018-06-05 14:44:59 -05:00
Ben Liblit 989ef3ec43 Help Java 9 with some tricky generics type inference
The existing code worked fine under Java 8, but Java 9 fails to
resolve type constraints unless it has more explicit information about
at least one of the arguments to anyOf.  Weird.
2018-06-04 12:28:42 -05:00
Ben Liblit b14804bfdc Don't put fixed-name, writable files into "java.io.tmpdir"
If multiple tests both write to "/tmp/cg.txt" (for example), then
these tests cannot safely run concurrently.  That never used to be a
problem with Maven, since our Maven tests were all strictly sequential
anyway.  But parallelized testing using Gradle requires that we do
better.  Fortunately, Java has perfectly reasonable APIs for
generating uniquely-named temporary files and directories.
2018-04-18 11:29:29 -05:00
Ben Liblit 99c2493e37 Revert "Build WALA using Gradle instead of Maven" (#298) 2018-04-18 12:15:56 -04:00
Ben Liblit 7886fa13dc Don't put fixed-name, writable files into "java.io.tmpdir"
If multiple tests both write to "/tmp/cg.txt" (for example), then
these tests cannot safely run concurrently.  That never used to be a
problem with Maven, since our Maven tests were all strictly sequential
anyway.  But parallelized testing using Gradle requires that we do
better.  Fortunately, Java has perfectly reasonable APIs for
generating uniquely-named temporary files and directories.
2018-04-17 15:02:36 -05:00
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
Julian Dolby 6c1d0d9cb6 more work for reuse
make synthetic code better support non-Java languages
2018-02-14 09:00:07 -05:00
Julian Dolby c8cdaf8616 further refactoring to enable more reuse
eliminate all non-jva 8 compilation
2018-02-05 15:18:37 -08:00
Manu Sridharan 76faa4df2d
Fix bug with method lookup (#276)
The previous lookup logic would erroneously look in superclasses for a constructor with parameters.

Bug reported on [the mailing list](https://groups.google.com/forum/#!msg/wala-sourceforge-net/6m_VmDF-lZ0/erZIYQ68BwAJ;context-place=topic/wala-sourceforge-net/TjRzdDyljjY)
2017-12-23 16:38:26 -08:00
Ben Liblit 0d6d9f2b2e Remove useless "@return" tags with no descriptive text 2017-12-19 16:53:56 -06:00
Ben Liblit f60c164ec1 Escape "<" and ">" in Javadoc when not used as HTML tag syntax 2017-12-19 16:53:52 -06:00
Julian Dolby d29e278291 more instrumentation fixes
remove junk from dominators
2017-12-08 11:19:41 +08:00
Ben Liblit 0286c2b048 Use Iterator2Iterable helper to convert more loops to for-each 2017-12-04 14:04:39 -08:00
Julian Dolby b68ff20c82
Merge pull request #269 from liblit/modernization-java-8-lambdas-and-method-references
Use Java 8 lambdas and method references wherever possible
2017-12-03 09:54:09 +08:00
Julian Dolby 803243ea53 Merge branch 'master' of https://github.com/wala/WALA 2017-12-01 20:02:00 +08:00
Julian Dolby 7cd2a2acf8 Fixes for instrumentation of invoke dynamic 2017-12-01 20:01:16 +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 74e0640771 Replace simple lambdas with method references wherever possible 2017-11-27 11:31:15 -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
Manu Sridharan 808688b793 use lambda shorthand 2017-11-12 10:08:57 -08:00
Julian Dolby 8d65788aef convert to Java 8 Function and Predicate 2017-11-11 20:29:04 -05:00
Ben Liblit 5b6e6aefa0 Remove some unnecessary warning suppression annotations 2017-08-28 11:55:56 -07:00
Julian Dolby b6af5267f1 java 8 changes
minor fixes, such as making CheckForFrontEndErrors more accessible
minor hacks to make stuff compile with TeaVM
2017-08-25 10:58:00 -04:00
Raffi Khatchadourian 72053efd26 Return Java 8 default methods from getAllMethods()
Fixes #219 
Fixes #220
2017-08-17 14:45:49 -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 b9b498bd17 Merge branch 'master' of https://github.com/wala/WALA 2017-08-05 21:10:28 -04:00
Julian Dolby eaba8d59b7 Merge branch 'master' of https://github.com/wala/WALA 2017-08-05 21:09:34 -04:00
Ben Liblit d6ce679a72 Add static private serialVersionUID fields to Serializable classes
We already have plenty of examples of Serializable classes with this
field, and the vast majority of those fields have generated IDs rather
than "1L".  From this I infer that using proper serialVersionUID
fields is considered appropriate WALA coding style.
2017-08-05 13:30:35 -07:00
Ben Liblit 321b28f149 Remove some unnecessary warning suppressions
One such annotation was unnecessary because the thing it was
suppressing no longer happens.  Any future unnecessary warning
suppressions of this kind will now be treated as errors.

The other annotations were unnecessary because the corresponding
warnings have been disabled entirely in the Eclipse projects'
configurations.  There seems to be no way to tell Eclipse to treat
these as anything other than "info" diagnostics in the future, so
that's how they will remain.
2017-08-05 13:29:50 -07:00
Julian Dolby 1d144db6d5 Merge branch 'master' of https://github.com/wala/WALA 2017-08-02 12:27:22 -04: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
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 12e736b36f Merge branch 'master' of https://github.com/wala/WALA 2017-07-15 14:01:51 -04:00
Ben Liblit 594525a83f Fix Eclipse warnings about methods that can be declared static
The fix is to add "static" where appropriate, of course.  I've also
simplified calls to such methods to reflect the fact that they no
longer need a specific object to call the method on.

In projects that contain test inputs, I've left the non-static
declarations unchanged, and instead downgraded the warning to be
ignored.  In all other projects, this warning has been upgraded to an
error.
2017-07-14 22:38:38 -07:00