Hey there! Let’s imagine I have the following code...
# compiler
i
Hey there! Let’s imagine I have the following code in Android application (but the platform doesn’t matter):
Copy code
val anim = if (Random.nextBoolean()) LinearOutSlowInInterpolator() else FastOutSlowInInterpolator()
LinearOutSlowInInterpolator
and
FastOutSlowInInterpolator
are contained in Java library (actually android.jar) and have the same package-private super class
LookupTableInterpolator
. So inferred type of
anim
value is
LookupTableInterpolator
. I wonder why the compiler generates a warning instead of en error that
LookupTableInterpolator
is inaccessible in this context. Because the code from above is compiled successfully but always fails at runtime. Is it possible to treat such warnings as errors?