What does this mean?


#1

package com.silverkeytech.android_rivers.db

//hold one value
public class QueryOne<T>(private val item: T?, private val e: Exception? = null){
  public val exists: Boolean = item != null && e == null
  public val value: T? = item
  public val exception: Exception? = e
}

This code generates the following warning

‘T’ has a nullable upper bound. This means that a value of this type may be null. Using ‘T?’ is likely to mislead the reader

I need the class to be able to receive null at instatioan - is there any other way to do it without the warning?


#2

You need to make T reject nullable types:

``

public class QueryOne<T: Any> …