Class ExposeAsStateFlowDetector
-
- All Implemented Interfaces:
-
com.android.tools.lint.detector.api.Detector.UastScanner,com.android.tools.lint.detector.api.FileScanner,com.android.tools.lint.detector.api.SourceCodeScanner
public final class ExposeAsStateFlowDetector extends Detector implements Detector.UastScannerEnsures that MutableStateFlow is not exposed directly as StateFlow.
Problematic: private val _state = MutableStateFlow(initial) val state: StateFlow<State> = _state // can be downcast to MutableStateFlow and mutated val state: StateFlow<State> get() = _state
Correct: private val _state = MutableStateFlow(initial) val state: StateFlow<State> = _state.asStateFlow() val state: StateFlow<State> get() = _state.asStateFlow()
-
-
Field Summary
Fields Modifier and Type Field Description public final static IssueISSUEprivate final BooleancustomVisitor
-
Constructor Summary
Constructors Constructor Description ExposeAsStateFlowDetector()
-
Method Summary
Modifier and Type Method Description List<Class<out UElement>>getApplicableUastTypes()UElementHandlercreateUastHandler(JavaContext context)-
Methods inherited from class com.android.tools.lint.detector.api.Detector
afterCheckEachProject, afterCheckFile, afterCheckLibraryProject, afterCheckProject, afterCheckRootProject, analyzeCallGraph, applicableAnnotations, applicableSuperClasses, appliesTo, appliesTo, appliesToResourceRefs, beforeCheckEachProject, beforeCheckFile, beforeCheckLibraryProject, beforeCheckProject, beforeCheckRootProject, checkBinaryResource, checkCall, checkClass, checkClass, checkDslPropertyAssignment, checkDslPropertyAssignment, checkFolder, checkInstruction, checkMergedProject, checkMethodCall, checkMethodCall, checkPartialResults, createPsiVisitor, filterIncident, getApplicableAsmNodeTypes, getApplicableAttributes, getApplicableCallNames, getApplicableCallOwners, getApplicableConstructorTypes, getApplicableElements, getApplicableFiles, getApplicableMethodNames, getApplicablePsiTypes, getApplicableReferenceNames, getCustomVisitor, getSpeed, inheritAnnotation, isApplicableAnnotationUsage, isCallGraphRequired, run, sameMessage, visitAnnotationUsage, visitAnnotationUsage, visitAnnotationUsage, visitAnnotationUsage, visitAttribute, visitBuildScript, visitBuildScript, visitClass, visitClass, visitConstructor, visitConstructor, visitDocument, visitElement, visitElementAfter, visitMethod, visitMethod, visitMethodCall, visitReference, visitReference, visitResourceReference, visitResourceReference -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getApplicableUastTypes
List<Class<out UElement>> getApplicableUastTypes()
-
createUastHandler
UElementHandler createUastHandler(JavaContext context)
-
-
-
-