I'm having a mismatch between Kotlin and IntelliJ ...
# intellij
j
I'm having a mismatch between Kotlin and IntelliJ I'm getting this warning when compiling:
Copy code
Smart cast to 'ImageData' is impossible, because 'selectedIcon' is a property that has an open or custom getter.
But Intellij says:
Copy code
Unnecessary non-null assertion (!!) on a non-null receiver of type 'ImageData'.
I understand that it's IntelliJ that is reporting it incorrectly. So how can I fix my IntelliJ, so it does not suggest to remove the
!!
?
b
are you in K2 mode ?
j
no
or not sure actually. I'm on Kotlin 2.1.20 and whatever that defaults to
b
Screenshot 2025-07-30 at 14.06.42.png
j
I disabled it (and restarted IntelliJ). But IntelliJ still suggest to remove it. > Unnecessary non-null assertion (!!) on a non-null receiver of type ImageData
b
My guess was that it wasn't enabled actually 😅 but yeah it was just a hunch. It may be a bug then, I suggest you open a ticket on YouTrack
j
Will open a bug then 👍
👍 1
found out it was a gradle issue. it was IntelliJ that was correct and not gradle
the property is defined as
val
. so this issue of it being open is not relevant
b
I guess you mean a compiler issue (gradle is not relevant here)
j
I only got
Smart cast to 'ImageData' is impossible, because 'selectedIcon' is a property that has an open or custom getter.
when executed
./gradlew compileKotlin
, but when I ran it with
./gradlew compileKotlin --rerun-tasks
it didn't fail
b
oooohh it might have been a gradle cache issue indeed then 👍