aboutsummaryrefslogtreecommitdiffstats
path: root/lint/libs
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge "Improve Maven defaults in lint"Tor Norbye2012-08-061-12/+38
|\ \ \ | | |/ | |/|
| * | Improve Maven defaults in lintTor Norbye2012-08-061-12/+38
| |/ | | | | | | Change-Id: I3c7c13437403fb1392343af079afab9434695566
* | 35804: When importantForAccessibility="no" is set, don't warnTor Norbye2012-08-033-2/+13
|/ | | | | | | | | | | | 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
* Merge "Allow custom source and class folders"Tor Norbye2012-08-021-0/+7
|\
| * Allow custom source and class foldersTor Norbye2012-08-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Include additional metadata in the XML reportTor Norbye2012-08-021-0/+140
|/ | | | | | | | | | | | This CL adds additional metadata into the lint XML report, such as the full issue explanation, the issue priority, the issue summary, the additional information URL, and the error line. This allows for example the Jenkins plugin to provide all this information for a build report without having to bundle a (possibly out of date) snapshot of lint's metadata the way it does right now. Change-Id: Iaf674ffa6bbef318ce3f636404d72c74de4b1c50
* Fix lint-on-save for .class file detectors in Java filesTor Norbye2012-08-016-11/+90
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Multilingual typo checkerTor Norbye2012-07-317-126/+416
| | | | | | | This changeset generalizes the lint typo checker to handle non-ASCII languages (with UTF-8 encoded typo dictionaries). Change-Id: If21a2047a127848db77d9ec6f9aae3c052e0f288
* Merge "Fix 35171: ExportedReceiver flags app widget receivers"Tor Norbye2012-07-304-11/+63
|\
| * Fix 35171: ExportedReceiver flags app widget receiversTor Norbye2012-07-244-11/+63
| | | | | | | | Change-Id: I0e2959c4183d0063b66ec4ade98029a0e3e17c9d
* | Merge "26501: Handle padding between image and text"Tor Norbye2012-07-271-1/+2
|\ \
| * | 26501: Handle padding between image and textTor Norbye2012-07-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | 35588: @SuppressLint does not work on constructors in Java filesTor Norbye2012-07-2712-45/+87
|/ / | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Improve handling of library projects in lint"Tor Norbye2012-07-249-29/+222
|\ \
| * | Improve handling of library projects in lintTor Norbye2012-07-249-29/+222
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix String#format checksTor Norbye2012-07-233-16/+43
|/ | | | Change-Id: I83023903a7744b1372a832dfdc56b595c21f4902
* BuildfixTor Norbye2012-07-231-1/+1
| | | | Change-Id: I789b086fff06e3b0106995a80dcdb96608447fb6
* Merge "Tweaks to the lint CLI offsets"Tor Norbye2012-07-235-24/+29
|\
| * Tweaks to the lint CLI offsetsTor Norbye2012-07-235-24/+29
| | | | | | | | Change-Id: I20592372d41235b36227a0d36014d77c23c7fc58
* | Merge "35049: @SuppressLint("NewApi") doesn't work on local variables"Tor Norbye2012-07-235-1/+254
|\ \
| * | 35049: @SuppressLint("NewApi") doesn't work on local variablesTor Norbye2012-07-235-1/+254
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Make the px and sp lint checks look at style textnodes too"Tor Norbye2012-07-233-0/+116
|\ \ | |/ |/|
| * Make the px and sp lint checks look at style textnodes tooTor Norbye2012-07-173-0/+116
| | | | | | | | Change-Id: I0535f8f59e5db4087677702916b95fb06b7b67d0
* | Add basic flow analysis support to lintTor Norbye2012-07-2315-9/+803
| | | | | | | | | | | | | | | | | | | | | | 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
* | Add lint checks for wakelock and secure random problemsTor Norbye2012-07-2311-1/+443
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds new two lint bytecode-based detectors. The WakelockDetector looks for problems with wakelocks: - Calling release() in onDestroy() rather than in onPause() - Calling acquire() but never calling release() anywhere in the app. The SecureRandomDetector looks for problems with the SecureRandom random number generator: - Calling setSeed() with a fixed number, such as a string literal, or something equivalent (such as a static field reference of this or some other class) - Calling setSeed() and passing in System.nanoTime or currentTimeMillis since these are considered predictable seeds. These are both using the new fast-dispatch mechanism for bytecode detectors in lint. In both cases, there are more complex control flow we should be checking using flow analysis; that's for an upcoming CL where we add ASM's analysis library. Change-Id: Iec2a95b042b8a3e4e976923cc62e9dccf2dfeca5
* | Add bytecode method call dispatch for lint rulesTor Norbye2012-07-2315-226/+552
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Fixed test cases for exported services that previously used wrong ↵Tor Norbye2012-07-201-2/+2
|\ \ | | | | | | | | | test input files."
| * | Fixed test cases for exported services that previously used wrong test input ↵Sebastian Porst2012-06-131-2/+2
| | | | | | | | | | | | | | | | | | files. Change-Id: I8e0f8986da5be6a640a8aadb44f9f7c364c84bce
* | | Added a lint check that makes sure no private keys are packaged in an app.Sebastian Porst2012-07-194-1/+184
| | | | | | | | | | | | Change-Id: I65d7064efb36002713a3083378af9200331ce793
* | | 35190: Lint doesn't detect illegal API usage in constructorTor Norbye2012-07-196-7/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Constructors are not like methods: they are not inherited into subclasses. The Lint API check needed some special handling of constructors to avoid this, since it was looking up inherited constructors and treating them as accessible. In particular that meant it wouldn't flag new IOException(Throwable) as requiring API 9, since its superclass had a constructor which also took a Throwable (with API 1). Change-Id: I268752be506f12399ce4855d2cf7bec76012e4c2
* | | Merge "35054: lint reports resources as unused when used in plurals"Tor Norbye2012-07-175-1/+29
|\ \ \ | |_|/ |/| |
| * | 35054: lint reports resources as unused when used in pluralsTor Norbye2012-07-175-1/+29
| | | | | | | | | | | | Change-Id: Id437ef30e1488c96a46ccea45459694fd23db582
* | | Merge "Detect incorrect state lists"Tor Norbye2012-07-173-13/+101
|\ \ \
| * | | Detect incorrect state listsTor Norbye2012-07-173-13/+101
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lint already had a check for <selector> lists where it detects the case where you have an empty child not in the last position; this will match everything, and hide all subsequent states. This changeset generalizes this check: It makes sure that no state is fully matched by a previous state. Change-Id: I43b80beb531e68008d82f6c620739ca179d0f8f8
* | | Change field getter threshold from API 8 to API 9Tor Norbye2012-07-161-5/+5
|/ / | | | | | | | | | | | | The Dalvik optimization to automatically inline getters was introduced in Gingerbread, not Froyo. Change-Id: If14288aa398206d4eebfa57ccc7ddfabc6dde83d
* | Add code completion and API checks for theme references (?attr)Tor Norbye2012-07-164-15/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Make API check also look at <view> tagsTor Norbye2012-07-163-0/+41
| | | | | | | | Change-Id: I3d1e4e75aef44886185521fca57bc54b0b1e7cc0
* | Only report field getter issues when targeting pre-Froyo targetsTor Norbye2012-07-162-4/+25
| | | | | | | | Change-Id: Ibc8756c2580a9e263b63b3507224acdf09f264ed
* | Improvements to bytecode-to-source offset computationTor Norbye2012-07-1615-66/+317
| | | | | | | | | | | | | | | | 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
* | Prevent exceptions for invalid project definitionsTor Norbye2012-07-031-0/+3
| | | | | | | | Change-Id: Ie2b5929a87144c77f1ce0d43b2520cc498df5081
* | Merge "Add lint check for usages of dp instead of sp for textSizes"Tor Norbye2012-07-024-9/+79
|\ \
| * | Add lint check for usages of dp instead of sp for textSizesTor Norbye2012-07-024-9/+79
| | | | | | | | | | | | Change-Id: I9cc1899491b49dbc9e62287dd23efd0efa128fce
* | | Merge "33985: Persistent errors in Java files"Tor Norbye2012-07-021-0/+5
|\ \ \
| * | | 33985: Persistent errors in Java filesTor Norbye2012-07-021-0/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "- Fixed a bug in the lint check for unprotected broadcast receivers ↵Tor Norbye2012-07-023-1/+47
|\ \ \ | | | | | | | | | | | | to ignore unprotected receivers for default Android actions."
| * | | - Fixed a bug in the lint check for unprotected broadcast receivers to ↵Sebastian Porst2012-07-023-1/+47
| |/ / | | | | | | | | | | | | | | | ignore unprotected receivers for default Android actions. Change-Id: I4c5c72e25d299fbfb9b13140aae9b14650166313
* | | 33792: UseCompoundDrawables incorrectly flags if scaleType is usedTor Norbye2012-07-024-0/+36
| | | | | | | | | | | | Change-Id: I3499900277b108ac9d2a214d1078a20d29409c5a
* | | Fix lint attribute positions in the CLITor Norbye2012-07-021-1/+1
|/ / | | | | | | Change-Id: I795a93b5d4b3041ba9892d5d3eb226de1873a88c
* | Add typo detectorTor Norbye2012-06-229-1/+926
| | | | | | | | | | | | | | | | | | | | | | This changeset adds a new typo detector. There are also some lint infrastructure fixes to better handle positions within text nodes, and to allow Eclipse lint quickfixes to supply multiple fixes for a single issue (such as multiple misspelling alternative replacements.) Change-Id: Ie26f0bafc571e02ae09ff27a7f4b221fe0c2ea5b
* | Launcher activities are not flagged as unprotected anymore if they are not ↵Sebastian Porst2012-06-152-1/+29
|/ | | | | | protected by permissions. Change-Id: I4811757779ca8048cd84f51173d8325d9f4af3d7