https://kotlinlang.org logo
Title
j

Jeff Lockhart

05/26/2023, 5:26 PM
I'm moving some testing code to a testing-support module in order to access from multiple modules. The code needs to access some internal APIs of the original module though. So I'm using
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
to allow this, but I'm getting a compilation error for a specific internal API:
Compilation failed: Backend Internal error: Exception during IR lowering
The root cause org.jetbrains.kotlin.backend.common.CompilationException was thrown at: org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.getOwner(IrPublicSymbolBase.kt:52)
Is this expected where some internal APIs can't be accessed in this way? It works on JVM, but not native targets.
a

Adam S

05/26/2023, 7:58 PM
you can use some Gradle config to allow different source sets to view internal members https://kotlinlang.org/docs/gradle-configure-project.html#associate-compiler-tasks, but I don’t think it’s possible across subprojects (well, it probably is possible somehow, but not simply!) As an alternative there are opt-in annotations https://kotlinlang.org/docs/opt-in-requirements.html#require-opt-in-for-api
j

Jeff Lockhart

05/26/2023, 11:29 PM
I created an issue in YouTrack: https://youtrack.jetbrains.com/issue/KT-58949