users@jaxb.java.net

Re: [ANN] JAXB 2.0 is final

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 15 May 2006 15:38:28 -0700

James Mao wrote:
> Congradulation first of all.

Thanks.

> But we found that the generated types class from the schema, missed the
> type attribute in the annotation.
> For example, when we use RI 2.0, we got
>
> @XmlElement(namespace = "http://objectweb.org/type_test/doc")
> protected int x;
>
> If we use EA3, we got
> @XmlElement(namespace = "http://objectweb.org/type_test/doc", type = Integer.class)
> protected int x;
>
> Is the type attribute optional?

I think this is a result of the optimization. Namely, since the field
type already says "int", the extra type() is redundant.

Since the spec defines how to compute the effective type value if
omitted, this change shouldn't make any visible impact or regression to
the behavior of the JAXB RI. If you are seeing any regressions in the
runtime behavior, please let us know.

If you are parsing those annotations by yourself, you might consider
using http://jaxb2-reflection.dev.java.net/ since the defaulting rule is
actually quite non-trivial to get right.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com