๐Ÿ“š Custom Annotations SDK โ€ Wiki - maxDevAndroid/custom-annotations-sdk GitHub Wiki

Overview

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.


๐Ÿ“ฆ Provided Annotations

Annotation | Purpose -- | -- @InternalOnly | Marks elements intended for internal module use only. @DebugOnly | Indicates code that should only run in debug builds. @ExperimentalApi | Flags APIs that are experimental and subject to change. @LegacyApi | Marks deprecated or legacy APIs that should be avoided or migrated.

๐Ÿงช Testing

All annotations are tested via reflection to ensure presence and compatibility in consuming modules.

Example:

kotlin
CopiarEditar
val method = MyClass::class.members.find { it.name == "someMethod" } val annotation = method?.annotations?.find { it is InternalOnly } assertNotNull(annotation)

๐Ÿ’ก How to Use in Other Projects

  1. Add as a module or remote dependency (future-ready):

    kotlin
    CopiarEditar
    implementation(project(":custom_annotations_sdk"))
  2. Apply annotations in your code:

    kotlin
    CopiarEditar
    @InternalOnly fun restrictedMethod() { // internal usage only }
  3. Test using Kotlin reflection:
    See AnnotationTests.kt for working examples.


๐Ÿ—๏ธ Project Structure

CopiarEditar
custom_annotations_sdk/ โ”œโ”€โ”€ annotations/ โ”‚ โ”œโ”€โ”€ DebugOnly.kt โ”‚ โ”œโ”€โ”€ ExperimentalApi.kt โ”‚ โ”œโ”€โ”€ InternalOnly.kt โ”‚ โ””โ”€โ”€ LegacyApi.kt โ”œโ”€โ”€ tests/ โ”‚ โ””โ”€โ”€ AnnotationTests.kt โ”œโ”€โ”€ README.md โ”œโ”€โ”€ wiki.md โ””โ”€โ”€ build.gradle.kts

๐Ÿ“– Related Files

  • README.md: Public-facing usage instructions.

  • HISTORY.md: Changelog.

  • COMMENTS.md: Dev and reviewer notes.

  • AnnotationTests.kt: Unit tests for all annotations.


๐Ÿง  Author Notes

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

โš ๏ธ **GitHub.com Fallback** โš ๏ธ