hilla
hilla copied to clipboard
Entity becomes non-generic if the generic parameter has boundary
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
- Get the new project from start.vaadin.com.
- 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 {} } - Run the application
System Info
OS: Windows + WSL Version: 24.7.3
It would be complex to support the boundary properly. We aren't sure that Jackson would be able to deserialise correctly.
Also, if this is something you need, please share your use case.