[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: ClassInfo being serializable

adrian@jboss.org do-not-reply at jboss.com
Fri Jul 13 06:43:22 EDT 2007


"alesj" wrote : "adrian at jboss.org" wrote : 
  |   | But you'll probably need to introduce a Reflection* subclass for 
  |   | each to make the serialization work,
  |   | 
  | I did a quick change - moved readResolve() from ClassInfoImpl to ReflectClassInfoImpl.
  | How come all the tests still work?
  | Not covering all the corner cases?
  | 

When I said you need to post in the forums, I meant with proposed solutions,
not for me to do your work for you. ;-)

If I make those changes and add extra System.out.printlns to the before
and after object of serialization, I get the following output:


  | 139 DEBUG [IntrospectionArrayUnitTestCase] Type: class [Lorg.jboss.test.classinfo.support.ClassInfoAnnotationClass;
  | BEFORE ======> ArrayInfoImpl at 17653ae{name=[Lorg.jboss.test.classinfo.support.ClassInfoAnnotationClass;}
  | AFTER ======> ArrayInfoImpl at 134f69a{name=[Lorg.jboss.test.classinfo.support.ClassInfoAnnotationClass;}
  | 

So these are not the same object. i.e. no ReadResolve

You should really be asserting that you get the same object back.
Also these tests are inadequete. You are only testing the ClassInfo parts
of the serialized objects.
Each test must serialize and deserialize its own object and test ALL its fields.
e.g. does the array have the correct component type, etc. Has it been
readResolved properly?

"adrian at jboss.org" wrote : 
  |  i.e. add readResolve() into the introspection factory.
  | 
What about if I add a super class for all Reflection* subclases with readResolve there?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063924#4063924

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063924



More information about the jboss-dev-forums mailing list