API Stability
Purpose and scope¶
This document explains:
- What each stability annotation means for adopters.
- How Kotlin opt-in and deprecation interact with those annotations.
Public surface: what counts as “public API”¶
Viaduct’s external public surface is defined by:
- Kotlin visibility (what is technically
public/ visible outside the module), and - Designated public packages that are intended for consumer use.
Everything outside those canonical public packages should be treated as implementation detail even if it is public in Kotlin.
Stability levels¶
Stability table (consumer view)¶
| Annotation | Meaning | Who should use it | Guarantees |
|---|---|---|---|
@StableApi |
Long-term public contract | All consumers | Binary compatible within a major version; removal via deprecation |
@ExperimentalApi |
Public but evolving (opt-in) | Early adopters | May change or be removed in any release |
@Deprecated |
Scheduled for replacement/removal | Everyone | Migration path documented; removal in a future release |
@InternalApi |
Not a consumer contract | Viaduct developers only | No stability guarantee |
@VisibleForTest |
Viaduct internal use for tests | This annotation is only used on internal Viaduct tests that for some reason needs to be pulished in public packages |
Practical guidance¶
- Prefer
@StableApiwhen possible; build shared abstractions on top of it. - Use
@ExperimentalApionly when needed; isolate usage and re-validate during upgrades. - Avoid
@InternalApiin production; it may change or disappear without deprecation. - Treat
@Deprecatedas a migration signal; expect removals only in major versions.
Opt-in behavior¶
Some stability annotations are built on Kotlin’s @RequiresOptIn and therefore affect compilation at usage sites:
@ExperimentalApisurfaces as a warning unless you opt in.@InternalApiusage is an error unless you opt in.@StableApidoes not require opt-in.
Upgrade expectations¶
When upgrading Viaduct:
- Stable APIs should remain binary compatible within a major version; breaking changes should be coordinated via deprecation and versioning.
- Experimental APIs may change between releases; re-test and re-check call sites that opted in.
- Internal APIs may break without warning; if you opted in, you own the risk.
- Deprecated APIs: follow the migration guidance and plan to remove usage before the next major bump.