Java: Cannot access kotlin.Unit

I have a piece of Kotlin code (roughly) like this:

public fun method(input: Unit?)

When I try to call this function from another Java project that does not depend on Kotlin directly, I receive an error message: Cannot access kotlin.Unit, despite being able to navigate to the declaration site.

I am aware that this particular construct is silly, I was just wondering why Java couldn’t access a public declaration.

You need to expose kotlin stdlib as api, not as implementation. Otherwise, it would not be visible to descendants.

Thank you for the hint! I updated the entry in the Kotlin’s project build.gradle to

dependencies {
    api "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

and rebuilt it, the problem however persists. The Java project does list the stdlib as an external library and thus should be able to see kotlin.Unit.