Skip to content

Entity becomes non-generic if the generic parameter has boundary #3465

Description

@Lodin

Describe the bug

For the following endpoint:

@BrowserCallable
public class Tst {
    @NonNull
    public <T extends DTOBoundary> DTO<T> getDTO() {
        return new DTO<>();
    }

    public static class DTO<T extends DTOBoundary> {
        public T get() {
            return null;
        }
    }

    public static class DTOBoundary {}
}

I'm getting the following error:

ERROR(TypeScript)  Type 'DTO' is not generic.
> 5 | async function getDTO_1(init?: EndpointRequestInit_1): Promise<DTO_1<DTOBoundary_1 | undefined>> { return client_1.call("Tst", "getDTO", {}, init); }

The DTO entity is generated as following:

interface DTO {
}
export default DTO;

However, if I remove the boundary from the DTO class:

    public static class DTO<T> {
        public T get() {
            return null;
        }
    }

the issue resolves.

Expected-behavior

DTO is generated correctly with boundaries:

interface DTO<T extends DTOBoundary> {
}

Reproduction

  1. Get the new project from start.vaadin.com.
  2. Create an endpoint with the code:
    @BrowserCallable
    public class Tst {
        @NonNull
        public <T extends DTOBoundary> DTO<T> getDTO() {
            return new DTO<>();
        }
    
        public static class DTO<T extends DTOBoundary> {
            public T get() {
                return null;
            }
        }
    
        public static class DTOBoundary {}
    }
  3. Run the application

System Info

OS: Windows + WSL
Version: 24.7.3

Activity

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

    bugSomething isn't workinghillaIssues related to Hilla

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions