When trying to write a simple generic entity (Widget) to json I get the warning: Generic bound not found for type T declared in class Widget. I would expect that if I wrap the Widget in a GenericEntity<Widget> that the generic type information that is passed in to the MessageBodyWriter#writeTo method implemented in JsonBindingProvider would be passed on the the jsonb#toJson method as so: jsonb.writeTo(obj, genericType). That doesnt seem to be the case, as JsonBindingProvider ignores the generic type parameter altogether. Perhaps this is the intented behavior, but some clarification would be nice. I am also curious as to why these 2 lines were used:
entityStream.write(jsonb.toJson(o).getBytes(AbstractMessageReaderWriterProvider.getCharset(mediaType))); entityStream.flush();
instead of using:
jsonb.toJson(o, genericType, entityStream);