Skip to content

formatAnnotations merges type and non-type annotations in records #2336

Closed
@jskov

Description

@jskov

I find that FormatAnnotationsStep works OK with annotations on fields/getters that follow the form mentioned in this note.

But I have started using records in my project and have code like this:

public record EnumsDto(
        @JsonbProperty("external") @Valid @Nullable ExternalEnum external,
        @JsonbProperty("externalLower") @Valid @Nullable ExternalLowerEnum externalLower,
...

The above is the formatAnnotations() output.

But it should (if I understand things correctly) be:

public record EnumsDto(
        @JsonbProperty("external")
        @Valid @Nullable ExternalEnum external,
        @JsonbProperty("externalLower")
        @Valid @Nullable ExternalLowerEnum externalLower,
...

But since there is no protection keyword (public/private) to separate the non-type annotations from the type-annotations, they all get merged into the same line by FormatAnnotationsStep.

This is observed with version Gradle Plugin v7.0.0.BETA4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions