๐ Custom Annotations SDK โ Wiki - maxDevAndroid/custom-annotations-sdk GitHub Wiki
Custom Annotations SDK is a Kotlin library designed to provide reusable and semantically rich annotations for modular Android/Kotlin projects. It enables teams to communicate constraints and intentions (e.g., internal APIs, debug-only features, experimental code) clearly across modules, with full support for unit testing and documentation.
All annotations are tested via reflection to ensure presence and compatibility in consuming modules.
Example:
kotlinCopiarEditarval method = MyClass::class.members.find { it.name == "someMethod" } val annotation = method?.annotations?.find { it is InternalOnly } assertNotNull(annotation)
-
Add as a module or remote dependency (future-ready):
kotlinCopiarEditarimplementation(project(":custom_annotations_sdk"))
-
Apply annotations in your code:
kotlinCopiarEditar@InternalOnly fun restrictedMethod() { // internal usage only }
Test using Kotlin reflection:
SeeAnnotationTests.kt
for working examples.
CopiarEditarcustom_annotations_sdk/ โโโ annotations/ โ โโโ DebugOnly.kt โ โโโ ExperimentalApi.kt โ โโโ InternalOnly.kt โ โโโ LegacyApi.kt โโโ tests/ โ โโโ AnnotationTests.kt โโโ README.md โโโ wiki.md โโโ build.gradle.kts
README.md
: Public-facing usage instructions.HISTORY.md
: Changelog.COMMENTS.md
: Dev and reviewer notes.AnnotationTests.kt
: Unit tests for all annotations.
This library was built for clean architecture Kotlin projects, especially in multiplatform or modular environments where explicit API scoping is essential.
For feedback or contributions, open an issue or submit a pull request.
Future improvements will include:
Integration with code generation
Annotation processing
Lint rules for enforced usage