| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ |
|
| |
| |
| |
| | |
Change-Id: I46abcb93537b3d288234729dd01005c41394d227
|
|/
|
|
| |
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
|
|
|
|
| |
Change-Id: I59c2a64e4453c4d05bebaba1cfa4fcb31b9592e2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I16fadfbf801bcb60e0d7edda6af163bf158a4c21
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Element.getAttribute isn't supposed to return null, but in Eclipse it
sometimes does. It was common in 3.5.2, which we've dropped support
for, but issue 25668 shows that it can happen in Eclipse 3.7.1 too
though it's rare.
This changeset attempts to address the issue in two ways:
(1) Spotfix the specific NPE
(2) Hold the readlock on the XML document while the detectors are
using the DOM nodes (this is in case the nulls are related to
this, which is not certain given that the issue is rare and not
reproducible)
Change-Id: I14727531ea9e08abf45d70013248e702cf5a15eb
|
|
|
|
| |
Change-Id: Id62e675e467a4c9754515640194c836ab4cb9a83
|
|
|
|
| |
Change-Id: I79cbdf874cffe78eb62f9af2e22e6cc780853e6a
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset splits the proguard.cfg into two halves:
(1) All the general Android settings go into
$ANDROID_SDK/proguard/proguard-android.txt.
This defines shrinking rules like keep custom views, etc. The
crucial point is that this information is maintained and updated
by Tools updates, so whenever new APIs are added to Android, or
whenever bugs are found in the configuration such as flags needed
to work with Dalvik, we can make the updates - we don't have old
snapshots living on in projects.
(2) Any project specific settings go to proguard-project.txt in the
project.
(3) The proguard.config property in project.properties now refers to a
*path* of configuration files, which are all passed to ProGuard in
the given order. The code which processes this setting will
substitute android.sdk.home and user.home variables, so the path
does not have to be hardcoded to point to the project-android.txt
file.
The default project templates have been updated to include a
commented out configuration setting up proguard as described
above.
The default proguard file name was changed from proguard.cfg to
proguard-project.txt such that it can be directly opened in Eclipse
and to make it clear it's an editable text file.
Lint was updated to find the Proguard file via the proguard.config
property as well as via the old and new default names for projects not
enabled with ProGuard.
A subsequent CL will add a lint check which identifies projects
containing the old setup (full local configuration) and offer to
replace it with the new setup.
Change-Id: I44b4c97a160114c2382f02f843c95486a0dc9d6b
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Android has various setColor methods (such as setTextColor) which take
an integer, where it expects RGB values in the bytes. Since this is
an integer, and since color resources are integers, sometimes code
incorrectly passes the color resource id rather than a resolved color
to the setter:
paint.setColor(R.color.red)
Obviously, the color should be "resolved" first via
getResource().getColor().
This changeset adds a lint detector which catches these kinds of bugs.
Change-Id: I2970e5220d24ad3b844a9f19fbe99b932d9f7fb4
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This changeset adds support for suppressing lint errors on
translations. For a missing translation, place the suppress attribute
on the default language key. For strings defined in other languages
but not the default locale, place the attribute on the extra
translation.
This required adding better location tracking (which is also
beneficial in that the translation warnings will show up as editor
underlines in Eclipse etc). Instead of having errors generated for
each locale ("the following strings are missing from locale X") it now
generates a unique error for each string, listing which locales it's
missing from. This also solves a different issue where the list of
missing strings was truncated when large; there's no more truncation
now.
Change-Id: If63e92a6a750a5314af2f11441347cf9fc0b0a15
|
|\ \ \
| |/ /
|/| | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Take the folder version into account when checking the API level in
XML files. For example, even if minSdkVersion=5, it's okay to have a
<GridLayout> element in a layout if that layout is in a layout-v14 (or
higher) folder.
Change-Id: Idbd3647c1145e4b3d03f90626339ef7e6b10c827
|
|\ \ \ |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
TextView provides a number of attributes related to text editing.
However, these are generally intended for the EditText subclass of
EditText. This lint check looks for <TextView> elements in layouts
where one or more of the edit-related attributes (such as inputType)
are defined.
It also updates the deprecation detector to check various deprecated
attributes (it only checked for deprecated elements before this.)
Change-Id: I1b94902d906cd0bee6a6564368125a68b3c9bb2a
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If Lint cannot find the .class files for a project, it cannot run any
of the class-file based checks (such as the NewApi check).
This changeset adds a new category and issue id, "Lint Error", for
these types of issues. In HTML reports, these errors are listed at the
top. The issue explanation states that these errors don't represent
bugs in the user's code, but that lint was not able to check certain
things for the reasons given.
In the case of no .class files found, it asks whether the project
needs to be built first. It also uses these lint errors to emit
errors in processing lint.xml configuration files.
(Note that if you don't want to see these types of errors, you can
suppress it via --disable LintError.)
Change-Id: Ifc2f55566f3a0cd20189d43e4205201bc21ee280
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a lint rule checking that any named, non-abstract
classes which extend Activity, Service or ContentProvider have a
corresponding registration in the manifest file.
It also ensures that the registration is under the right kind of tag
(<activity>, <service>, <provider> or <receiver>).
Change-Id: Ifbb587ae7b3eb6529d5099b33245d0478d48c41f
|
|/
|
|
|
|
|
|
| |
This changeset makes the API lint detector look at XML attribute
values and XML value text nodes and check any references to @android
resources to ensure that they are available in all supported versions.
Change-Id: Iab0d23423c30381e06b32f54aa902a31cc1f9a1c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds is-suppressed checking to most of the remaining
XML detectors. These are detectors which do post processing on data in
order to compute the warnings, at which point they no longer have
access to the original DOM node context. This changeset adds various
checks to handle this, such as storing the DOM node in the location
handle client data and checking explicitly before using the handles.
It adds various unit tests for the suppress scenarios too.
There are now two remaining detectors which don't properly handle
suppression: the TranslateDetector, and the DuplicateIdDetector (in
cross layout scenarios). These will be addressed in a separate CL.
Change-Id: I53e792dd2f2802c7dce16beb73127f20d9b2dba8
|
|
|
|
| |
Change-Id: Id8f467c5a088101e6b50c33fa0703520e31bdede
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This lint check makes sure that if a layout references
android:onClick="foo" then one of the Java classes provide a
public void foo(View)
method. It also looks for simple typos, and warns if the access
modifiers are not right.
(It also moves some ASM-related utility code out of specific detectors
and into the ClassContext class)
Change-Id: Ifb0820221175a0760b83992f54e99f761b4d7097
|
|
|
|
| |
Change-Id: Ia8f0c1aebb4e797352a0513b8113b5d6b75ef0dc
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Also adds a lint check for unused namespace declarations,
and migrates the TypoDetector code into this new namespace
detector.
Change-Id: I5ec2214ea4c59e14194f8eaecef422ea19baa35e
|
|/
|
|
| |
Change-Id: I6a68b28b610ebdfc31b779b7b66e49a70a5e1a01
|
|
|
|
| |
Change-Id: Iecad10d5c33f6b7649e686633c9ff9f5541e9799
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds two new checks for Java performance suggestions:
(1) It identifies object allocation within draw methods
(onDraw(Canvas)) and warns that it's a bad idea. It also looks for
certain factory methods, such as Bitmap.createBitmap(), which have
the same issue.
The lint detector also checks to make sure that the allocation
isn't part of lazy initialization: if the return value is stored
into a field, it checks that the allocation is surrounded by a
null check on that field.
(2) It identifies usages of HashMap<Integer, X> and suggests replacing
it with SparseArray (or SparseIntArray or SparseBooleanArray,
depending on the second type variable of the map initialization).
Change-Id: I3bcbb182404b1eeaaa8c9e5209d889694d88f216
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A handful of lint checks still don't support per-node suppress
checking (because the computation does not have node information at
the time when the final warnigns are produced).
This checkin uses the new location client data facility to add scope
checking for a few more of the lint checks.
Change-Id: I0ca48e91441dcd753834ad4777959f728b74ac71
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a new severity, "Fatal", and shifts the abort-on-
export feature from using the Error severity to the Fatal severity.
This gives the user (and lint check developers) a bit more control
over which errors should fail a build. You can now leave some issues
as "error", but not have it block export. This can be useful for
checks which are extremely slow, or for checks that generally
represent errors but where the rule cannot know for sure (such as
attempts to figure out reflection calls in Java).
Change-Id: Ie44d5efcb605091ba8c1c67aa720edbbde416ca5
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a new lint detector which looks for typos in the
namespace declaration for Android. If it sees the prefix "android" it
ensures that the URI matches exactly (and case-sensitively)
http://schemas.android.com/apk/res/android
If the prefix is "a", it also checks for the above prefix, but only
warns if the difference is "close" (edit distance <= 3) such that
it belives it's a typo, not some unrelated prefix bound to "a".
(This was requested in http://b.android.com/25449)
Change-Id: Ic6dee77a300fc048cb9bee3e455f533b858ef6bb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a preprocessing state to the class handling.
Instead of processing each class sequentially, all the class byte
arrays are read in first, and then a lightweight class visitor
(skipping methods and debug symbols) skims through all the classes to
build up a superclass map up front.
The byte arrays are then processed sequentially as before, but the
detectors can now query the lint driver for class hierarchies.
A couple of lint checks are now taking advantage of this. For
eexample, the API checker can properly handle virtual methods where a
local class extends some other local (or library) class which
eventually extends an Android API class. (Until this checkin, only
classes directly extending an Android API class were supported).
Change-Id: I972172a61268dd2530979a93b2f289c1dcf94d63
|
|/
|
|
|
|
|
| |
This changeset makes lint properly handle the jar dependency scope for
issues. It also tweaks the API in a few minor ways.
Change-Id: Ibd7b943c9d3ce361e091af8f1e990709bb94d183
|
|\
| |
| |
| | |
settings"
|
| |
| |
| |
| | |
Change-Id: I9401318afe771d11ef6f211ee3f9cb6c62df8f83
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The string format lint check might be processing strings not intended
for String.format (but intended for example for
android.text.format.Time#format), in which case it will be wrong about
whether two conversions are incompatible. (This does not fix all
scenarios; if a date string looks like a String.format in the sense
that all of its formatting characters are defined by String.format
then the string will assume to be intended for String.format.)
This changeset attempts to recognize this, and also make the "is
incompatible" check a bit more nuanced: it will now consider "d"
compatible with "x" for example.
Change-Id: I63ce082f40169e4033809d25cae3cf116c9e2044
|
|\ \ |
|
| |/
| |
| |
| | |
Change-Id: I997ad6f1348e9884b56a60ef453cd02754c936bb
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset enables the button order check by default, and makes
the rule consider the minimum and target SDK more carefully.
* If both the min and target SDK >= 14, the rule enforces the new
button order.
* If both the min and target SDK <= 14, then the rule does nothing.
* Otherwise, if warns if the wrong button order is in a layout that is
in a layout*-v14 or higher folder, or if it's in a non-v14 folder
and there is no corresponding v14 layout.
Change-Id: Idf54f86d7a004fdb073486160e4d5ff5fd1cd45c
|