Minor: narrow deprecation scope of DataFlowValueFactoryImpl to constructor

This commit is contained in:
Dmitry Savvinov
2018-06-21 11:13:44 +03:00
parent 8964b2c7a4
commit fa72198505
@@ -23,8 +23,9 @@ import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils
import org.jetbrains.kotlin.types.isError
@Deprecated("Please, avoid to use that implementation explicitly. If you need DataFlowValueFactory, use injection")
class DataFlowValueFactoryImpl : DataFlowValueFactory {
class DataFlowValueFactoryImpl
@Deprecated("Please, avoid to use that implementation explicitly. If you need DataFlowValueFactory, use injection") constructor() :
DataFlowValueFactory {
// Receivers
override fun createDataFlowValue(
@@ -89,11 +90,11 @@ class DataFlowValueFactoryImpl : DataFlowValueFactory {
KotlinBuiltIns.isNullableNothing(type) ->
DataFlowValue.nullValue(containingDeclarationOrModule.builtIns) // 'null' is the only inhabitant of 'Nothing?'
// In most cases type of `E!!`-expression is strictly not nullable and we could get proper Nullability
// by calling `getImmanentNullability` (as it happens below).
//
// But there are some problem with types built on type parameters, e.g.
// fun <T : Any?> foo(x: T) = x!!.hashCode() // there no way in type system to denote that `x!!` is not nullable
// In most cases type of `E!!`-expression is strictly not nullable and we could get proper Nullability
// by calling `getImmanentNullability` (as it happens below).
//
// But there are some problem with types built on type parameters, e.g.
// fun <T : Any?> foo(x: T) = x!!.hashCode() // there no way in type system to denote that `x!!` is not nullable
ExpressionTypingUtils.isExclExclExpression(KtPsiUtil.deparenthesize(expression)) ->
DataFlowValue(IdentifierInfo.Expression(expression), type, Nullability.NOT_NULL)