public class ApiDetector
extends com.android.tools.lint.detector.api.ResourceXmlDetector
implements com.android.tools.lint.detector.api.SourceCodeScanner, com.android.tools.lint.detector.api.ResourceFolderScanner
com.android.tools.lint.detector.api.Detector.BinaryResourceScanner, com.android.tools.lint.detector.api.Detector.ClassScanner, com.android.tools.lint.detector.api.Detector.GradleScanner, com.android.tools.lint.detector.api.Detector.OtherFileScanner, com.android.tools.lint.detector.api.Detector.ResourceFolderScanner, com.android.tools.lint.detector.api.Detector.UastScanner, com.android.tools.lint.detector.api.Detector.XmlScanner| Modifier and Type | Field and Description |
|---|---|
static com.android.tools.lint.detector.api.Issue |
INLINED
Accessing an inlined API on older platforms
|
protected ApiLookup |
mApiDatabase |
static com.android.tools.lint.detector.api.Issue |
OBSOLETE_SDK
Obsolete SDK_INT version check
|
static com.android.tools.lint.detector.api.Issue |
OVERRIDE
Method conflicts with new inherited method
|
static com.android.support.AndroidxName |
REQUIRES_API_ANNOTATION |
static java.lang.String |
SDK_SUPPRESS_ANNOTATION |
static com.android.tools.lint.detector.api.Issue |
UNSUPPORTED
Accessing an unsupported API
|
static com.android.tools.lint.detector.api.Issue |
UNUSED
Attribute unused on older versions
|
| Constructor and Description |
|---|
ApiDetector()
Constructs a new API check
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
appliesTo(com.android.resources.ResourceFolderType folderType) |
void |
beforeCheckRootProject(com.android.tools.lint.detector.api.Context context) |
void |
checkFolder(com.android.tools.lint.detector.api.ResourceContext context,
java.lang.String folderName) |
protected void |
checkObsoleteSdkVersion(com.android.tools.lint.detector.api.JavaContext context,
org.jetbrains.uast.UElement node) |
com.android.tools.lint.client.api.UElementHandler |
createUastHandler(com.android.tools.lint.detector.api.JavaContext context) |
java.util.Collection<java.lang.String> |
getApplicableAttributes() |
java.util.Collection<java.lang.String> |
getApplicableElements() |
java.util.List<java.lang.Class<? extends org.jetbrains.uast.UElement>> |
getApplicableUastTypes() |
static com.android.tools.lint.detector.api.Location |
getCatchParametersLocation(com.android.tools.lint.detector.api.JavaContext context,
org.jetbrains.uast.UCatchClause catchClause) |
protected int |
getMinSdk(com.android.tools.lint.detector.api.Context context) |
static int |
getTargetApi(org.jetbrains.uast.UElement scope) |
static boolean |
isBenignConstantUsage(org.jetbrains.uast.UElement node,
java.lang.String name,
java.lang.String owner)
Checks whether the given instruction is a benign usage of a constant defined in a later
version of Android than the application's
minSdkVersion. |
static boolean |
isBenignUnusedAttribute(java.lang.String name)
Is the given attribute a "benign" unused attribute, one we probably don't need to flag to the
user as not applicable on all versions? These are typically attributes which add some nice
platform behavior when available, but that are not critical and developers would not
typically need to be aware of to try to implement workarounds on older platforms.
|
static boolean |
isMultiCatchReflectiveOperationException(org.jetbrains.uast.UCatchClause catchClause) |
void |
visitAttribute(com.android.tools.lint.detector.api.XmlContext context,
org.w3c.dom.Attr attribute) |
void |
visitElement(com.android.tools.lint.detector.api.XmlContext context,
org.w3c.dom.Element element) |
afterCheckEachProject, afterCheckFile, afterCheckLibraryProject, afterCheckProject, afterCheckRootProject, analyzeCallGraph, applicableAnnotations, applicableSuperClasses, appliesTo, appliesToResourceRefs, beforeCheckEachProject, beforeCheckFile, beforeCheckLibraryProject, beforeCheckProject, checkBinaryResource, checkCall, checkClass, checkClass, checkDslPropertyAssignment, checkInstruction, checkMethodCall, createPsiVisitor, fix, getApplicableAsmNodeTypes, getApplicableCallNames, getApplicableCallOwners, getApplicableConstructorTypes, getApplicableFiles, getApplicableMethodNames, getApplicablePsiTypes, getApplicableReferenceNames, getCustomVisitor, getSpeed, isApplicableAnnotationUsage, isCallGraphRequired, visitAnnotationUsage, visitAnnotationUsage, visitBuildScript, visitClass, visitClass, visitConstructor, visitConstructor, visitDocument, visitElementAfter, visitMethod, visitMethod, visitMethodCall, visitReference, visitReference, visitResourceReference, visitResourceReferenceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitanalyzeCallGraph, applicableAnnotations, applicableSuperClasses, appliesToResourceRefs, getApplicableConstructorTypes, getApplicableMethodNames, getApplicableReferenceNames, isApplicableAnnotationUsage, isCallGraphRequired, visitAnnotationUsage, visitAnnotationUsage, visitClass, visitClass, visitConstructor, visitMethod, visitMethodCall, visitReference, visitResourceReferencepublic static final com.android.support.AndroidxName REQUIRES_API_ANNOTATION
public static final java.lang.String SDK_SUPPRESS_ANNOTATION
public static final com.android.tools.lint.detector.api.Issue UNSUPPORTED
public static final com.android.tools.lint.detector.api.Issue INLINED
public static final com.android.tools.lint.detector.api.Issue OVERRIDE
public static final com.android.tools.lint.detector.api.Issue UNUSED
public static final com.android.tools.lint.detector.api.Issue OBSOLETE_SDK
protected ApiLookup mApiDatabase
public void beforeCheckRootProject(@NonNull
com.android.tools.lint.detector.api.Context context)
beforeCheckRootProject in class com.android.tools.lint.detector.api.Detectorpublic boolean appliesTo(@NonNull
com.android.resources.ResourceFolderType folderType)
appliesTo in interface com.android.tools.lint.detector.api.ResourceFolderScannerappliesTo in interface com.android.tools.lint.detector.api.XmlScannerappliesTo in class com.android.tools.lint.detector.api.ResourceXmlDetectorpublic java.util.Collection<java.lang.String> getApplicableElements()
getApplicableElements in interface com.android.tools.lint.detector.api.XmlScannergetApplicableElements in class com.android.tools.lint.detector.api.Detectorpublic java.util.Collection<java.lang.String> getApplicableAttributes()
getApplicableAttributes in interface com.android.tools.lint.detector.api.XmlScannergetApplicableAttributes in class com.android.tools.lint.detector.api.Detectorpublic void visitAttribute(@NonNull
com.android.tools.lint.detector.api.XmlContext context,
@NonNull
org.w3c.dom.Attr attribute)
visitAttribute in interface com.android.tools.lint.detector.api.XmlScannervisitAttribute in class com.android.tools.lint.detector.api.Detectorpublic static boolean isBenignUnusedAttribute(@NonNull
java.lang.String name)
public void visitElement(@NonNull
com.android.tools.lint.detector.api.XmlContext context,
@NonNull
org.w3c.dom.Element element)
visitElement in interface com.android.tools.lint.detector.api.XmlScannervisitElement in class com.android.tools.lint.detector.api.Detectorprotected int getMinSdk(com.android.tools.lint.detector.api.Context context)
@Nullable
public com.android.tools.lint.client.api.UElementHandler createUastHandler(@NonNull
com.android.tools.lint.detector.api.JavaContext context)
createUastHandler in interface com.android.tools.lint.detector.api.SourceCodeScannercreateUastHandler in class com.android.tools.lint.detector.api.Detectorpublic java.util.List<java.lang.Class<? extends org.jetbrains.uast.UElement>> getApplicableUastTypes()
getApplicableUastTypes in interface com.android.tools.lint.detector.api.SourceCodeScannergetApplicableUastTypes in class com.android.tools.lint.detector.api.Detectorpublic static boolean isBenignConstantUsage(@Nullable
org.jetbrains.uast.UElement node,
@NonNull
java.lang.String name,
@NonNull
java.lang.String owner)
minSdkVersion.node - the instruction to checkname - the name of the constantowner - the field ownerpublic static int getTargetApi(@Nullable
org.jetbrains.uast.UElement scope)
protected void checkObsoleteSdkVersion(@NonNull
com.android.tools.lint.detector.api.JavaContext context,
@NonNull
org.jetbrains.uast.UElement node)
public void checkFolder(@NonNull
com.android.tools.lint.detector.api.ResourceContext context,
@NonNull
java.lang.String folderName)
checkFolder in interface com.android.tools.lint.detector.api.ResourceFolderScannercheckFolder in class com.android.tools.lint.detector.api.Detectorpublic static com.android.tools.lint.detector.api.Location getCatchParametersLocation(com.android.tools.lint.detector.api.JavaContext context,
org.jetbrains.uast.UCatchClause catchClause)
public static boolean isMultiCatchReflectiveOperationException(org.jetbrains.uast.UCatchClause catchClause)