Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataconnect: relax variance of the NullableReference type parameter to covariant (was invariant) #6511

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
*/
package com.google.firebase.dataconnect.util

internal class NullableReference<T>(val ref: T? = null) {
/**
* A class that simply wraps a reference to another object, possibly a null reference. Instances of
* this class can be useful for the case where the meaning of `null` is overloaded, such as
* [kotlinx.coroutines.flow.MutableStateFlow.compareAndSet].
*/
internal class NullableReference<out T>(val ref: T? = null) {
override fun equals(other: Any?) = (other is NullableReference<*>) && other.ref == ref
override fun hashCode() = ref?.hashCode() ?: 0
override fun toString() = ref?.toString() ?: "null"
Expand Down
Loading