History log of /sdk/lint/libs/lint_api/src/com/android/tools/lint/detector/api/JavaContext.java
Revision Date Author Comments
7e4b8e9d595e45baa9d87cdb8282f02759e73abc 30-May-2012 Tor Norbye <tnorbye@google.com> Fix nullness annotations

Eclipse 4.2 includes analysis support for @Nullable and @NonNull
annotations. However, it requires these annotations to be *repeated*
on every single method implementing or overriding a superclass or
interface method (!).

This changeset basically applies the quickfixes to inline these
annotations. It also changes the retention of our nullness
annotations from source to class, since without this Eclipse believes
that a @NonNull annotation downstream is a redefinition of a @Nullable
annotation.

Finally, the null analysis revealed a dozen or so places where the
nullness annotation was either wrong, or some null checking on
parameters or return values needed to be done.

Change-Id: I43b4e56e2d025a8a4c92a8873f55c13cdbc4c1cb
d6124a176326169bc87cb29823ca2dc906689680 03-Feb-2012 Tor Norbye <tnorbye@google.com> A few simple name changes

This changeset contains no semantic changes, just a couple of simple
refactorings:

(1) Rename the "Lint" class to "LintDriver". "Lint" is a bit generic
(there's already LintClient for example), and this object was
already referred to as a driver from various other API's, such as
Context.getDriver().

(2) Rename LintRunner in Eclipse to EclipseLintRunner, similar to the
other EclipseLintClient in the same package - and to avoid
confusion with LintDriver.

(3) Move all the lint fix inner classes inside the LintFix class out
as top level classes. The class was getting really large and
there's really no good reason to keep all the individual fixes as
inner classes; there's already a separate lint package for them.

Change-Id: Ifc0004bfb38f8e11e33e9ddc477b6cf07ca319f2
4f12059ac0ec02366992a379ca2044f10abe914e 31-Jan-2012 Tor Norbye <tnorbye@google.com> Add @SuppressLint support for Java parse tree detectors

This changeset adds support for suppressing lint warnings by
annotatating variable declarations, fields, methods and classes.

Change-Id: If274d65bccdc5c7d6426566c635245d6b3aae147
380bdf7838171c02e29853027354c58ab9376beb 25-Jan-2012 Tor Norbye <tnorbye@google.com> Add support for multi-pass lint checks, and chained locations

This changeset adds support for multi-pass lint checking. A detector
can indicate that it is interested in a second pass through the source
code.

A good example of where this is needed is the Unused Resource
detector. In the first pass, it tracks declarations and references,
and at the end of the first pass it knows which resources are
unused. However, at this point it's too late to compute detailed
location information about each unused resource. Without multi-pass
checks, it would have to track detailed location information for *all*
resources, and computing locations can be costly.

With multi-pass support, it just computes the unused resource names in
the first pass, and then in the second pass it computes details about
the locations of those resources found to be unused.

This now includes *chained locations*. For example, for an unused
string, all the different translations of the unused string are
marked. These do not generate separate unused messages, it simply adds
to the location chain for the original unused warning.

This changeset also updates all the error reporters (text, HTML and
XML) to include all the locations, not just the ones with messages.

This changeset also cleans up the API a little: context classes now
track the lint runner instead of the lint client (which can point to
the lint client), and the SDK info lives with the project rather than
with the context.

Change-Id: I14ca3310bd1165b7dff655486157d770a36c4eff
b1283f2cc2dd403fa9f92407d4dfac37eddd520d 10-Jan-2012 Tor Norbye <tnorbye@google.com> Add annotations to the Lint API

Change-Id: I6222f3ef2909174d9111dcfc037a2e74ad093acd
14312a9603fab9e711639cfc19d5ea1de17250b1 02-Dec-2011 Tor Norbye <tnorbye@google.com> Lint Java source support

This changeset adds Java AST support to Lint. There are new interfaces
for Java parser and specialized Java detectors. Java detectors can
either visit a full parse tree, or they can register interest in
specific methods, or Android resource references, or specific AST node
types -- or a combination of these. They will then be invoked during
an AST visit with the relevant info.

This changeset also rewrites the existing detectors that were using
String-based pattern checking on Java files to using real AST
traversal instead (and it removes the custom Eclipse-specific unused
resource detector since the plain one now does the same AST-based
analysis that the Eclipse one did.)

Change-Id: I4d85f8b785bf41a88dbb29e7017b9c0f588880bc