Commit Graph

5249 Commits

Author SHA1 Message Date
Ben Liblit 48be35ddc2 Set `javacProjectSettings` where appropriate
In particular, per the corresponding Eclipse warning, "The
`javacProjectSettings` build entry should be set when there are
project specific compiler settings".
2017-08-16 11:36:46 -07:00
Ben Liblit 291c01b960 Silently ignore unresolved bundles
In particular, be quiet about being unable to resolve
"org.eclipse.jdt.launching.macosx", which was already marked as
`optional` anyway.  I assume that I'm missing this because I'm not
developing on MacOS, and that it would be present if I were.  Can
someone using MacOS confirm this?
2017-08-16 11:36:46 -07:00
Ben Liblit d73b11fd8f Escalate switch-related diagnostics from warnings to errors
We have fixed all of these that Eclipse reports.  Treating them as
errors in the future should help us keep moving in the direction of
cleaner code.
2017-08-15 14:55:34 -07:00
Ben Liblit ea95940d0f Be explicit when case fall-through is intentional 2017-08-15 14:55:34 -07:00
Ben Liblit da5f925cab Be explicit when the proper default for a switch is to do nothing
Of course, doing nothing isn't always the right behavior.  Sometimes a
previously-unhandled value is truly unexpected and one should fail by
throwing an exception.  It may not always be clear whether an
exception or doing nothing is the right choice.  For some `switch`
statements affected by this commit, I initially guessed that throwing
an exception was the right default behavior, but was proven wrong when
doing so caused WALA regression test failures.  That's strong evidence
that the unmatched values were not really unexpected, but merely
should have been handled by doing nothing as before.
2017-08-15 14:55:34 -07:00
Ben Liblit ab791f8c41 Throw a loud exception if switch encounters unexpected enum value
Previously each of these `switch` statements would implicitly do
nothing if an unanticipated `enum` value came along.  My impression is
that each of these `switch` statements is supposed to be exhaustive,
such that an unexpected (unhandled) value should never appear.  If one
does, we should recognize it and complain loudly.

Of course, sometimes the right behavior for previously-unhandled
values is to do nothing.  It may not always be clear whether an
exception or doing nothing is the right choice.  For this commit,
WALA's regression tests still pass even with the possibility of
throwing an exception for unexpected values.  If we assume that the
test suite is thorough, that tells me that throwing an exception is
the right policy for each `switch` statement that I'm changing here.
2017-08-15 14:55:34 -07:00
Ben Liblit cbcfb40435 Don't be silent in case of weird enum value
This `switch` statement currently covers all possible values of the
`enum` it is testing.  However, if a new value were introduced in the
future, the `switch` would have been silent about it instead of
printing a debug message as is done in all of the other cases.  Better
to print *some* kind of debug in the default case too.
2017-08-15 14:55:34 -07:00
Ben Liblit ce335f495d Avoid unintended control fall-through in case of weird enum value
This `switch` statement currently covers all possible values of the
`enum` it is testing.  However, if a new value were introduced in the
future, the `switch` would have allowed control-flow to fall through
by default instead of throwing an exception as is done in all of the
other cases.  Better to throw *some* kind of exception in the default
case too.
2017-08-15 14:55:34 -07:00
Ben Liblit 7dc71151d1 Add missing `break`s to print just 1 debug message instead of 1-3 2017-08-15 14:55:34 -07:00
Ben Liblit 61e9641094 Semantics-preserving control-flow tweaks to fix switch warnings
Eclipse was warning that these `switch` statements had no `default`
cases.  Each did have some default behavior, but implemented outside
the `switch`.  By moving the default behavior into a `default` case
within the `switch`, we eliminate a static warning with no change
whatsoever to the run-time behavior.
2017-08-15 14:55:34 -07:00
Ben Liblit 30966195c8 Prefer dynamic dispatch over switch statements on enum values
Eclipse was warning about the lack of a `default` case in the `switch`
statement.  None of the current `enum` values was actually missing
from the `switch`, but if the enum values list were extended in the
future, that would be an easy mistake to make.

Replacing the `switch` with dynamic dispatch to a method lets us
statically enforce the requirement that every enum value must
implement the behavior in some way.
2017-08-15 14:55:34 -07:00
Ben Liblit 37fe595fbd Factor out common logic for Dot output format names/suffixes
Instead of having two `switch` statements on the Dot format
enumeration, give each Dot enumeration value a way to identify its own
preferred file suffix and command-line format name.  This removes some
warnings about `switch` statements without default cases.  It also
creates strong static enforcement that any new Dot format *must* also
provide this information.
2017-08-15 14:55:34 -07:00
Ben Liblit 11b636f764 Suppress some unchecked-cast warnings we cannot avoid
Type erasure makes me sad.
2017-08-15 09:16:59 -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
Ben Liblit 5bcc985069 Tidy up some code that performs unchecked casts to a generic type 2017-08-15 09:16:59 -07:00
Ben Liblit daea7095e2 Fix Eclipse warnings about unchecked casts to generics
This is the first time I can ever remember explicitly casting to
`Object`.  Such a cast might seem useless, and certainly it is
statically known to always succeed.  However, it is here for good
reason.  Without the cast, we end up making a `Pair<Object, ?>` but
what we really want is a `Pair<Object, Object>`.
2017-08-15 09:16:59 -07:00
Ben Liblit bb6be21e2d Fix remaining "unlikely argument type" warnings from Eclipse Oxygen
Each of these required careful consideration of what the original
developer *intended* as distinguished from what the developer's code
actually *does*.  I believe I got each one right, and WALA's
regression tests agree.  A second opinion by a core WALA developer
would be welcome, though.
2017-08-15 09:16:14 -07:00
Ben Liblit cb6d3b282a Fix Eclipse warnings about redundant null checks and assignments
Most of these are harmless, and are best fixed simply by removing the
redundant check or assignment.  The one in FlowType.compareBlocks,
however, revealed a real problem.  This code checks for nullness of
`a` *after* having called a method on `a`.  Assuming that `a` can
indeed be `null` here, the check must come first to avoid a
`NullPointerException`.

In several places, I saw code of this form:

   if (thing == null)
     assert thing != null : ... ;

I honestly don't understand the purpose of that `if` statement.  Why
not just have the `assert` statement there directly?  I removed the
seemingly irrelevant `if` statements in these cases, but if this is
some intentional pattern, please explain it to me.

In a few places where nullness is statically known but non-obvious,
add assert statements to point out what's going on to help future
developers.

Upgrade future such warnings to errors to keep us moving in a cleaner
direction.
2017-08-15 09:11:29 -07:00
Julian Dolby 8ebfd7615c add MemSAT 2017-08-12 20:02:18 -04:00
Julian Dolby 7e8e499f04 get actual art version 2017-08-09 17:33:41 -04:00
Julian Dolby ecdb599674 support for deodexing methods read from Dalvik, using support in dexlib2 2017-08-08 06:34:48 -04:00
Julian Dolby e7a152341c update dependencies 2017-08-06 20:03:37 -04:00
Julian Dolby 2fbe15fc91 fetch guava 22 2017-08-06 19:30:16 -04:00
Julian Dolby c5d5ce7fe2 missed files 2017-08-06 19:16:25 -04:00
Julian Dolby cc8831ebcf misc fixes, and optional new translation for for..in; ultimately, this new translation is better, but for now it breaks some correlation-tracking tests, so it is available only as an option. 2017-08-06 18:36:33 -04:00
Julian Dolby 15f54f0248 Merge branch 'master' of https://github.com/wala/WALA 2017-08-06 10:30:32 -04:00
Manu Sridharan e8bdf2f8f9 version 1.4.4-SNAPSHOT 2017-08-06 07:25:20 -07:00
Julian Dolby 69929b4985 Merge branch 'master' of https://github.com/wala/WALA 2017-08-06 08:06:02 -04:00
Julian Dolby 34dd8c1f04 merge 2017-08-06 08:05:59 -04:00
Manu Sridharan d901b13425 version 1.4.3 2017-08-05 20:52:32 -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
Manu Sridharan 73063628de cache call targets in CHACallGraph (#213)
This is a simple optimization that helps performance a lot.
2017-08-05 14:07:27 -07:00
Ben Liblit 13d807708f Suppress an Eclipse warning about lacking XML grammar info
The single "No grammar constraints (DTD or XML Schema) referenced in
the document" warning arises in a generated file.  I doubt that we can
change the generation process to include grammar information.  Even if
we could, I don't mind omitting validation here assuming that we can
trust the generator tool to be correct.  Validation is much more
important for human-authored XML; for tool-authored XML, we can live
without it.
2017-08-05 13:30:54 -07: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 f76b79b067 Don't complain about unqualified accesses to instance fields
I'm very picky about code style, but even I see no benefit in
requiring "this.field" instead of simply "field".
2017-08-05 13:30:04 -07:00
Ben Liblit 678e3e64a6 Fix all Eclipse warnings about unused local variables
Also report unused variables as errors in the future, not just
warnings.  We've fixed all of these as of right now, so let's keep it
clean in the future too.
2017-08-05 13:29:50 -07:00
Ben Liblit b1cd868e06 Remove an unused method relating to Android system entry points 2017-08-05 13:29:50 -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 ef94d85d2b quiet 2017-08-03 21:11:33 +00:00
Julian Dolby 202a53d090 reference javadoc 2017-08-03 20:43:22 +00:00
Julian Dolby 3db5ff4707 use e47 2017-08-02 22:20:09 +00:00
Julian Dolby 2ba40c99fa Eclipse Oxygen 2017-08-02 19:59:54 +00:00
Julian Dolby 98f770035d merge 2017-08-02 12:28:46 -04:00
Julian Dolby 5b6397297f merge 2017-08-02 12:28:25 -04:00
Julian Dolby 1d144db6d5 Merge branch 'master' of https://github.com/wala/WALA 2017-08-02 12:27:22 -04:00
Julian Dolby 8a76b132cd try new way to make javadoc 2017-08-02 14:56:04 +00:00
Julian Dolby 4629f8b9cd see if maven 3.5.0 builds javascript on travis as it does on my laptop 2017-08-02 02:53:01 +00:00
Julian Dolby 3d2cdf76b7 kill debug logging 2017-08-02 02:13:55 +00:00
Julian Dolby 1971b09b6a mirror 2017-08-02 01:03:56 +00:00