Added: Explicit API - Strict mode in Kotlin#38
Open
hsinha610 wants to merge 1 commit into
Open
Conversation
Helps in preventing internal API being published as public API.
fahad19
approved these changes
Apr 17, 2024
klaudia-czerwiec-dazn
approved these changes
Apr 23, 2024
Tan108
approved these changes
Apr 30, 2024
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.
Helps in preventing internal API being published as public API.
Visibility modifiers are required for declarations if the default visibility exposes them to the public API.
This helps ensure that no declarations are exposed to the public API unintentionally.
Explicit type specifications are required for properties and functions that are exposed to the public API.
This guarantees that API users are aware of the types of API members they use.
Using
StrictMode - produces errors if some public API is present without any explicit visibility modifier and thus crashes the build during compilation.References:-
https://www.baeldung.com/kotlin/explicit-api-mode
https://kotlinlang.org/docs/whatsnew14.html#explicit-api-mode-for-library-authors
https://youtu.be/IsXra6RvkI0?list=PLlFc5cFwUnmwcJ7ZXyMmS70A9QFyUu1HI&t=270