Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

parse "?" generic parameter to an explicit object instead of an empty list #30

Closed
hauner opened this issue Nov 1, 2020 · 1 comment · Fixed by #31
Closed

parse "?" generic parameter to an explicit object instead of an empty list #30

hauner opened this issue Nov 1, 2020 · 1 comment · Fixed by #31
Labels
enhancement New feature or request
Milestone

Comments

@hauner
Copy link
Member

hauner commented Nov 1, 2020

passing a HttpRequest to a (Micronaut) controller without providing a body type uses a parameter like this (in kotlin):

request: HttpRequest<*>

the mapping to add the parameter is:

map:
  paths:
    /foo:
      parameters:
        - add: request => io.micronaut.http.HttpRequest<?>

Currently this translates to an empty generic parameter list, i.e. the generated java parameter is just

void foo(HttpRequest request);

this shows a warning in IDEA: Raw use of parameterized class 'HttpRequest'

The kotlin implementation can implement it as

override fun foo(request: HttpRequest<*>)

but it would be nice to generate the java endpoint with generic parameter to remove the warning

void foo(HttpRequest<?> request);
@hauner hauner added the enhancement New feature or request label Nov 1, 2020
@hauner
Copy link
Member Author

hauner commented Nov 1, 2020

hmm, the compiler does not complain but Micronaut does not detect the endpoint anymore and sends a 404 response.

After changing the generated code to

void foo(HttpRequest<?> request);

Micronaut does detect the endpoint again.

@hauner hauner added this to the 2020.3.0 milestone Nov 1, 2020
@hauner hauner linked a pull request Nov 1, 2020 that will close this issue
@hauner hauner closed this as completed in #31 Nov 6, 2020
hauner added a commit that referenced this issue Nov 6, 2020
preserve and handle generic wildcard parameter, resolves #30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant