aboutsummaryrefslogtreecommitdiffstats
path: root/lint/libs
Commit message (Collapse)AuthorAgeFilesLines
...
| * 37702: InconsistentArrays fails to identify inconsistent arraysTor Norbye2012-09-254-30/+75
| | | | | | | | Change-Id: I47d3757cac4b9204bdb15a84a8679921adc049a3
* | 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
* Don't flag missing classes if project has not been built yetTor Norbye2012-09-242-1/+19
| | | | | | | | | | | | | | | The missing class detector in lint will warn if the manifest file contains references to class files and lint does not see those class files in the class output folder (or in any of the library jars). This is useful for catching typos and deleted classes. However, if you run lint on a project that has not yet been built, this can give misleading or confusing errors, since lint decides that a class exists by whether a .class file is actually there, not by whether a source file exists which would result in a class file getting produced with that name. Change-Id: I3105157a37f575e00b550ba90d883f24c02c16a9
* Fix missing class detector to work for incremental manifest editsTor Norbye2012-09-243-3/+41
| | | | | | | | | | | | | The missing manifest detector provides multiple issues; both the missing class detector (which requires not just manifest scope but also class scope), as well as some checks to ensure that for example inner classes are registered correctly, which only requires manifest scope. Because of this second issue, the detector runs in incremental manifest editing context, but the code to handle missing classes would also run. The check is simple; don't check missing class references unless we also have class scope. Change-Id: Iff83c372abf2335e3d8e991740702d6094fd65bd
* Add allowBackup lint security checkTor Norbye2012-09-215-1/+126
| | | | Change-Id: I3b79bef6981d880fe6a545429754e03bd384645c
* Rename ide_common to sdk_commonSiva Velusamy2012-09-181-1/+1
| | | | Change-Id: I1b39ee439a532f3f6758be35b569948e2e906665
* Add labelFor lint checkTor Norbye2012-09-177-4/+360
| | | | Change-Id: If2b905197d5d81c6f98315a0d48ff37091e8282b
* Code cleanupTor Norbye2012-09-174-10/+10
| | | | | | Replace "this.mFoo = foo" with just "mFoo = foo". Change-Id: I44d537ebb62cd7e5c8493a0b50dcb527cd20f91c
* Constants refactoring.Tor Norbye2012-09-1360-910/+545
| | | | | | | | | | | | | | | | 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 lint flag for setting a custom library pathTor Norbye2012-09-111-1/+95
| | | | Change-Id: Ie36bcb31be87a7cd16ab1b958c0264ca8b51e385
* Merge "Add unit test for lint CLI"Tor Norbye2012-09-114-3/+198
|\
| * Add unit test for lint CLITor Norbye2012-09-114-3/+198
| | | | | | | | Change-Id: I8434515179b8fd2ee3872506fc237c467a98db44
* | Work around missing DOM method implementation in Eclipe 3.6Tor Norbye2012-09-111-1/+1
|/ | | | Change-Id: I67b37a0511dfba210dbcef393ee7610cef8b56a2
* Fix false positives in field getter lint checkTor Norbye2012-09-104-0/+73
| | | | Change-Id: If341cde0f0600c5975c6e847e228d72f5deefb23
* Don't report unused resources in projects with errorsTor Norbye2012-09-104-1/+45
| | | | | | | | | | | | | | | | | | | 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
* 37001: Lint check: non existing Activity/Service/ReceiverTor Norbye2012-09-1016-10/+661
| | | | Change-Id: I6c281183a176210a6991e81497d9fb242c3851bd
* 36829: Unused resource check does not handle merged manifestsTor Norbye2012-09-066-2/+110
| | | | Change-Id: I88cfbb3c497cc65e3d16c3ba1fe9ceeaf2613103
* Merge "36951: Lint API Level Warnings for Enums are Confusing"Tor Norbye2012-09-046-14/+281
|\
| * 36951: Lint API Level Warnings for Enums are ConfusingTor Norbye2012-09-046-14/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | 36942: tools:ignore="DuplicateActivity" just doesn'tTor Norbye2012-09-037-8/+41
|/ | | | Change-Id: Iffd270a227a8a76636cbfa5d19c6e0330a8391fb
* Merge "Suggest using SparseIntArray instead of SparseArray<Integer>"Tor Norbye2012-08-303-3/+40
|\
| * Suggest using SparseIntArray instead of SparseArray<Integer>Tor Norbye2012-08-293-3/+40
| | | | | | | | Change-Id: I95bf3bc87e4378af6ef866df0a1ffb69f8fd7a41
* | Also check SimpleDateFormat calls for explicit localeTor Norbye2012-08-305-12/+78
|/ | | | | | | | | | | 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
* Add lint rule to find incorrect alias filesTor Norbye2012-08-293-1/+113
| | | | | | | This helps catch errors like http://code.google.com/p/android/issues/detail?id=36821 Change-Id: I1ceda3183d8b1e29510ba0be2523dc6eb9c7a23b
* Add lint check for potential string locale errors (issue 36822)Tor Norbye2012-08-2910-10/+360
| | | | Change-Id: I320af69286e7f0bcee395419acfeea7ed8f8d384
* Merge "Minor tweaks and typos"Tor Norbye2012-08-291-1/+1
|\
| * Minor tweaks and typosTor Norbye2012-08-281-1/+1
| | | | | | | | Change-Id: I46630c51a4f055222fb614d73419cb28272b87de
* | Update Guava from 10.0.1 to 13.0.1Tor Norbye2012-08-293-3/+3
|/ | | | Change-Id: Ia51e3e2280c3d360496550df50a540571b9b7582
* Merge "Add lint rule which warns about View.setTag(int, Object)"Tor Norbye2012-08-286-1/+285
|\
| * Add lint rule which warns about View.setTag(int, Object)Tor Norbye2012-08-276-1/+285
| | | | | | | | | | | | | | | | | | | | | | 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
* | Fix property sheet value completionTor Norbye2012-08-272-6/+15
|/ | | | | | | | | | | | | | | 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-277-3/+209
| | | | | | | | 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
* Merge "Use simple markup for bold and monospace in lint issues"Tor Norbye2012-08-2741-139/+517
|\
| * Use simple markup for bold and monospace in lint issuesTor Norbye2012-08-2341-139/+517
| | | | | | | | | | | | | | | | | | 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
* | Merge "Warn about non-recent targetSdkVersions"Tor Norbye2012-08-2719-225/+309
|\ \ | |/
| * Warn about non-recent targetSdkVersionsTor Norbye2012-08-2319-225/+309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Lint: IconDetector - catch more cases in 3.0Marius Volkhart2012-08-271-2/+7
|/ | | | | | | | 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
* Tweak API check error messages for constructorsTor Norbye2012-08-212-13/+15
| | | | | | | | | | 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
* Fix class to source mapping for the super() keywordTor Norbye2012-08-216-7/+105
| | | | | | | | | | | | | 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
* More refactoring.Xavier Ducrohet2012-08-133-3/+1
| | | | | | | Move stuff out of sdklib into common and ide_common. Remove androidprefs and move the one class into common. Change-Id: I71d126a13cf2ba413692e29616f4968a37d7b33a
* Recommend java.lang.Math instead of android.util.FloatMathTor Norbye2012-08-094-65/+56
| | | | | | | | | 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
* 36175: Lint crashes with java.nio.BufferUnderflowExceptionTor Norbye2012-08-092-10/+137
| | | | | | | This CL adds some code to more gracefully handle problems with the Api Checker's binary cache. Change-Id: I02c86ab16b857b88df8945c84cb92c7217a6144a
* Update lint test project for common refactoringTor Norbye2012-08-083-6/+7
| | | | Change-Id: Id96616abe9be2a994b642808164b092c04ae8a0c
* Refactor common.jarXavier Ducrohet2012-08-0713-21/+25
| | | | | | | | | | | | | | | 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
* Update lint unit test golden files to contain more detailsTor Norbye2012-08-0661-739/+1868
| | | | | | | | | | | | | | | | | | | | The lint golden files was using a custom unit test reporter which wrote out the test strings in alphabetical order. However, this output was missing some information such as the actual source lines containing the error and the particular error range underlined, which the CLI prints. This changeset replaces the unit test reporter with the CLI one, which not only has the benefit of providing more details in the unit tests (which for example shows that bytecode based issues correctly identify the right source level range), but it also tests the CLI reporter itself such as its sorting. Other than a minor fix to handling \r's in the CLI error output, this changeset does not contain any changes to any of the lint detectors, it just updates the golden files. Change-Id: Iae8f13a47efe6ba5e5cfd84af0dd548f78513879
* 35875: Lint too strict about translating strings by default.Tor Norbye2012-08-066-5/+112
| | | | | | | | | | | | | | | | | | 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
* Merge "Allow lint cli --sources to specify a path, and use from ant lint"Tor Norbye2012-08-062-0/+65
|\
| * Allow lint cli --sources to specify a path, and use from ant lintTor Norbye2012-08-062-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Add support for additional languages in the typo detector"Tor Norbye2012-08-068-141/+805
|\ \
| * | Add support for additional languages in the typo detectorTor Norbye2012-08-038-141/+805
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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