Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: Explicit API - Strict mode in Kotlin #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hsinha610
Copy link
Contributor

@hsinha610 hsinha610 commented Apr 16, 2024

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

Helps in preventing internal API being published as public API.
@hsinha610 hsinha610 requested a review from a team as a code owner April 16, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants