Commit Graph

4975 Commits

Author SHA1 Message Date
Martin Mohr a1fa8a2057 update intent information instead of crashing 2016-12-07 16:11:18 +01:00
Julian Dolby 891bf3f585 Merge branch 'master' of https://github.com/wala/WALA 2016-12-06 12:50:09 -05:00
Julian Dolby 8fd17b3463 merge 2016-12-06 12:50:04 -05:00
Martin Hecker 867a8ecf2b When creating TypeAnnotations with LocalVarTarget, somewhat deal with class files that lack a LocalVariableTable 2016-12-05 18:52:38 +01:00
Martin Hecker 5f617c19e3 Tests for the new JSR 308 type annotations implementation. 2016-12-05 18:52:38 +01:00
Martin Hecker de0f9c2a1f WALA: Provide acces to JSR 308 Annotations via new Class TypeAnnotation.
Access is provided via corresponding methods in FieldImpl, ShrikeCTMethod and ShrikeClass.
Since we do not currently have implementation of these methods for front-ends other than Shrike, these new methods are not yet made available in the corresponding interfaces.
2016-12-05 18:52:38 +01:00
Martin Hecker 92dc2929f2 Shrike: low level reading of JSR 308 Type Annotations from Java bytecode 2016-12-05 18:52:38 +01:00
Martin Hecker 8e773fcf88 in order to look up instruction-indices from a bytecode-indices, do a binary search on the existing pcMap array (as suggested by Julian Dolby).
also see https://sourceforge.net/p/wala/mailman/message/35518796/ and answers.
2016-12-05 18:52:37 +01:00
Martin Mohr dff20ac49c make JarStreamModule inherit the assumptions of JarInputStream's constructor 2016-12-05 18:50:21 +01:00
Martin Hecker 1b74b906fc Add some tests that are meant to check both for precision and soundness of the intraprocedural NullPointer analyses. 2016-12-05 18:24:39 +01:00
Martin Mohr c00d9ec7af avoid NPE while constructing debug message 2016-12-05 18:23:55 +01:00
Martin Mohr 3283de6c44 promote visibility of some handy but harmless methods 2016-12-05 18:23:55 +01:00
Martin Mohr d830780242 slight fix of type parameter handling in PDG 2016-12-05 18:22:38 +01:00
Martin Mohr c530fc3ae6 once again fix location of apache commons io lib 2016-12-05 18:21:17 +01:00
Juergen Graf 22b7db62f7 make output of dot util compatible with dot viewer eclipse plugin. prevent parser error. 2016-12-05 18:21:17 +01:00
Martin Mohr 4a7efc8c78 array creation is also safe if length comes from another array's length 2016-12-05 18:21:05 +01:00
Martin Mohr 13a7b5459e prune exceptions for array creations of constant, non-negative size 2016-12-05 18:21:05 +01:00
Martin Mohr f989290ca6 provide list of exceptions for array creation sites with non-negative size 2016-12-05 18:21:05 +01:00
Manu Sridharan 9ca450de48 Merge pull request #114 from liblit/error-fix-hamcrest-dependency
Add Hamcrest dependency
2016-12-01 08:56:15 -08:00
Ben Liblit 522c382a19 Use consistent Java versions, usually 1.7
Previously, the various Eclipse projects' Java configurations used
mixtures of 1.6, 1.7, and 1.8.  Many were internally inconsistent,
such as requiring 1.7 in "MANIFEST.MF" but 1.6 in the Eclipse JDT
build preferences.  The Travis-CI configuration tests against both 1.7
and 1.8, but does not test against 1.6.

Across all projects, the most common version was 1.7.  So I'm going to
assume that 1.7 is the intended build target.  This commit makes 1.7
the selected version nearly everywhere.

"com.ibm.wala.core.testdata" is the one exception.  This specific
project uses a few features only found in 1.8, such as lambda
expressions.  Previously, "com.ibm.wala.core.testdata" used 1.7 in
some aspects of its configuration but 1.8 in others.  Now it
consistently targets 1.8.  I wish this one project didn't need to be
inconsistent with the rest of WALA, but at least now it's consistent
with itself.

(Personally, I'd be happy to target 1.8 only.  But my impression
across all of these configuration files is that the WALA developers
still want to be compatible with 1.7.  If that is no longer a
requirement, let me know and I will adjust these changes accordingly
to target 1.8 only.)

This change eliminates 11 "There is no 'jre.compilation.profile' build
entry and the project has Java compliance preferences set" warnings
and 13 "The JRE container on the classpath is not a perfect match to
the 'JavaSE-1.7' execution environment" warnings.  However, it also
adds 450 "Redundant specification of type arguments <...>" warnings
and 17 "Resource '...' should be managed by try-with-resource"
warnings.  So this seems like a net step backward in my wish to reduce
WALA warnings.  However, those new warnings concern Java 1.7 language
features that we were not previously using to good effect in projects
that targeted 1.6.  If we all agree that we can now target 1.7
instead, then we can use these helpful features as the newly-added
warnings suggest.  So I call that a step in the right direction.
2016-11-29 21:29:30 -06:00
Manu Sridharan fc37430c13 Merge pull request #113 from liblit/warning-fixes-xml-validation
Eliminate all Eclipse XML validation warnings
2016-11-29 18:05:09 -08:00
Ben Liblit cc2dcb91a6 Add Hamcrest dependency
Some source files here definitely use Hamcrest, so listing it as a
dependency seems reasonable.  What I find confusing is the inconsistency
among my Eclipse installations.  On some of my various machines, Eclipse
reports an error if this dependency is not listed.  On others, Eclipse
finds the required jar and reports no error, even if this dependency is
not listed.  I don't know why the latter works, or why the inconsistency
exists at all.  Eclipse is a complex, subtle beast.  What I can say is
that this change fixes the error for my Eclipses that were reporting an
error, and does not introduce any new errors for my Eclipses that were
already happy before this change.
2016-11-29 15:12:54 -06:00
Ben Liblit 18b79bf0f9 Merge branch 'master' into warning-fixes-xml-validation 2016-11-29 10:08:00 -06:00
Manu Sridharan 1e5dcf46f7 Merge pull request #112 from liblit/warning-fixes-html-validation
Eliminate all Eclipse HTML validation warnings
2016-11-28 21:37:46 -08:00
Ben Liblit 391210bf2d Exclude Maven-generated Ant build scripts from XML validation
When Maven generates these "*/target/antrun/build-main.xml" Any build
scripts, it does not include any DTD or XML Schema declarations.
Eclipse's XML validator warns about the lack of grammar constraints.
The warning is sensible, but we are not in a position to do anything
about it.  Better, therefore, to suppress these warnings so that we
can more-clearly see warnings we *can* address.
2016-11-28 14:57:26 -06:00
Ben Liblit d83a05affc Add stub DOCTYPE declarations for Eclipse plug-in manifest files
We actually know the full grammar for these files: it is documented at
<http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fplugin_manifest.html>.
We ought to be able to extract that DTD into a file and give each
"plugin.xml" a "<!DOCTYPE plugin SYSTEM ...>" declaration referencing
it.  Unfortunately, that leads to a new warning: "External entity
resolution is not supported by PDE."  So a stub declaration is the
best we can do.  Fortunately, Eclipse's structured editor seems to
preserve these once we add them by hand.
2016-11-28 14:55:34 -06:00
Ben Liblit 48e158f87e Add stub DOCTYPE declarations for various hand-authored XML files
Some of these might have proper DTDs or XML Schema definitions
floating around somewhere that we could use.  Presumably many do not.
Rather than hand-craft such definitions myself, I'm just giving each a
minimal stub DOCTYPE declaration.  That's enough to satisfy Eclipse's
XML validator, which otherwise complains that these files lack grammar
constraints.
2016-11-28 14:55:34 -06:00
Ben Liblit 3b1547f0a7 Exclude Maven-generated (?) files from XML validation
I think the "target/p2artifacts.xml" and "target/p2content.xml" files
are generated by Maven.  They are well-formed XML but Eclipse's XML
validator legitimately warns that they lack grammar constraints.
Since we're not maintaining the tool that creates these files, we are
not in a position to do anything about that.  Therefore, we may as
well exclude these from validation entirely.  That way we can
more-clearly recognize warnings that we *can* do something about.
2016-11-28 14:55:25 -06:00
Ben Liblit c2d47ae99d Exclude Eclipse feature manifest files from XML validation
In theory, these files could be checked against the DTD given at
<http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Ffeature_manifest.html>.
In practice, Eclipse's structured editor for this file type discards
any "<!DOCTYPE ...>" declarations one might manually add.  So there's
no convenient way to tell Eclipse' XML validator what grammar to use.
Fortunately, that same structured editor makes it unlikely that anyone
will introduce invalid content.  So I don't mind excluding these files
from XML validation entirely.
2016-11-28 14:03:03 -06:00
Ben Liblit 18b02e2880 Exclude third-party XML files from validation
Eclipse's XML validator warns about missing grammar constraints in
several XML files that come from non-WALA projects.  We are not in a
position to do anything about these problems.
2016-11-28 13:33:07 -06:00
Ben Liblit 80e8ea3c4e Add stub DOCTYPE declarations for Ant build scripts
Ant "build.xml" files don't have a standard DTD or XML Schema; the
contents are simply too flexible for that.  But we can at least
give each a stub DOCTYPE declaration.  That's enough to satisfy
Eclipse's XML validator, which otherwise complains that these files
lack grammar constraints.
2016-11-28 12:50:56 -06:00
Ben Liblit 94f6933ff1 Exclude JUnit test result files from XML validation
As created by Tycho Surefire, these files are XML documents without
DTD or XML Schema declarations.  The XML validator warns about this
omission.  However, Surefire is not a WALA component.  We are not in a
suitable position to change it to include XML schema or DTD
declarations in the XML files it generates.  Better, then, to ignore
this benign problem so we can focus on warnings that we can act on
directly.
2016-11-28 12:42:30 -06:00
Ben Liblit ed0ddd780f Correct HTML embedded in Javadoc comments
Most of the invalid HTML arose from bare "<" and ">" characters.
These should be escaped as "&lt;" and "&gt;" when not intended to
introduce HTML tags.  When you have many such characters close
together, "{@literal ...}" is a nice, readable alternative that
automatically escapes its contents.  If the text in question is
intended to be a code fragment, then "{@code ...}"  is appropriate:
this is essentially equivalent to "<code>{@literal ...}</code>".

There were a few other HTML violations too, but none common enough to
be worth detailing here.
2016-11-28 11:14:41 -06:00
Ben Liblit e35b205bc2 Fix numerous unescaped "<" and ">" in Javadoc @author tags
The contents of @author go straight into HTML, just like most other
Javadoc material.  So if you want to have a "<foo@bar.com>" e-mail
address as part of the author information, the angle brackets must be
escaped.  Here I've opted to do that using "{@code <foo@bar.com>}",
which has some additional styling effects that seem appropriate for
e-mail addresses.  We could also have used "&lt;foo@bar.com&gt;" for
escaping without code styling.
2016-11-27 21:24:03 -06:00
Ben Liblit f33efbf991 Exclude some hand-written HTML test pages from validation
It's unclear whether the original authors of these pages intended them
to be valid or invalid.  Certainly there is merit in testing against
invalid HTML, since the vast majority of real-world HTML is indeed
invalid.  I'm going to assume that any errors in this collection of
test inputs are intentional, and therefore not worth reporting when
running Eclipse HTML validation.
2016-11-27 21:24:03 -06:00
Ben Liblit e5e51110c3 Exclude plugin-provided HTML pages from validation
Plugin documentation includes plenty of invalid HTML.  However, we
don't maintain these files, so we are not in a position to fix them.
Better, therefore, to suppress these warnings so that we can notice
and fix other problems over which we do have control.
2016-11-27 21:24:03 -06:00
Ben Liblit 5962e1c9ee Exclude some hand-written HTML test pages from validation
It's unclear whether the original authors of these pages intended them
to be valid or invalid.  Certainly there is merit in testing against
invalid HTML, since the vast majority of real-world HTML is indeed
invalid.  I'm going to assume that any errors in this collection of
test inputs are intentional, and therefore not worth reporting when
running Eclipse HTML validation.
2016-11-27 21:24:03 -06:00
Ben Liblit 2a5503b9aa Exclude Maven-generated HTML pages from validation
Eclipse validation warns about invalid HTML content in all
Maven-generated "target/site/dependency-convergence.html" files.  The
warnings are legitimate: these HTML files are indeed invalid.
However, we don't maintain the tool that generates these files, so we
are not in a position to fix them.  Better, therefore, to suppress
these warnings so that we can notice and fix other problems over which
we do have control.
2016-11-27 21:24:03 -06:00
Ben Liblit 7d7a9c7e85 Exclude intentionally-malformed HTML pages from validation
Some test files are intentionally invalid HTML.  There's no point in
having Eclipse remind us of this fact.
2016-11-27 17:59:24 -06:00
Ben Liblit 5381bd1735 Exclude third-party HTML pages from validation
The WALA team does not maintain these pages, and therefore is not in a
good position to address HTML validation warnings arising within them.
2016-11-27 16:48:15 -06:00
Manu Sridharan 13bdb905c9 Merge pull request #110 from liblit/warning-fixes-packaging
Fix various Eclipse warnings about packaging
2016-11-26 21:24:05 -08:00
Ben Liblit b3293ecc3e Enforce restrictions on the model behavior class statically
If a client violates these restrictions, I prefer that their code fail
at compile time instead of run time.  Changing a few key types from
`Class` to `Class<? extends AbstractAndroidModel>` gives us precisely
the static enforcement we need and lets us remove an
`AbstractAndroidModel.class.isAssignableFrom` run-time check.

