users@jaxb.java.net

RE: Re: Inheritance and class callback methods

From: Yevgeny Shakhnovich <yevgeny_at_hammerheadsystems.com>
Date: Fri, 6 Oct 2006 09:51:02 -0700

I did not test it but according to the javadoc readObject for
Serializable should not be inherited since it must be private. JAXB does
not require callbacks to be private. May be it is enough to change the
javadoc to state it?

Yevgeny Shakhnovich

-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Friday, October 06, 2006 9:37 AM
To: users_at_jaxb.dev.java.net
Subject: Re: Inheritance and class callback methods

Yevgeny Shakhnovich wrote:
> Hi,
> I wonder if I hit a bug or this is in the accordance to the spec.
> I have class A extending class B. Class B has protected
"afterUnmarshal"
> callback. Class A does not have such method. I was unmarshalling class
> A and expected the callback to be hit. It did not happen. Looking at
> the source, I realized why. To search for "afterUnmarshal" callback,
> the code uses "getDeclaredMethods" which returns only declared methods
> and not inherited ones.
> Of course, there is a simple workaround. Also, it is easy to "fix"
> JAXB code. My question is there any reason for not looking at the
> inheritance hierarchy or it is simply a bug.

My first reaction is that it sounds like a bug. How does Java
serialization callback methods behave with this regard?

If you have, say, readObject in the base class, does this method invoked
when you are processing derived types?


--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
 
<http://585414.sigclick.mailinfo.com/sigclick/0C090C07/00064D01/084D0B09
193121.jpg>