Skip to content

Commit

Permalink
Analysis: Resolve unnecessary safe call type warning
Browse files Browse the repository at this point in the history
Warning Message: "Unnecessary safe call on a non-null receiver of type
CharSequence. This expression will have nullable type in future
releases"

The 'mPositiveButtonLabel' is being reverted back to being a nullable
field, that is, instead of it being a 'lateinit' non-null field.

PS: This field was nullable in the past, but this
24a0532 commit made it into
'lateinit' non-null.
  • Loading branch information
ParaskP7 committed Sep 23, 2022
1 parent 01c90d2 commit e053210
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
class GutenbergDialogFragment : AppCompatDialogFragment() {
private lateinit var mTag: String
private lateinit var mMessage: CharSequence
private lateinit var mPositiveButtonLabel: CharSequence
private var mPositiveButtonLabel: CharSequence? = null
private var mTitle: CharSequence? = null
private var mNegativeButtonLabel: CharSequence? = null
private var mId: Int = 0
Expand Down Expand Up @@ -56,7 +56,7 @@ class GutenbergDialogFragment : AppCompatDialogFragment() {
mTag = requireNotNull(savedInstanceState.getString(STATE_KEY_TAG))
mTitle = savedInstanceState.getCharSequence(STATE_KEY_TITLE)
mMessage = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_MESSAGE))
mPositiveButtonLabel = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL))
mPositiveButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL)
mNegativeButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL)
mId = savedInstanceState.getInt(STATE_KEY_ID)
}
Expand Down

0 comments on commit e053210

Please sign in to comment.