However, this does change the public API of `AndroidEntryPointManager`
in two ways.  The `getModelBehavior` and `setModelBehavior` methods now
respectively accept and return `Class<?  extends AbstractAndroidModel>`
instead of `Class`.  Is tightening up a public API in this manner
considered OK?
2016-11-26 22:39:37 -06:00
Ben Liblit 20014e2cb2 "plugin" does not exist here, and therefore needs no localization
This fixes one Eclipse "no valid properties files exist in the
localization directory specified" warning.

Ordinarily I would also change this project's configuration to treat
this warning as an error in the future.  That's a good way to
discourage regressions.  Unfortunately in this particular case I
cannot find a setting that has the desired effect, even after hunting
around in Eclipse PDE sources.  It seemed that setting
"compilers.p.unknown-resource=0" in
"com.ibm.wala.util/.settings/org.eclipse.pde.prefs" should do the
trick, but it does not.  I don't know why.
2016-11-26 21:01:53 -06:00
Ben Liblit d4a0a5ddd4 Delist a JAR that is not actually present
This resolves one Eclipse "'...' build entry is missing" warning.

Also update the project configuration to treat this warning as an
error.  This should discourage commits that create new instances of
this sort of problem in the future.
2016-11-26 20:39:26 -06:00
Ben Liblit 8b7a163110 The "lib" subdirectory contains no Java sources
This resolves one "'...' is not a source folder" Eclipse warning.

Also update the project configuration to treat this warning as an
error.  This should discourage commits that create new instances of
this sort of problem in the future.
2016-11-26 20:39:26 -06:00
Ben Liblit 173209a7bb Eclipse wants "META-INF/" to be included in "bin.includes"
Other subdirectories' "build.properties" generally seem to include this
already, so who am I to argue?

This resolves one "An entry for META-INF/ is required in bin.includes"
Eclipse warning.

Also update the project configuration to treat this warning as an
error.  This should discourage commits that create new instances of
this sort of problem in the future.
2016-11-26 20:39:12 -06:00
Manu Sridharan 4080e49a5a Merge pull request #109 from liblit/warning-fixes-missing-non-null-by-default
Ignore missing non-null-by-default annotations in Eclipse
2016-11-26 17:56:10 -08:00
Ben Liblit dace7b709f Ignore missing non-null-by-default annotations in Eclipse
In general, the WALA code base is not really ready for nullness
checking.  It would be nice if we got there some day, but I'm not
planning to take that on now or any time soon.  Until then, it's not
useful to warn about missing @NonNullByDefault declarations on WALA
packages.

See also older commit 7b6811b.
2016-11-26 18:47:35 -06:00
Ben Liblit c74d5094c8 Merge remote-tracking branch 'official/master' 2016-11-25 14:54:10 -06:00
Julian Dolby ae57a7e947 further work on fix to cast nonsense 2016-11-24 11:40:36 +08:00