Skip to content

Annotation targeting generic type is stripped from output #909

Closed

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

Activity

  1. TamasSzigeti commented on May 28, 2026

    @TamasSzigeti
    Author

    Wow that was fast, thank you so much @jtkiesel

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions