Java interop checks
These six checks run only in JVM compilations. Use them for libraries that support Java callers.
The checks
| Check | Reports |
|---|---|
| Companion function without JvmStatic | Companion functions without a static entry point. |
| Companion property without static access | Companion accessors without static access. |
| Default parameters without JvmOverloads | Default parameters that Java callers can't omit. |
| Kotlin-only API without JvmSynthetic | Kotlin-specific function shapes visible to Java. |
| Mangled JVM names in public API | Value-class signatures that Java sources can't call. |
| Top-level API without JvmName | File facades whose names depend on source file names. |
Kotlin-only audience
For a library without Java callers, disable the group:
build.gradle.kts
apiWatchdog {javaInterop {enabled = false}}
enabled defaults to true. false overrides every per-check severity.
Per-declaration exceptions
To exempt one declaration, use the check's @Intentionally* annotation.
For ExemptionReason.IGNORE_JAVA_INTEROP, add a description.
An exemption leaves the declaration visible to Java. To hide it, use @JvmSynthetic.
See Exemptions and internal API for more details about exemption reasons.