Skip to content

RELEASE. Fix problem with lintOptions(NullSafeMutableLiveData) #344

@mnewlive

Description

@mnewlive
  1. Remove from build.gradle abortOnError false
  2. Pay attention to the problem areas in the code and solve them:
  • sca-authenticator-android/app/src/main/kotlin/com/saltedge/authenticator/features/authorizations/details/AuthorizationDetailsViewModel.kt:131: Error: Expected non-nullable value [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.1]
    else authorizationModel.postValue(data)
    ~~~~

  • sca-authenticator-android/app/src/main/kotlin/com/saltedge/authenticator/features/launcher/LauncherViewModel.kt:61: Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.1]

              onInitializationSuccess.value = null
                                              ~~~~
    
  • /sca-authenticator-android/app/src/main/kotlin/com/saltedge/authenticator/features/launcher/LauncherViewModel.kt:66: Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.1]

              onDbInitializationFail.value = null
                                             ~~~~
    

    Explanation for issues of type "NullSafeMutableLiveData":
    This check ensures that LiveData values are not null when explicitly
    declared as non-nullable.

    Kotlin interoperability does not support enforcing explicit
    null-safety when using generic Java type parameters. Since
    LiveData is a Java class its value can always be null even
    when its type is explicitly declared as non-nullable. This can lead
    to runtime exceptions from reading a null LiveData value that is
    assumed to be non-nullable.

    Vendor: Android Open Source Project (jetified-lifecycle-livedata-core-ktx-2.3.1)
    Identifier: jetified-lifecycle-livedata-core-ktx-2.3.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions