| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
Move folders around to match default gradle/maven
folder structure.
The custom structure confused some IDEs when importing
the project as a Gradle project.
Change-Id: I5c059cc6fdf0ac2444b03d435f83f853363cfa32
|
|
|
|
|
|
|
| |
Fix a couple of issues found by findbugs,
and some test stability fixes.
Change-Id: I97390ea606ea25d6a68e5b7f8245e5e689117995
|
|
|
|
|
|
|
|
|
|
| |
This lint detector finds method declarations which are likely
to clash and accidentally override framework classes defined
on newer platforms
Also, fix method position computation in class files.
Change-Id: If0d03feb55e44816f75938dae3164c53ed5b3183
|
|
|
|
|
|
|
| |
Also add XML editor quickfix to set the attribute on
an API violation.
Change-Id: Ife95d73659656e98a6fb1a322354f5fcfcef1888
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The inefficient weight detector looks for horizontal layouts with
weights where all the children are layouts. It didn't have a very good
heuristic for finding out whether all children are layouts; it just
looked for whether the tag name contains "Layout".
This changeset generalizes this a bit, adding other layouts, as well
as <fragment> tags to the lint check.
It also updates the Master/Detail template to set the baseline
alignment attribute to false (to avoid triggering the updated lint
check), as well as android:textIsSelectable to clear another recent
new lint rule.
Change-Id: I887962b5e29a9ad0c5b5c01970b0c66f884125d8
|
|
|
|
| |
Change-Id: Ie8ff6629a3e787587516f6fa88c70dfdb7a92d0d
|
|
|
|
| |
Change-Id: I306b753319d235b015f44c0927382578805898de
|
|
|
|
| |
Change-Id: I415c42e19573bf733de672625a1200e62204ec77
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When you have a field initialization like this:
private int foo = new ForbiddenClass();
the actual code to perform the initialization lives in a method named
<init> (or for a static field, <clinit>).
If you tried to suppress lint errors here by adding an annotation on
the field, it would not be found by lint, since lint looks at method
level annotations and it's sitting on the field node instead.
To fix this, the suppress check needs to identify the field scenario,
and in that case (when checking whether an error is suppressed) look
up the field in the class and check annotations there.
There was a second bug: The lint check which looks for invalid
suppress annotation sites (since they're not allowed on local
variables for class based lint checks) incorrectly concluded that
these types of initializations were local variables rather than field
initializations.
This fixes issue
38626: ADT: Misleading lint rule: SimpleDateFormat
Change-Id: I254f3fb5a6132d6cbe39bd425ffe6d67ed7b84ed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the handling of \r characters in the code which applies
formatting deltas into existing documents. It could end up
inserting the formatted portion in the middle of a \r\n pair,
which made Eclipse extremely confused
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421)
This fixes
32849: Eclipse android adt xml editing artifacting (unsynced) lines of
text when changes are made in the graphical interface
It also adds a lint check to identify *existing* files that already
have these mangled line endings, along with a quickfix to make the
correction.
Change-Id: I1e7024f2786e4cb0233c2c6b98c3d3f942703ea0
|
|
|
|
| |
Change-Id: Ic8d20a002f6225cb15f609b3b7582716904e9278
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds basic support for running lint against
the AOSP frameworks/base/core codebase.
It also makes the resource folder provided by the lint
client.
Change-Id: I7e38b0925cb032f776c54f975b924b91d6ab7a24
|
|
|
|
|
|
|
| |
These icons should not use color (and in the case of notification
icons, be white).
Change-Id: I32b9422735830a01bb069b90a5ad5a76d7aeb5de
|
|
|
|
|
|
|
| |
I ran lint over some large projects and manually verified the report;
this uncovered a couple of false positives.
Change-Id: I006d64a03119c6badc40e33df9ab4079e07dc7c5
|
|
|
|
|
|
|
|
|
|
| |
Keep sets of applicable issues for each scope set. This
should make incremental lint slightly more efficient.
Also add a check that icon file extensions match the
actual file format.
Change-Id: I4a7f5e19b91aa3613480aa831ec42065528f02d3
|
|
|
|
|
|
|
| |
Make incremental lint in source files use the Eclipse context
to find super classes.
Change-Id: I31af7a146c259875857026bc7721294205482a91
|
|
|
|
| |
Change-Id: If2b905197d5d81c6f98315a0d48ff37091e8282b
|
|
|
|
|
|
| |
Replace "this.mFoo = foo" with just "mFoo = foo".
Change-Id: I44d537ebb62cd7e5c8493a0b50dcb527cd20f91c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset moves most constants into the SdkConstants
class, and gets rid of AndroidConstants and LintConstants.
It also migrates all non-ADT specific constants from
AdtConstants into SdkConstants. It furthermore moves various
other constants (such as those in XmlUtils and ValuesDescriptors)
into the constants class. It also fixes the modifier order
to be the canonical modifier order (JLS 8.x).
Finally, it removes redundancy and combines various constant
aliases such that we don't have both NAME_ATTR and ATTR_NAME
pointing to "name", etc.
Change-Id: Ifd1755016f62ce2dd80e5c76130d6de4b0e32161
|
|
|
|
| |
Change-Id: I8434515179b8fd2ee3872506fc237c467a98db44
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a project contains errors in the source code, lint won't be able to
parse the source code, and in that case it might draw the wrong
conclusions about unused resources.
This can also happen if there's an actual bug in the Java parser,
which is sometimes the case; see for example
http://code.google.com/p/projectlombok/issues/detail?id=415
http://code.google.com/p/projectlombok/issues/detail?id=311
In both cases, when we encounter a failure to parse a Java file, we
record the fact that not all Java files were properly processed, and
rules, such as the UnusedResource detector, can (and now does) use
this to for example skip reporting unused resources in this case since
it is operating with incomplete data.
Change-Id: I00991c10d05965ce151fb0dd322f32229dcd12cd
|
|
|
|
| |
Change-Id: I88cfbb3c497cc65e3d16c3ba1fe9ceeaf2613103
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using switch statements on enums, the compiler will generate
extra code to make the switch invocation efficient. For example, it
generates a method which looks up all the values in the enum, calls
ordinal() on each, and then creates an array which has all the enum
values indexed by ordinal.
The problem is that this helper code will end up referencing fields
which may have a higher API requirement than is currently being used,
and Lint would flag these as illegal API references. That's not
correct in this case; as long as the corresponding jump table does not
actually use these references, there's no problem.
This changeset makes lint aware of this pattern, and when it
encounters an invalid field reference inside one of these synthetic
switch constant lookup methods, it will search for the corresponding
table lookup, check whether the actual key is used, and only in that
case complain.
It also makes error messages associated with enums in general a bit
better, when the whole enum class itself requires a higher API. (This
would generate a message related to invocation of ordinal() which
might not be obvious to everybody.) Finally, it cleans up class name
formatting such that we never reference inner classes using "$" in
error messages.
Change-Id: I28a14084c160866e69f63f62b5bc8f21ee50215c
|
|
|
|
| |
Change-Id: I320af69286e7f0bcee395419acfeea7ed8f8d384
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset fixes the value completion such that you can add custom
values into properties that also have enum fields.
Rather than have separate completion routines for properties based on
whether they contain an enum, a flag, a reference, etc., have a single
completer which considers all the various formats and combines the
results.
In addition to combining results, this now also offers completion on
dimensions, and offers theme attribute values for references as well.
Change-Id: Idbc1799a34b3a3f14ea567654953925bf12afb8f
|
|
|
|
|
|
|
|
| |
Fix the commit prefs lint check such that it correctly identifies
scenarios where the innerclass "Editor" is referenced without its
qualifying top level class, SharedPreferences.
Change-Id: I3a22738508b66ce0b3e836feff91f816b2c368e8
|
|
|
|
|
|
|
|
|
| |
The explanation text for issues can now contain some simple
markup such as * around sentences for bold and ` for monospace.
In the HTML report this is converted to HTML markup using <b>
and <code> spans, as well as <a> for http:// links.
Change-Id: I875a55a0ab9a61c2e8bb493ad94d5e4d51dd1072
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset changes the default targetSdkVersion written into new
projects from being hardcoded to "15" to being the same level as the
build target's API level.
It also adds a new lint check which looks at the targetSdkVersion and
complains if it's not the same as the highest known version (currently
16). The issue explanation points to the javadocs for the
android.os.Build.VERSION_CODES class for details on how to upgrade the
app.
Change-Id: I00c2bd7cd8fa239b9fd1de9b2d35ff9faf87d25f
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The API checker needs to look up the corresponding source code source
range for a given bytecode method dispatch, and the line number
information found in the .class file is not accurate enough. Lint has
some heuristics to search for the corresponding source range, but this
did not work properly for cases where the method call was a parent
constructor, via the "super()" call.
It also fixes a bug in handling the default package.
Change-Id: I15bb07b6709ab9a53376398fe92715f6e6eba968
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|