| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move resources and com.android.util.Pair into layoutlib_api
where they belong since layoutlib depends on them and we need
to control the API.
Made a copy of Pair to stay in common.jar but moved it to
com.android.utils.Pair (the one in com.android.util.Pair is
marked as deprecated to prevent usage where applicable).
Also moved XmlUtil and PositionXmlParser to com.android.utils
to match Pair.
Change-Id: I21d7057d3f2ce604f86a3bb1fa3c130948c93b89
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset updates the issue explanation for the translation
detector to explain the translatable=false and donottranslate.xml
mechanisms to handle non-translatable strings.
It adds a quickfix for missing translation items to set the
translatable attribute to false.
It also makes lint warn where you're using translatable=false
on strings in a locale-folder, as well as when you're translating
a string defined as translatable=false in the base folder.
And finally it also bumps up the severity of the extra translations
issue as justified in issue 35875.
Change-Id: I7539464b234b0a4b444bf9f188ce5b819f962430
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
First, this changeset allows the arguments passed to --sources and
--classpath (renamed from --classes) to specify not just a directory,
but to specify a path as well. This might make it easier to invoke
lint from scripts if you have a path variable, so you don't have to
split it into multiple arguments.
Second, it makes the lint task in ant use these, such that any
build.xml customizations to the source paths or class paths are
automatically used rather than relying on lint's default structure
check.
Change-Id: Id8e4caf0010d7fd7245844b3099b5dc0607f0aba
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Change-Id: I3c7c13437403fb1392343af079afab9434695566
|
|/
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes
35804: ContentDescription should not flag if
importantForAccessibility="no"
When the above attribute is set on a View, the accessibility detector
will not flag the corresponding view for missing a contentDescription
attribute.
Change-Id: I953235a04f1b1ee0f05a94604a2f364c09f851a1
|
|
|
|
|
|
|
|
|
|
|
|
| |
Maven places the source files and class files in different locations
than our default Eclipse and ant build systems. This changeset adds
--sources and --classes arguments to the lint CLI to allow a build
script to point to these custom locations. It also also looks in
Maven's default location if it doesn't find the normal bin/classes/
folder such that out of the box it might just work even in Maven
projects.
Change-Id: Ia91b05f0fc9d2c7e504c962d2e794c768085754c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes the lint-on-save behavior in Java files such that
the classfile based checks are run after the .class files are up to
date.
It also makes lint-on-save work when Project > Build Automatically is
turned off, by adding a new resource listener, and it modifies the
IFileListener interface to make resource listening more efficient; in
particular, it passes the flag mask such that listeners can ignore
events such as markers getting added or removed from a file without
the content changing.
It also makes some improvements to the lint infrastructure. First, it
adds an indirection in the LintClient such that reading bytes from
files can be customized by the client (to for example add caching or
to read contents from memory not yet flushed to disk). It also allows
inner classes to share the contents of the source file between each
context (while debugging the above I noticed that each inner class
node had its own class context and therefore would re-read the source
file repeatedly.)
Change-Id: Ib9572cebe1269fe05c3af1369610525ea3b44061
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The AST-based check for whether an issue is suppressed did not take
constructors into account. This was because the AST node for
constructors (ConstructorDeclaration) does not extend the AST node for
method declarations (MethodDeclaration). This mistake was made in a
couple of other detectors as well.
(Also renamed test class which did not have the correct name (detector
class + "Test") so jump to test did not work.)
Change-Id: I0ecf99ab7d0357a03e300b7197ae84079f0ddbd1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset improves the way lint handles library projects.
Until now, running lint on project "master" would also look up any
library projects referenced by the master project, and analyze the
library projects as well. This is necessary in order to correctly
compute unused resources for example, since it's possible for a
resource to be defined in one project and referenced in another.
However, while this behavior is desirable for users who partition
their code up into library projects, it has some serious problems for
users who are using a third party library project:
- Their lint output can be swamped with errors from the library which
they have no control over.
- If for example the library provides translations into 60 languages,
lint will use these 60 languages as the set of languages targeted by
the application, and complain about all strings in the master
project which are not translated into all the languages.
This changeset makes a key change to how library projects are
handled:
(1) If you run lint on all projects (including the library projects),
then there is no change from before.
(2) If you run lint and specify just a project, then lint will
continue to analyze the project as well as all its libraries,
but will only report problems on the user-specified project.
The way this is done is by a new "report errors" attribute stored with
each project. All projects that are explicitly referenced on the
command line (or selected in the Eclipse UI), and all projects that
are found recursively if you specify a top level directory, all these
projects have their "report errors" flag set. Any remaining projects,
which would be those found through library project references, these
have their report errors flag cleared. And whenever lint is processing
errors, it will filter out errors for projects that are not reporting
errors.
This addresses issue
http://code.google.com/p/android/issues/detail?id=33847
as well as a number of other requests (in StackOverflow and elsewhere)
around the ability to filter errors in library projects.
Change-Id: I9d084f598c678ecf79cfe70d8ea7a84844333acc
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I20592372d41235b36227a0d36014d77c23c7fc58
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The @SuppressLint annotation can deliberately be placed on not only
classes and methods but on parameters and local variables too.
For AST-based (Java source-based) lint checks, this works fine.
However, some lint checks, such as the API Check, is based on
analyzing the bytecode. Annotations placed on local variables and
parameters do not make it into the .class file, so these annotations
do not work to suppress errors when placed on local variables (or
parameters).
The @TargetApi annotation applies only to the bytecode based API
check, so its metadata only allows the annotation to be placed on
methods and classes and constructors. However, the @SuppressLint
annotation needs to continue to be available for the AST-based checks.
This CL adds a new lint check, a "meta" check, which actually looks
for invalid @SuppressLint annotations, and warns about these. With the
new lint-on-save behavior, this means you instantly get feedback if
you attempt to suppress an annotation in the wrong place. (Note that
the quickfix for adding annotations has always enforced this and
placed annotations out at the method level, but as shown in issue
35049, developers place them there deliberately themselves.)
This CL also fixes an unrelated problem (shown in issue 34198) that
the add suppress annotation code could sometimes add multiple versions
of the same id into the annotation.
Change-Id: I5bc61c6315edfcfc20103d1e580e389dd8e6a09b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds shared dispatch for bytecode based rules. We
already have this for XML and Java source trees: detectors can
register interest in a particular element or attribute name, or a
particular method call name, and then the source is processed in a
single pass, and a quick map lookup dispatches to any detectors
interested in that particular item.
This has the important property that adding new detectors does not
linearly slow down lint: it does not process each XML document an
extra time for each newly added rule: the new rule just adds one more
entry into a dispatch table, and only for the specifically interesting
tag name (for example) is there an extra dispatch to the new detector.
This changeset adds a similar mechanism for the ASM based bytecode
detectors. Until now, each detector would be handed the class node of
the outer class. This changeset adds a couple of new dispatch methods:
First, a way to register interests in method calls of a particular
type, and second, a way to registere interest in types of ASM nodes.
In addition to the new visitor, this changeset rewrites a couple of
detectors to use the new dispatch approach (there are new detectors in
the pipeline which will also take advantage of this), and cleans up
handling of positions a bit.
Change-Id: Ib115bd3418b6c63bdcd49fec046e91a73daf38a9
|
|
|
|
| |
Change-Id: Id437ef30e1488c96a46ccea45459694fd23db582
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This checkin improves the handling of ?attr and ?android:attr theme
references, such that
(1) The API check considers theme references, and for example flags
usage of ?android:attr/dividerHorizontal if your minSdkVersion is
lower than 11
(2) Adds theme reference completion to the XML code completion.
Change-Id: I2049b828e413802ac81579294f515fb0a4faccdf
|
|
|
|
|
|
|
|
| |
This changeset improves the way lint searches for the correct
source offsets (and line numbers) for symbols found in .class
files. Among other improvements this also fixes issue 34686.
Change-Id: I7a2f40f0d930a4786dc69a7f0e0bbf5367a30ad4
|
|
|
|
| |
Change-Id: Ie2b5929a87144c77f1ce0d43b2520cc498df5081
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This CL fixes issue 33985. There reason these error markers
were sticky, is that the IssueRegistry.PARSER_ERROR error
type is special, and was not handled properly by the
Issue.isAdequate(Scope) method which is supposed to return
whether the given issue can be fully analyzed in the given
context.
In addition, I also disabled the Java parser generating
PARSER_ERROR issues when running in Eclipse, since Eclipse
itself will already provide these errors, so all this
achieves is creating "multiple annotations on this line"
conflicts when you hover over the icon.
Change-Id: Ie91604660a69eb007b851e5a821e629211c29690
|
|/
|
|
| |
Change-Id: I3499900277b108ac9d2a214d1078a20d29409c5a
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds a new typo detector. There
are also some lint infrastructure fixes to better
handle positions within text nodes, and to allow
Eclipse lint quickfixes to supply multiple fixes
for a single issue (such as multiple misspelling
alternative replacements.)
Change-Id: Ie26f0bafc571e02ae09ff27a7f4b221fe0c2ea5b
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds a new wizard, hooked up from the Import wizard
as well as from the New Project wizard menu, which lets you import
one or more Android projects (not necessarily Eclipse Android
projects). It also removes the "From Existing Source" toggle from
the Blank Project wizard.
Change-Id: Ie5cb5b034be61a02b7d6496a7188f481f677a5a8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, update our various project-specific Eclipse compiler settings
configuration files to include the new Eclipse 4 flags.
Second, turn off the "Unchecked conversion from non-annotated type to
@NonNull" warnings; there are hundreds or thousands of these, and
there isn't much we can do about them when they're coming from
platform and library APIs.
Third, make the lint projects warning-clean again by addressing
various warnings Eclipse found (such as some unclosed resources and
some null handling issues; yesterday's null annotation fixes only
addressed errors, not warnings.)
Change-Id: If75f7401a1cbeef1bf58b47ccaa9ad17bede7f91
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fragments should provide a default constructor, and only a default
constructor, such that they can be recreated by the system on
configuration changes.
This changeset adds a lint check to catch cases where this is not the
case -- such as fragments that are non-static innerclasses, or where
the the class or constructor is not public. It also warns if the
fragment contains any *other* constructors, since the fragment
documentation strongly advises against it.
Change-Id: I8cdd00fd7c74259f84977804e36ace7c43864026
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset contains various unrelated fixes to the lint
infrastructure:
(1) Tweak the way the classpaths are computed in the default lint
client method such that rather than reading and parsing the
.classpath file 3 times, once for each of source-path, output-path
and library-path, it's now processing it once and storing the
results for all 3.
(2) Override the lookup-classpath method in Eclipse to directly query
the Eclipse APIs for obtaining the classpath info.
(3) Add in user libraries found in libs/, since these don't
necessarily show up in the .classpath file.
(4) Fix a couple of bugs related to checking .class files: First, when
locating the project for a .class file, lint would search upwards
for the surrounding project, which meant looking for the nearest
parent containing an AndroidManifest.xml file. However, in the
case of .class files, it will first encounter the bin/ directory,
which can contain a manifest file, so it would compute a project
for the bin/ folder rather than its parent, which meant the source
paths would be wrong.
Second, the list of class entries to be processed by lint must be
sorted prior to processing; the code dealing with innerclasses
depends on that.
(5) Some minor code cleanup: Move some generic utility code and some
string literals out of specific detectors and into the generic
utility and constant classes.
(6) Cache results of the lint-project to eclipse-project lookup method
since that method is called repeatedly with the same (current)
project.
Change-Id: I33603eed8381ca54314202620cb1bb033e70f775
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds support for per-save file checking in Java source
files. It will run both source file and bytecode based checks,
possibly at different times (since they are updated at different
times). This required some changes to the incremental lint runner,
since now incremental checking means possibly touching more than one
file (multiple inner classes for a single source), as well as
distinguishing between the source files containing markers (the .java
file) and the actual files being analyzed (the .class files).
This changeset also formalizes incremental lint checking a bit: it now
distinguishes between the affected scope of an issue (all the various
file types that can affect an issue), as well as the scope sets that
are capable of analyzing the issue independently.
Take the API check for example. Its affected scope includes both XML
files and Java class files, since both can contain API references (in
the case of XML, a <GridLayout> reference is an invocation of a
constructor of the GridLayout class for example). However, we can
analyze a standalone class file, or a standalone XML file, and
incrementally update issues found in the file, without regard for the
other. Therefore, the API detector has two separate analysis scopes:
classes, and XML resources. The manifest registration detector on the
other hand needs to look at both the manifest file and the class
files; it cannot look at just a subset of these.
Change-Id: Ibf5ca8a90846256e0817b419908ee53f8354412a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes the API detector such that references to a
constructor (e.g. where the bytecode name of the method being called
is "<init>") are properly located in the source code. This is done by
altering the search pattern to look for the owner field instead.
This changeset also pulls out the generic "find location for a class
declaration" from the recent HandlerDetector and into a generic
utility position in the ClassContext, and makes the case handling
anonymous inner classes generic rather than being hardcoded for
subclasses of Handler.
Change-Id: I25f60fda77924edc02bb3029b301e484b0b24931
|
|
|
|
| |
Change-Id: Icf9c3cdd105f1edb653260e0a76419bcfc9ef83d
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I2ff5e88fce13f9016b27878ece2c45ea1b58ad7a
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| | |
This check looks for exported content providers with no permissions.
Change-Id: I1b318b80dc8dc560c42a05db2e4dfa5bd7f45f9d
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| | |
(Also identifies other misplaced elements -- activities, services,
uses-screens, etc etc)
Change-Id: Ie9fee95c05715001be6af23c1cdd86e895e43509
|
|/
|
|
| |
Change-Id: I9687c0c59e13c340b2d564d5aa17635153d88d07
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
27108: lint confused by escaped percent signs
27109: Lint misreports resources as unused when the fully qualified
class name is used
27110: Lint attribute to ignore an unused resource doesn't work for
reference XML drawables
Change-Id: Id8457d8305e5d2770bc8ab547a0735c63117682c
|
|/
|
|
|
|
|
|
|
|
| |
The Makefiles for the lint, lint_api and lint_check libraries were
*statically* linking in the Guava and ASM libraries. This made them
much larger than necessary (~1.6M instead of ~100K), and for no good
reason since the classes were already on the classpath, and of course
this duplicates them repeatedly.
Change-Id: Iec3ed623429ab8b7b8ba78f5d7a069853ae665c3
|
|
|
|
|
|
|
| |
Also fix the paste operation to target the parent if
the paste target does not accept children.
Change-Id: Id084db376e5ff9b4a374e6d2145bc890a925a078
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Make returns codes be positive (1..5).
- Explain return codes in the usage help.
- Support either env var or system properties for bindir.
- Add support for a workdir property/envvar that is set by
lint.bat with the original invocation directory.
- Use workdir to solve relative input/output argument paths
(on windows we cd to the lint.bat location and record the
original path in workdir.)
Change-Id: I8b2583de761ce9c4ebba250460de6c60f1ea6a84
|
|
|
|
| |
Change-Id: If74938a7e607ef6e1ffbc00cb0e5d191a672b0c5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds outerclass handling for the @TargetApi annotation,
such that the API checker takes outerclasses (and outermethods, in the
case of anonymous inner classes) into account when computing the
effective minimum SDK For a method.
This also fixes the handling of nested anonymous innerclasses for the
@SuppressLint annotation.
http://code.google.com/p/android/issues/detail?id=26262
Change-Id: Iafb0fd88cc41042ea1727c3882e3ddd1ebfc1f09
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes one more bug related to lint configurations and
library projects (see issue 26029).
Some lint checks, such as the MergeRootFrameLayoutDetector, computes
the warnings at the end of processing all files. At that point, the
context points to the master project, so any errors which were
actually found in a library project will instead be using the master
project's configuration. That means that any suppress rules applies to
the lint.xml in the library project will be ignored.
This changeset fixes this by moving the logic which looks up the
severity for a warning out of the lint clients and into the
context. Now it checks the current projects being scanned and looks up
the corresponding project for each file (based on the file prefix),
and retrieves the configuration that way.
This changeset also makes one more fix: It now consults *both* the
library project *and* the master project to see if a rule should be
ignored. This means that if you turn off a given check in your master
project, you will no longer see those warnings from library projects
either, which seems desirable.
Change-Id: Icb5cdf7696b4908b0553f86896793515cb06f29c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset makes @SuppressLint work for classfile based detectors
when the error is found in an inner class and the SuppressLint
annotations is on an outer class.
Innerclasses are actually separate classes from their outer classes,
so they are processed separately (each .class file is read and
analyzed independently).
This changeset processes the class files in alphabetical* order such
that it can maintain a stack of outerclasses when processing a
class. The suppress lint check can then visit the outer class'
annotations to see if the error should be suppressed. (*: The order
isn't exactly alphabetical: We want Foo$Bar.class to come after
Foo.class)
This changeset also tweaks the Add Annotation quickfix such that it
only offers per-method or per-class annotations, since class files do
not maintain annotation info for other granularities (such as on
variable declarations, so you cannot suppress classfile based issues
with annotations there.) We could make a lint check which ensures that
you don't try to put these annotations there :-)
(This is related to issue http://b.android.com/25948)
Change-Id: Ia9dbc39b1adc73a1b60e375edbf9b5618c7d2353
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes a couple of Lint bugs:
(1) Handle BOMs (byte order marks) in Java files. We already handle
this for XML files (where it's common) but these can be present in
other file types as well, such as Java.
See http://code.google.com/p/android/issues/detail?id=25952
(2) Fix a bug (false positive) in the FloatMath detector; the visitor
approach can get confused; do simple ASM node iteration instead
(which is how all the other detectors work; this detector was
written before we had the ASM DOM model)
Change-Id: I65b4e6cd8d8e6c7e591433d8eb5aedf273e2caad
|
|
|
|
|
|
|
|
| |
When the Lint API check is analyzing code in a library project, it
should use the min sdk version from the main project (unless you are
linting just a library project without including a main project).
Change-Id: I6d09f2d3e406213014df55832e781813c96aedfd
|
|
|
|
| |
Change-Id: I79cbdf874cffe78eb62f9af2e22e6cc780853e6a
|