API-Annotate - Single annotation to mark API elements

Related tags

Kotlin API-Annotate
Overview

API-Annotate

A single annotation for annotating externally-consumed elements in your libraries.

What? Why?

IDEs like IntelliJ helpfully flag up unused elements. But if you're writing a library, often you'll have lots of externally-facing functions and properties that aren't consumed inside the project at all. The IDE will give a false positive warning on these, which can lead to real unused functions getting ignored and never cleared up.

If you annotate your externally-consumed elements with @API, you can instruct your IDE to suppress warnings on those annotated elements by following these steps:

IntelliJ:

  1. On the element with the warning, open the actions menu (Alt+Enter by default)
  2. Select "suppress unused warning if annotated by com.sagehadnt.apiannotate.API"

Why not SuppressWarnings("unused")?

Because that doesn't tell the reader why we're suppressing those warnings. Having a dedicated annotation makes it unambiguous. The reader doesn't have to waste mental effort figuring out what the writer was trying to do.

Also, I'd argue it's just cleaner:

@SuppressWarnings("unused")
fun info(msg: String) { /* ... */ }

@API
fun info(msg: String) { /* ... */ }
You might also like...
Swift-friendly api generator for Kotlin/Native frameworks
Swift-friendly api generator for Kotlin/Native frameworks

MOKO KSwift KSwift it's gradle plugin for generation Swift-friendly API for Kotlin/Native framework. Kotlin sealed interface/class to Swift enum Kotli

A pluggable sealed API result type for modeling Retrofit responses.

A pluggable sealed API result type for modeling Retrofit responses.

🐅 Experimental Kotlin library for Revolt (API subject is to change)

Kairi 🐅 Experimental Kotlin library for Revolt

A declarative, Kotlin-idiomatic API for writing dynamic command line applications.
A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

REST countries sample app that loads information from REST countries API V3 to show an approach to using some of the best practices in Android Development.
REST countries sample app that loads information from REST countries API V3 to show an approach to using some of the best practices in Android Development.

MAJORITY assignment solution in Kotlin via MVVM Repository Pattern. REST countries sample app that loads information from REST countries API V3 to sho

A Kotlin Multiplatform Project using TMDB Api. Currently supports Android,iOS,Desktop and web platforms
A Kotlin Multiplatform Project using TMDB Api. Currently supports Android,iOS,Desktop and web platforms

A Kotlin Multiplatform Project using TMDB Api(https://www.themoviedb.org/). Currently this project is implemented in following platforms Andr

A injection minecraft cheat using jvm attach api

Luminous A injection minecraft cheat using jvm attach api Website: https://lumi.getfdp.today Build We used a thing called Wrapper to make development

Android app that uses TMDB API to show info about movies.
Android app that uses TMDB API to show info about movies.

Movies App: Projeto Integrador - Vitória Code 2021 🎬 Sobre o projeto Esse é um aplicativo Android feito em Kotlin que oferece aos usuários uma listag

A music player UI am designing in Jetpack Compose. The data is being fetched from Deezer's API.
A music player UI am designing in Jetpack Compose. The data is being fetched from Deezer's API.

Jetpack-Compose-MusicPlayer-UI 🎵 - Still under development This is a small project I am doing to interact with and explore Jetpack Compose components

Owner
null
An annotation and Kotlin compiler plugin for enforcing a when statement is exhaustive

An annotation and Kotlin compiler plugin for enforcing a when statement is exhaustive

Cash App 468 Jan 4, 2023
Android Spinner Dialog Library supported on both Java and Kotlin, Use for single or multi selection of choice

SpinnerDialog Android Spinner Dialog Library, Use for single or multi selection of choice Android UI Download To include SpinnerDialog in your project

Hamza Khan 55 Sep 15, 2022
Small app to create icon sets for Linux, Windows, OSX, Android and IOS from a single PNG image

FXIconcreator Small app to create icon sets (multi resolution) for Linux, Windows, OSX from a single PNG image Reason for creating such an app was tha

null 18 Aug 4, 2022
API-Request - Android app that makes API Request

API-Request Android project using Retrofit and Ktor for Http Requests, built wit

Thales 2 Mar 26, 2022
A simple library that can connect your autocomplete edittext to Google places api

Google Places AutoComplete EditText A simple library that can connect your autocomplete edittext to Google's places api Supporting Places AutoComplete

Mukesh Solanki 71 Dec 28, 2022
Anime quotes rest api app with mvvm, LiveData, Coroutines, Navigation Component etc

AnimeQuote Anime quotes image rest api app with mvvm, LiveData, Coroutines, Navigation Component, clean achitecture etc An app created during mentorin

Ehma Ugbogo 4 Jun 11, 2021
Неофициальный API ОГУ им. И.С. Тургенева

Oreluniver API Неофициальный API ОГУ им. И.С. Тургенева Отличия от оригинала Четкая структура, выделены три роута teacher, group, classroom для препод

Kirill Zhukov 5 Nov 18, 2022
Simple MVVM app to get photos through https://unsplash.com api

MyPhotoLoaderApp Simple photo loading app powered by Unsplash.com which implements MVVM architecture using Hilt, Navigation Component, Retrofit, Pagin

Behnam Banaei 10 Oct 6, 2022
API para calcular impostos sobre operações na bolsa e auxiliar na declaração de imposto de renda anual.

API que visa consolidar dados referetes às operações na bolsa para ajudar na declaração de imposto de renda (IRPF). Operações suportadas: Ações Day tr

Jean Carlos 12 Mar 12, 2022
Movie app that receives popular movies and allows the user to search for the specific movie through the Rest API with help of retrofit library &MVVM architecture.

MovieClue Millions of movies, TV shows and people to discover. Explore now Movie app that recieves popular movies and allow the user to search for spe

Shubham Tomar 6 Mar 31, 2022