aboutsummaryrefslogtreecommitdiffstats
path: root/lint/libs/lint_api
Commit message (Collapse)AuthorAgeFilesLines
* SDK: Delete projects moved to tools/base or tools/swt.Raphael Moll2013-03-136-364/+0
| | | | Change-Id: Iba15f82cb00d19217382c78d8ff37dda1e97ea59
* SDK prebuilts: reorganize into tools/lib.Raphael Moll2013-03-061-1/+1
| | | | | | This must be submitted with prebuilts/devtools' change I3d985ed0abf. Change-Id: Icab479e0e8a5c126b0fdc213a792187a14a44f21
* Remove source of prebuilts.Raphael Moll2013-02-0632-11976/+0
| | | | | | Sources are now located in tools/base.git. Change-Id: I9cbe1deb98f8c43e90f5fb04b668f664b9850620
* Change more SDK libs to prebuilts.Raphael Moll2013-02-061-7/+10
| | | | | | | | | | | Requires prebuilds/devtools.git I913a29e5f40db99871701461aad6fc38483015d2 To update the prebuilts, you need tools/base.git and the prebuilts/devtools/update_jars.sh script. This is supposed to be an intermediary step as we switch to tools/base. Change-Id: I3dcccfdd9dc243a22a5bfd9db6779d24285db1ac
* Allow "all" to be used in the lint.xml file to match all issuesTor Norbye2013-01-281-0/+9
| | | | Change-Id: Ieedd879648883fb2d1a2eed571b690f3280a1850
* Lint tweaksTor Norbye2013-01-222-10/+16
| | | | | | | | Fix missing dispose() call for manifest files, and add a method to the TypographyDetector such that clients don't need a DOM node to look up the suggested replacement. Change-Id: If048a62a6b0b1c8af83a3e0b62a28876d4449764
* Fix other file visitor to handle incremental analysis properlyTor Norbye2013-01-222-26/+92
| | | | | | | | | | | The other file visitor would unconditionally scan the full project contents for each scope, even when project.getSubset() (used for incremental analysis in IDEs) was non null. Also avoid NPE when lint is scanning a java file without a package declaration. Change-Id: I74e813b41c2e32acac879b277dc974619156adbd
* Fix Eclipse classpath for projects moved to tools/base or swt.Raphael Moll2013-01-161-1/+1
| | | | Change-Id: Ibc54b1a23688217666b60ce7dc692f0bba00419a
* Add support for checking lint on other filesTor Norbye2013-01-147-9/+249
| | | | | | | | | | This adds a new scope, Scope.OTHER, which can be used to indicate that the check wants to investigate files other than the ones specially handled as XML, Java, manifest or ProGuard files. The PrivateKeyDetector now uses this such that it doesn't have to perform its own directory iteration. Change-Id: Ic38bf2db656f00c01d94c0c4e0112bc77218ea08
* Delete ALL the build.gradle from sdk.gitRaphael Moll2013-01-091-70/+0
| | | | Change-Id: Ib923638c305105e84f79a18a79ece48d391129c5
* Make resource folders customizeableTor Norbye2013-01-043-20/+22
| | | | | | | | | | | | | | | | Until now, lint has hardcoded where the project resources are to be found: in $project/res. With the new build system this will no longer necessarily be the case; there can be multiple resource folders, and the locations might not be just res/. Therefore, this CL generalizes lint's handling of resource folders: it is now provided by the LintClient, and the command line lint tool uses this to offer a new --resources flag which can be used to set the resource directory/directories for a project. Change-Id: I3717c6474141776ee5541d476f9bad5bb8e1a9c7
* Code cleanupTor Norbye2013-01-021-2/+6
| | | | | | | | Fix typos, remove redundant semicolons, fix incorrect names (using an m prefix where they should be using s, turn fields with constant names into actual constants), etc. Change-Id: I44a5ab82c1158007d0803d43ce14b361aff240b8
* Update fragment issue from warning to errorTor Norbye2013-01-021-3/+6
| | | | | | Also update constants to stay in sync with sdk/ version. Change-Id: I8e454a03d83c81036bf8cc73609babc96a9c7739
* 41753: Lint API Check: Consult source files for constantsTor Norbye2013-01-022-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lint currently checks the .class files for field references and method references to APIs that require a version higher than the minSdkVersion in the manifest. However, constants (such as final static integers) will be copied into the .class file, so there is no reference to the original API and its API version, which means lint can't flag these. In some cases, such as referencing LayoutParams.MATCH_PARENT, that's no problem; the constant value works on older versions, and there is no problem, since the value rather than the reference is used. However, in other cases this may lead to runtime crashes. This CL updates lint to look at the source files and flag field references. It excludes some constants that are known to be okay (such as referencing say android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 (which is typically done precisely to conditionally branch based on the current device's version). It also ignores usages as case constants or in conditional if checks. We may need to do additional tweaks to this in the future, since unlike method and field references there are probably many cases where referencing these constants are fine on older devices, but there are also cases where it's dangerous. For now, we're erring on the side of warning the developer rather than being certain that it's not a problem. Change-Id: Ieba4c15d7fdda02756b7b7f5a1b79f7698c1915b
* Prevent circular dependencies in library project dependenciesTor Norbye2012-12-214-8/+114
| | | | Change-Id: Ia43c2436e01032ace7e2b13e59d60d10f71e7004
* Code cleanupTor Norbye2012-12-1219-158/+135
| | | | | | | | Ran some static analysis on the lint code and fixed various issues - some typos, made some fields final, made some methods static, sorted modifier order etc. Change-Id: Ibdcdec5745f040eb7b0880cf6999c0f0ea7f7e6f
* Add lint recycle detectorTor Norbye2012-12-111-4/+4
| | | | | | | | | | | | | | | This lint check looks for missing recycle() calls on resources such as TypedArrays, MotionEvents, and Messages. 41140 New Lint Check: Check Recycling VelocityTracker 41138 New Lint Check: Check Recycling Message 41137 New Lint Check: Check Recycling MotionEvent 41136 New Lint Check: Check Recycling TypedArray In addition, it also flags cases where a method is called on a resource after the resource has been recycled. Change-Id: Ia06a1779519971d5459f1cd98914a6aededc4b83
* Refactor lint folder structure.Xavier Ducrohet2012-12-0633-11/+5
| | | | | | | | | | 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
* Findbugs cleanupTor Norbye2012-12-061-2/+2
| | | | | | | Fix a couple of issues found by findbugs, and some test stability fixes. Change-Id: I97390ea606ea25d6a68e5b7f8245e5e689117995
* Add override detectorTor Norbye2012-11-302-1/+31
| | | | | | | | | | 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
* Add tools:targetApi to control local minSdk (like @TargetApi)Tor Norbye2012-11-301-0/+36
| | | | | | | Also add XML editor quickfix to set the attribute on an API violation. Change-Id: Ife95d73659656e98a6fb1a322354f5fcfcef1888
* Make inefficient weight detector identify more candidatesTor Norbye2012-11-292-3/+51
| | | | | | | | | | | | | | | | | 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
* Add lint check for cut & paste errors in findViewById callsTor Norbye2012-11-271-0/+19
| | | | Change-Id: Ie8ff6629a3e787587516f6fa88c70dfdb7a92d0d
* Lint fix for AOSP unbundledTor Norbye2012-11-201-0/+4
| | | | Change-Id: I306b753319d235b015f44c0927382578805898de
* 39153: lint shows project folder instead of project nameTor Norbye2012-11-053-4/+40
| | | | Change-Id: I415c42e19573bf733de672625a1200e62204ec77
* Update compiler flags.Tor Norbye2012-10-261-2/+2
| | | | | | | | | | Turns off the ability to use @SuppressWarnings with optional errors is available, but off by default (see Eclipse issue 392875). This turns that off, makes missing enums in switch statements a warning, and synchronizes the settings file to all projects (except tests.) Change-Id: Iad7060523b6ee2cbbca97e0a6ffedb264b185222
* Merge "Fix handling of @SuppressLint on fields"Tor Norbye2012-10-222-10/+58
|\
| * Fix handling of @SuppressLint on fieldsTor Norbye2012-10-182-10/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Update maven artifacts and add lint.Xavier Ducrohet2012-10-191-0/+76
|/ | | | | | | | | Updated the groupId of most artifacts to be more reflective of their sub-projects status in the SDK tools. Added lint artifacts. Change-Id: I900a165647a9b7d3c55b473f63c4ca4469762d7b
* 32849: Fix CRLF line ending handling in the partial formatterTor Norbye2012-10-171-0/+7
| | | | | | | | | | | | | | | | | | 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
* Warn about potentially accidentally overriding methodsTor Norbye2012-10-162-1/+18
| | | | Change-Id: Ic8d20a002f6225cb15f609b3b7582716904e9278
* Add lint support for checking frameworks/base/coreTor Norbye2012-10-164-2/+96
| | | | | | | | | | 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
* Check notification and action bar iconsTor Norbye2012-10-052-35/+46
| | | | | | | These icons should not use color (and in the case of notification icons, be white). Change-Id: I32b9422735830a01bb069b90a5ad5a76d7aeb5de
* Fix misc lint bugsTor Norbye2012-10-041-0/+17
| | | | | | | I ran lint over some large projects and manually verified the report; this uncovered a couple of false positives. Change-Id: I006d64a03119c6badc40e33df9ab4079e07dc7c5
* Cache applicable issue lists per scope setTor Norbye2012-09-271-6/+51
| | | | | | | | | | 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
* 37733: TargetAPI doesn't fails to report unsupported APITor Norbye2012-09-252-3/+79
| | | | | | | Make incremental lint in source files use the Eclipse context to find super classes. Change-Id: I31af7a146c259875857026bc7721294205482a91
* Add labelFor lint checkTor Norbye2012-09-171-3/+4
| | | | Change-Id: If2b905197d5d81c6f98315a0d48ff37091e8282b
* Code cleanupTor Norbye2012-09-172-8/+8
| | | | | | Replace "this.mFoo = foo" with just "mFoo = foo". Change-Id: I44d537ebb62cd7e5c8493a0b50dcb527cd20f91c
* Constants refactoring.Tor Norbye2012-09-139-478/+113
| | | | | | | | | | | | | | | | 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
* Add unit test for lint CLITor Norbye2012-09-111-0/+12
| | | | Change-Id: I8434515179b8fd2ee3872506fc237c467a98db44
* Don't report unused resources in projects with errorsTor Norbye2012-09-101-0/+25
| | | | | | | | | | | | | | | | | | | 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
* 36829: Unused resource check does not handle merged manifestsTor Norbye2012-09-062-1/+24
| | | | Change-Id: I88cfbb3c497cc65e3d16c3ba1fe9ceeaf2613103
* 36951: Lint API Level Warnings for Enums are ConfusingTor Norbye2012-09-041-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add lint check for potential string locale errors (issue 36822)Tor Norbye2012-08-291-0/+4
| | | | Change-Id: I320af69286e7f0bcee395419acfeea7ed8f8d384
* Update Guava from 10.0.1 to 13.0.1Tor Norbye2012-08-291-1/+1
| | | | Change-Id: Ia51e3e2280c3d360496550df50a540571b9b7582
* Fix property sheet value completionTor Norbye2012-08-271-0/+7
| | | | | | | | | | | | | | | 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
* Issue 34322: Fix handling of import statementsTor Norbye2012-08-271-0/+45
| | | | | | | | 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
* Use simple markup for bold and monospace in lint issuesTor Norbye2012-08-231-0/+154
| | | | | | | | | 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
* Warn about non-recent targetSdkVersionsTor Norbye2012-08-235-0/+122
| | | | | | | | | | | | | | 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
* Fix class to source mapping for the super() keywordTor Norbye2012-08-212-6/+67
| | | | | | | | | | | | | 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