Added: Explicit API - Strict mode in Kotlin #38
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
Strict
Mode - 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