| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| | |
Change-Id: I8434515179b8fd2ee3872506fc237c467a98db44
|
|/
|
|
| |
Change-Id: I67b37a0511dfba210dbcef393ee7610cef8b56a2
|
|
|
|
| |
Change-Id: If341cde0f0600c5975c6e847e228d72f5deefb23
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: I6c281183a176210a6991e81497d9fb242c3851bd
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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: Iffd270a227a8a76636cbfa5d19c6e0330a8391fb
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I95bf3bc87e4378af6ef866df0a1ffb69f8fd7a41
|
|/
|
|
|
|
|
|
|
|
|
| |
This changeset expands on the lint check for calling String
convenience methods that are locale sensitive without an explicit
locale (issue 36822). It checks whether a SimpleDateFormat constructor
that uses the default locale is called, and if so suggests either
specifying a locale or using one of the pre-configured locale
sensitive instances of SimpleDateFormat.
Change-Id: Ic4fcb72c2ee6b31d1534b4d909493fef7dcff867
|
|
|
|
|
|
|
| |
This helps catch errors like
http://code.google.com/p/android/issues/detail?id=36821
Change-Id: I1ceda3183d8b1e29510ba0be2523dc6eb9c7a23b
|
|
|
|
| |
Change-Id: I320af69286e7f0bcee395419acfeea7ed8f8d384
|
|
|
|
| |
Change-Id: I46630c51a4f055222fb614d73419cb28272b87de
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a lint rule which looks for potential
leaks when using View#setTag(int, Object) where the Object
is likely to contain a strong reference to the context,
such as views and view holders.
http://code.google.com/p/android/issues/detail?id=26984
Change-Id: Ib606485d2b875d2129c339b9b89be0e444629408
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|/
|
|
|
|
|
|
| |
Developer documentation says naming convention for 3.0 and up is still
ic_menu for action bar icons so if name.startsWith ic_menu need to use
the correct px count
Change-Id: I9db3199f805934a0bad3eac3b1306ef881b0e631
|
|
|
|
|
|
|
|
|
|
| |
Instead of referring to "java.io.IOException#<init>" in the
error messages, refer to this method as
"new java.io.IOException", since the fact that constructors
get mapped to the internal name "<init>" isn't something
everybody knows.
Change-Id: I4e9aacd9cfd3acae340737d4e3094c6dbdcf52f5
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
Apparently java.lang.Math is faster than FloatMath now with the newer
JITs. This reverses the old lint rule which would recommend using
FloatMath instead of Math with the opposite recommendation, provided
minSdkVersion is Froyo or greater. See issue 36199 for more.
Change-Id: I362cb7da011d39f5620db96e113f8255a828d40b
|
|
|
|
|
|
|
| |
This CL adds some code to more gracefully handle
problems with the Api Checker's binary cache.
Change-Id: I02c86ab16b857b88df8945c84cb92c7217a6144a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This checkin adds typo databases for six additional languages, as well
as several fixes to the infrastructure.
First, it now supports "globbing", since for example the German typo
database contains glob patterns of the form
"asymetrisch*->asymmetrisch*".
Second, it supports multiword typos (such as "all zu->allzu") which
caused some complications (since this means that the typo detector
can match beyond the word boundary it was passed in).
Third, it adds a bunch of validation code to the type dictionaries,
which uncovered a bunch of inconsistencies (duplicate entries, using
"-" instead of "->" for some separators, etc). There's now a unit test
which produces a cleaned up version of each dictionary file, as well
as tests to ensure that the ASCII and the UTF-8 comparison methods are
in sync (and this uncovered some bugs which were fixed.)
Finally, it fixes the HTML reporter such that it properly handles
UTF-8.
Change-Id: Ie32cbbe489687a7b50184696a027f87c2e21c409
|
|/
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
This changeset generalizes the lint typo checker to handle
non-ASCII languages (with UTF-8 encoded typo dictionaries).
Change-Id: If21a2047a127848db77d9ec6f9aae3c052e0f288
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I0e2959c4183d0063b66ec4ade98029a0e3e17c9d
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The visual refactoring for converting a LinearLayout with a <TextView>
and an <ImageView> adjacent into a single <TextView> using a compound
drawable, needed to properly handle spacing between the two
widgets. This changeset updates it to convert margins between the
views into a single drawablePadding attribute.
Change-Id: Idb077e3324c279d41fdc0baa68008fe862d8181a
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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: I83023903a7744b1372a832dfdc56b595c21f4902
|
|
|
|
| |
Change-Id: I789b086fff06e3b0106995a80dcdb96608447fb6
|
|\ |
|
| |
| |
| |
| | |
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
|
|\ \
| |/
|/| |
|
| |
| |
| |
| | |
Change-Id: I0535f8f59e5db4087677702916b95fb06b7b67d0
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds in the ASM analysis library (an optional part of
the ASM package lint is already using to process bytecode). It also
adds some basic flow analysis to the SecureRandom detector to detect
whether a given dispatch to a field of type java.util.Random is
actually pointing to a java.security.SecureRandom, in which case it
flags calls on it to setSeed() where the argument is a fixed integer.
Change-Id: If85ab9f8db0e801a01f1a3ea845865b4f98e259c
|