Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug] [Dynamic Links] Dynamic Links callback in Kotlin incorrectly marked as non-null #2992

@asos-edgeorge

Description

@asos-edgeorge

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Arctic Fox 2020.3.1 patch 2
  • Firebase Component: Dynamic Links KTX
  • Component version: 20.1.1

[REQUIRED] Step 3: Describe the problem

When running the sample code for Dynamic Links in Kotlin, the result of the addOnSuccessListener is not correctly marked as a nullable type, despite it being possible to return as null.

Steps to reproduce:

  • Follow the sample code setup in Kotlin
  • Call the sample code with an intent that doesn't return pendingDynamicLinkData
  • Observe that null is returned for the non-nullable type param of the success callback

Relevant Code:

Firebase.dynamicLinks
        .getDynamicLink(intent)
        .addOnSuccessListener(this) { pendingDynamicLinkData ->

            // **BUG** Android Studio reports this check to always be true
            //  as the typing of pendingDynamicLinkData is not nullable
            if (pendingDynamicLinkData != null) {
               // some code here ...
            }
        }
        .addOnFailureListener(this) { e -> Log.w(TAG, "getDynamicLink:onFailure", e) }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions