eclipse-ee4j / eclipse-ee4j/jersey
Add support for nested generics to ConfigurableMoxyJsonProvider
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
When using Moxy to generate JSON responses, types with nested generics (e.g. Collection>) do not work, leading to an error being logged:
```
ERROR [main] MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.Collection>. (at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:245))
```
This is a known Moxy issue with nested generics which has unfortunately been unresolved since July 2013: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=413809](https://bugs.eclipse.org/bugs/show_bug.cgi?id=413809)
I suspected issue #2715 might be caused by the same problem.
We have successfully fixed this problem in production with a patched version of ConfigurableMoxyJsonProvider overwriting MOXyJsonProvider::getDomainClass, as described in the original Moxy issue (comment #2). This way there is no need to wait for this issue to be fixed in Moxy.
I have created a pull request: [https://github.com/jersey/jersey/pull/134](https://github.com/jersey/jersey/pull/134)
Contributor guide
Assessment
This issue has not been assessed yet.