Hello. I've just upgraded to Kotlin 1.4 and enable...
# intellij
g
Hello. I've just upgraded to Kotlin 1.4 and enabled
explicitApi()
(strict mode). I've fixed all the issues reported (e.g., adding
public
where necessary).
gradle build
works perfectly, and all the tests pass. However, I have a bunch of
internal
classes/properties/functions that I'm using in the tests, and IntelliJ reports them as an error and suggests to make them public, which I don't want. Again, I can run the tests just fine. This is a bug in IntelliJ, isn't it?
Actually, I've just realised that this issue even applies to tests for the
internal
classes/objects/etc, even though the test cases have the exact same package as the unit under test. It seems like IntelliJ is expecting
internal
declarations to be used in the same source set (
main
in this case).
a
Does this error happen only when you enable explicitApi()? Also, inspection from second screenshot is probably not relevant, because it's only about Java.
g
Hi Alexey! Thanks for getting back. I missed the fact that this happens just because of the Kotlin upgrade to v1.4.
explicitApi
doesn't change a thing. For example, here's the change I've made to my library: https://github.com/relaycorp/relaynet-jvm/pull/81/files -- I don't get this issue before those changes, but I get it when I change the Kotlin version
a
Thanks, I'll take a look. What IDEA version do you use?
g
Thanks Alexey!
Copy code
IntelliJ IDEA 2020.2.1 Preview (Community Edition)
Build #IC-202.6948.5, built on August 11, 2020
Runtime version: 11.0.8+10-b944.31 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.3.0-29-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 11933M
Cores: 8
Non-Bundled Plugins: org.jetbrains.kotlin, io.ktor.intellij.plugin, <http://com.jetbrains.edu|com.jetbrains.edu>
Current Desktop: KDE
I'm sorry Alexey, but I think the Kotlin upgrade was a red herring: I can reproduce this issue with Koltin 1.3.72 too. Also, I can open another library running Kotlin 1.4 in IntelliJ and I don't get this error with
internal
classes/properties/etc. I've already used the
Invalidate cache / restart
operation but the issue persists.
I worked on this library a few days ago (my last commit was on 14th Aug) and I didn't notice any issue at all. I'm not sure if it's a regression in IntelliJ or a plugin, but it's weird I can't rewproduce it with another project
The projects I'm working on are open source in case you'd like to reproduce this issue locally. Here's the one where I'm experiencing this issue: https://github.com/relaycorp/relaynet-jvm (Kotlin 1.3, Gradle Kotlin DSL) And here's one where I'm not experiencing this issue: https://github.com/relaycorp/relaynet-poweb-jvm (Kotlin 1.4, Gradle Groovy DLS) I'm actively working on those projects and I hadn't noticed this issue until today.
🙏 1
a
Failed to reproduce. Does it help to delete .idea directory (back it up just in case) and reimport the project into IDEA?
g
Yup, deleting
.idea
fixes it. Thanks for looking into this Alexey!
👍 1