API stability processor and API#11184
Draft
tomas-langer wants to merge 8 commits intohelidon-io:mainfrom
Draft
Conversation
New stability states. Renamed "private" to "internal". Updated common to use the new API + added enforcer.
Message updates
Fixes to API declarations Updated common and common-mapper with API stability annotations
fc67e37 to
2026ad3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #11124
io.helidon.common.Apicontainer class addedInternal,Incubating, andPreview,Stable, andDeprecatedAPIsThis is a draft for discussion
This PR adds support for both enforcing that Helidon APIs are documented and that user code is not using APIs not intended for them.
Defaults are now to
WARNINGonly, so we do not break existing code.In addition this PR makes sure that all generated code for service registry correctly suppresses the check (as we want to use any API from generated code, as we do in fact own it).
I have verified that when using changes in this PR, all declarative examples are built without a single warning (requires suppression of incubating on the declarative APIs that use annotations from Http etc., as expected).
I have also verified that the examples start without a warning.
I also switched from
@Deprecatedto@Api.Incubatingfor most of the declarative APIs.This PR shows required changes in declarative examples:
helidon-io/helidon-examples#258
API Stability
API Stability allows Helidon maintainers to mark APIs with one of the stability annotations, to declare its expected use
and state.
Target state in Helidon:
publictypes in Helidon production modules are annotated with one of theApistability annotation@Api.Since("version")to announce the version that the stability state changeddefault-compileTarget state for users:
InternalorIncubatingAPIs, unless they suppress warnings, or configure the annotation processor to ignore/warnPrevieworDeprecatedAPIs (also can be suppressed)Intermediate state:
Stability states and transition
States:
Incubating- "playground" for new features and APIsPreview- features and APIs we plan as stable, to get feedback from communityStable- stable APIsDeprecated- deprecated APIs, will be removed in a major release of HelidonInternal- internal APIs, do not useInitial state: Any state mentioned above - all
publicAPIs must be annotated with any of the above annotationsFinal state: API is removed from project
Transitions:
Incubating(can transition in any release of Helidon, including patch versions)Preview- next stage, we plan to release this feature eventually as stableStable- we gathered enough feedback and consider this to be a stable APIDeprecated- we deprecate the API (exceptional use, in most cases we would just remove the API)Preview(can transition in a minor release of Helidon):Stable- we gathered enough feedback and consider this to be a stable featureDeprecated- we deprecate the API and will remove it in a future major versionStable(can transition in a minor release of Helidon):Deprecated- the API is now deprecated, and will be removed in a future major versionDeprecated:Stable- can transition in any release of HelidonIMPORTANT NOTE:
Only APIs marked as
InternalandIncubatingmay be removed within a major release of Helidon (minor, dot, patch versions);Only APIs marked as
Deprecatedmay be removed when a new major release of Helidon is done;Other public APIs cannot be removed;
Suppression in code
Suppression in code:
@SuppressWarnings("helidon:api:preview")@SuppressWarnings("helidon:api:incubating")@SuppressWarnings("helidon:api:internal")@SuppressWarnings("helidon:api:deprecated")Annotation processor options
Control through annotation processor flags:
For all stability levels:
-Ahelidon.api=default- use defaults of each stability level (default)-Ahelidon.api=fail- fail for any violation-Ahelidon.api=warn- warn for any violation-Ahelidon.api=ignore- ignore all violationsFor a specific stability level:
-Ahelidon.api.preview=fail-Ahelidon.api.preview=warn- default-Ahelidon.api.preview=ignore-Ahelidon.api.incubating=fail-Ahelidon.api.incubating=warn- default-Ahelidon.api.incubating=ignore-Ahelidon.api.internal=fail-Ahelidon.api.internal=warn- default-Ahelidon.api.internal=ignore-Ahelidon.api.deprecated=fail-Ahelidon.api.deprecated=warn- default-Ahelidon.api.deprecated=ignore