Skip to content

Annotation targeting generic type is stripped from output #909

@TamasSzigeti

Description

@TamasSzigeti

Prettier-Java 2.9.6

Input:

import org.jspecify.annotations.Nullable;

public class Foo {
    public <T extends String> @Nullable T bar(T baz) {
        return null;
    }
}

Output:

public class Foo {

    public <T extends String> T bar(T baz) {
        return null;
    }
}

Expected behavior:

Annotation should be retained

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions