Skip to content

[FEATURE] Ensure Java / Kotlin code is marked as generated #2295

Open

Description

Why do we need this improvement?

This improvement is needed so that generated code can easily be excluded from quality analysis by standard JVM tooling.

How will this change help?

Some quality tools allow exclusion by filesystem path or package; others require annotations to exclude the code. This change will improve ease of use for JVM-based consumers.

Screenshots

No response

How could it be implemented/designed?

Any generated class must be annotated with jakarta.annotation.Generated to simplify excluding the code from various quality tools.

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

No, someone else can work on it.

Activity

  1. GishReloaded commented on Sep 17, 2026

    @GishReloaded

    Hi! I'd like to work on this if it is available.

    I traced asyncapi generate models and it delegates Java/Kotlin rendering to @asyncapi/modelina-cli, so the main implementation appears to belong in asyncapi/modelina, with the CLI consuming the updated Modelina version/options.

    My proposed approach:

    1. Add generated-code annotation support to the Java and Kotlin class/enum renderers using the existing preset and dependency-manager patterns.
    2. Emit the appropriate jakarta.annotation.Generated import and annotation without affecting other languages.
    3. Add generator tests/snapshots for Java and Kotlin output.
    4. Verify whether CLI option/version wiring is needed and add an integration test if applicable.

    Could a maintainer confirm whether the implementation should be opened in asyncapi/modelina and whether all generated model types (classes, enums, records/unions) are expected to be annotated?

  2. michael-schechter-simspace commented on Sep 22, 2026

    @michael-schechter-simspace
    Author

    @GishReloaded - That sounds like a good plan, and will address what I was looking for.

    One suggestion - there are a couple of different @Generated annotations available; would it make sense to add a flag (like --javaJackson) to allow control of the annotation?

    Options include:

    • jakarta.annotation.Generated
    • javax.annotation.processing.Generated
    • org.springframework.aot.generate.Generated

    Thanks for picking this up!

  3. GishReloaded commented on Sep 23, 2026

    @GishReloaded

    Thanks, that's helpful. A configurable annotation seems safer than choosing one for every Java/Kotlin consumer, especially since these variants have different dependencies. I'd keep existing output unchanged by default and check how Modelina options can be passed through the CLI before proposing the exact flag. For your tooling, would jakarta.annotation.Generated and javax.annotation.processing.Generated cover the need, or is the Spring AOT variant required too? I'd also appreciate maintainer guidance on the preferred implementation repository and scope before opening a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions