public class CleanupDetector
extends com.android.tools.lint.detector.api.Detector
implements com.android.tools.lint.detector.api.Detector.UastScanner
recycle
calls on resources that encourage it, and
for missing commit
calls on FragmentTransactions, etc.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.JavaPsiScanner, com.android.tools.lint.detector.api.Detector.JavaScanner, 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 java.lang.String |
ANDROID_CONTENT_SHARED_PREFERENCES |
static com.android.tools.lint.detector.api.Issue |
APPLY_SHARED_PREF
Using commit instead of apply on a shared preference
|
static com.android.tools.lint.detector.api.Issue |
COMMIT_FRAGMENT
Problems with missing commit calls.
|
static java.lang.String |
CONTENT_PROVIDER_CLIENT_CLS |
static java.lang.String |
CONTENT_RESOLVER_CLS |
static java.lang.String |
CURSOR_CLS |
static java.lang.String |
MOTION_EVENT_CLS |
static com.android.tools.lint.detector.api.Issue |
RECYCLE_RESOURCE
Problems with missing recycle calls
|
static com.android.tools.lint.detector.api.Issue |
SHARED_PREF
Failing to commit a shared preference
|
static java.lang.String |
SQLITE_DATABASE_CLS |
static java.lang.String |
SURFACE_CLS |
static java.lang.String |
SURFACE_TEXTURE_CLS |
Constructor and Description |
---|
CleanupDetector()
Constructs a new
CleanupDetector |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
getApplicableConstructorTypes() |
java.util.List<java.lang.String> |
getApplicableMethodNames() |
static com.intellij.psi.PsiVariable |
getVariableElement(org.jetbrains.uast.UCallExpression rhs)
Returns the variable the expression is assigned to, if any
|
static com.intellij.psi.PsiVariable |
getVariableElement(org.jetbrains.uast.UCallExpression rhs,
boolean allowChainedCalls,
boolean allowFields) |
void |
visitConstructor(com.android.tools.lint.detector.api.JavaContext context,
org.jetbrains.uast.UCallExpression node,
com.intellij.psi.PsiMethod constructor) |
void |
visitMethod(com.android.tools.lint.detector.api.JavaContext context,
org.jetbrains.uast.UCallExpression call,
com.intellij.psi.PsiMethod method) |
afterCheckFile, afterCheckLibraryProject, afterCheckProject, applicableSuperClasses, appliesTo, appliesTo, appliesToResourceRefs, beforeCheckFile, beforeCheckLibraryProject, beforeCheckProject, checkBinaryResource, checkCall, checkClass, checkClass, checkClass, checkFolder, checkInstruction, createJavaVisitor, createPsiVisitor, createUastHandler, getApplicableAsmNodeTypes, getApplicableAttributes, getApplicableCallNames, getApplicableCallOwners, getApplicableElements, getApplicableFiles, getApplicableNodeTypes, getApplicablePsiTypes, getApplicableReferenceNames, getApplicableUastTypes, getSpeed, getSpeed, run, visitAttribute, visitBuildScript, visitClass, visitClass, visitConstructor, visitConstructor, visitDocument, visitElement, visitElementAfter, visitMethod, visitMethod, visitReference, visitReference, visitResourceReference, visitResourceReference, visitResourceReference
public static final com.android.tools.lint.detector.api.Issue RECYCLE_RESOURCE
public static final com.android.tools.lint.detector.api.Issue COMMIT_FRAGMENT
public static final com.android.tools.lint.detector.api.Issue SHARED_PREF
public static final com.android.tools.lint.detector.api.Issue APPLY_SHARED_PREF
public static final java.lang.String MOTION_EVENT_CLS
public static final java.lang.String SURFACE_CLS
public static final java.lang.String SURFACE_TEXTURE_CLS
public static final java.lang.String CONTENT_PROVIDER_CLIENT_CLS
public static final java.lang.String CONTENT_RESOLVER_CLS
public static final java.lang.String SQLITE_DATABASE_CLS
public static final java.lang.String CURSOR_CLS
public static final java.lang.String ANDROID_CONTENT_SHARED_PREFERENCES
public CleanupDetector()
CleanupDetector
@Nullable public java.util.List<java.lang.String> getApplicableMethodNames()
getApplicableMethodNames
in interface com.android.tools.lint.detector.api.Detector.UastScanner
getApplicableMethodNames
in class com.android.tools.lint.detector.api.Detector
@Nullable public java.util.List<java.lang.String> getApplicableConstructorTypes()
getApplicableConstructorTypes
in interface com.android.tools.lint.detector.api.Detector.UastScanner
getApplicableConstructorTypes
in class com.android.tools.lint.detector.api.Detector
public void visitMethod(@NonNull com.android.tools.lint.detector.api.JavaContext context, @NonNull org.jetbrains.uast.UCallExpression call, @NonNull com.intellij.psi.PsiMethod method)
visitMethod
in interface com.android.tools.lint.detector.api.Detector.UastScanner
visitMethod
in class com.android.tools.lint.detector.api.Detector
public void visitConstructor(@NonNull com.android.tools.lint.detector.api.JavaContext context, @NonNull org.jetbrains.uast.UCallExpression node, @NonNull com.intellij.psi.PsiMethod constructor)
visitConstructor
in interface com.android.tools.lint.detector.api.Detector.UastScanner
visitConstructor
in class com.android.tools.lint.detector.api.Detector
@Nullable public static com.intellij.psi.PsiVariable getVariableElement(@NonNull org.jetbrains.uast.UCallExpression rhs)
@Nullable public static com.intellij.psi.PsiVariable getVariableElement(@NonNull org.jetbrains.uast.UCallExpression rhs, boolean allowChainedCalls, boolean allowFields)