users@jaxb.java.net

Re: Questions on typesafe enum classes

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 12 Aug 2003 10:32:46 -0700

> > No, you shouldn't be. So this must be a bug.
>
> Should I file a bug report?

I've already fixed the problem. So don't worry.


> I may be misunderstaning the reply, but as I understand it, the question was
> not,
> *whether* typesafe enum classes are generated. Looking at the attached
> schema,
> xjc is very well creating me a class "LocalStringCl". However, I would
> expect,
> that "LocalStringCl" would be an inner class of "LocalEnumElement", or
> "LocalEnumElementImpl", but not an outer class, as it is. (I am using wsdp
> 1.2.)

Aha. I misunderstood the question. I'll check the spec.


> The attached schema has an element xjc:serializable in the globalBindings
> section,
> to no effect. I may be doing a mistake, though.

The problem is you didn't specify:

            jaxb:extensionBindingPrefixes="xjc"

And without this, XJC won't recognize those namespaces as binding
declarations. I can see many people do this mistake, so perhaps XJC
should issue a warning when it suspects missing
@jaxb:extensionBindingPrefixes


> If the class is serializable, then == won't work as expected and custom
> hashCode() and equals() methods are required. See the following example.

The point I was trying to make is that the singleton/serialization
problem should be solved by the readResolve method, not by changing the
semantics of the singleton.

In any case, when <xjc:serializable /> is activated, I confirmed that this
works correctly.


regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net