users@jsr311.java.net

Re: declared return-type ignored for selection of MessageBodyWriter?

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Mon, 29 Sep 2008 10:35:29 -0400

It sounds like you are doing the correct thing. The generic type is
either the declared return type of the method or the type returned by
a GenericEntity instance.

Unless I'm misunderstanding, I think this is somewhat orthogonal to
issue 46 since that will only come into play during step 4 of section
4.2.2 (sorting to find the most appropriate writer). Writers can
reject generic types they don't support in step 3 and then won't be
considered in step 4.

Marc.

On Sep 29, 2008, at 10:04 AM, Reto Bachmann-Gmür wrote:

> Hello
>
> Rereading section 4.2.2 I'm insecure if its correct to look at the
> declared return type of a method (for those that are not Response or
> GenericEntity) for selecting the MessageBodyWriter.
>
> Currently I'm passing the type of the object returned at runtime as
> the "type" argument to Providers.getMessageBodyWriter and the
> declared return type as genericType.
>
> Does "for other return types it is the returned object." (section
> 4.2.2) means that only the class of the object returned at runtime
> is to be considered?
>
> Issue 46 I think would be easier to solve looking at the declared
> return-type only, but currently it would be most useful to consider
> both.
>
> Cheers,
> reto
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.