aboutsummaryrefslogtreecommitdiffstats
path: root/lint/libs
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-01-27 19:49:51 -0800
committerTor Norbye <tnorbye@google.com>2013-01-28 08:09:37 -0800
commit0a6fd7387c281876ed719189058da4b5dbf30cc9 (patch)
tree9f8b5d8bdc12f85e90a570ed740a7820f49ceaa3 /lint/libs
parent2a5744a8074f054a2ea60f6b344ad67fd58aeffb (diff)
downloadsdk-0a6fd7387c281876ed719189058da4b5dbf30cc9.zip
sdk-0a6fd7387c281876ed719189058da4b5dbf30cc9.tar.gz
sdk-0a6fd7387c281876ed719189058da4b5dbf30cc9.tar.bz2
Fix API check via support library
This CL fixes the API check such that it properly handles calls in the Android support library (android.support.*). There was an optimization to skip looking up inherited API calls once the API checker reaches the android.* namespace, since at that point all the inherited methods are inlined in the database, but this should not be done if the package starts with android.support.*, since those methods still could be inheriting from the Android APIs without appearing in the database. Change-Id: Iab7b9f98daa5507794a0673a8db53ce953f2bcd9
Diffstat (limited to 'lint/libs')
-rw-r--r--lint/libs/lint_checks/src/main/java/com/android/tools/lint/checks/ApiDetector.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/lint/libs/lint_checks/src/main/java/com/android/tools/lint/checks/ApiDetector.java b/lint/libs/lint_checks/src/main/java/com/android/tools/lint/checks/ApiDetector.java
index 146e9e1..cc2b212 100644
--- a/lint/libs/lint_checks/src/main/java/com/android/tools/lint/checks/ApiDetector.java
+++ b/lint/libs/lint_checks/src/main/java/com/android/tools/lint/checks/ApiDetector.java
@@ -461,9 +461,10 @@ public class ApiDetector extends ResourceXmlDetector
while (owner != null) {
// For virtual dispatch, walk up the inheritance chain checking
// each inherited method
- if (owner.startsWith("android/") //$NON-NLS-1$
- || owner.startsWith("java/") //$NON-NLS-1$
- || owner.startsWith("javax/")) { //$NON-NLS-1$
+ if ((owner.startsWith("android/") //$NON-NLS-1$
+ && !owner.startsWith("android/support/")) //$NON-NLS-1$
+ || owner.startsWith("java/") //$NON-NLS-1$
+ || owner.startsWith("javax/")) { //$NON-NLS-1$
frameworkParent = owner;
break;
}
@@ -628,7 +629,13 @@ public class ApiDetector extends ResourceXmlDetector
|| owner.startsWith("javax/")) { //$NON-NLS-1$
// The API map has already inlined all inherited methods
// so no need to keep checking up the chain
- owner = null;
+ // -- unless it's the support library which is also in
+ // the android/ namespace:
+ if (owner.startsWith("android/support/")) { //$NON-NLS-1$
+ owner = context.getDriver().getSuperClass(owner);
+ } else {
+ owner = null;
+ }
} else if (owner.startsWith("java/")) { //$NON-NLS-1$
if (owner.equals(LocaleDetector.DATE_FORMAT_OWNER)) {
checkSimpleDateFormat(context, method, node, minSdk);