Kotlin classes do not infer Java classes' types correctly
已回答
It seems to be the IDE (IntelliJ IDEA 2025.1 Ultimate Edition), because the compiler works (the code gets compiled fine and the application works as expected).
The IDE keeps throwing errors about incorrect types when e.g. implementing a Kotlin class that extends a Java class. In my case the errors refer to the final fields of my Java class that are of Function or Predicate type, especially as my Java class is generic and it's e.g. Predicate<T> and things like that.
My Kotlin plugin version is bundled 251.23774.435-IJ.
Kotlin version (in project) is 1.9, target Java version is 17, JDK is 21.
请先登录再写评论。
Those errors do not show up in older IntelliJ versions (2023.1.3) with the older Kotlin plugin (231-1.9.22-release-704-ij8109.175).
Unticking Enable K2 Mode helps for those issues FYI.
Can you please provide the whole stacktrace of the exception and the IDEA logs.
In addition, please provide a project with the issue and the exact steps how to reproduce the issue.
Thank you in advance!
Can you please provide the whole stacktrace of the exception and the IDEA logs.
In addition, please provide a project with the issue and the exact steps how to reproduce the issue.
Thank you in advance!