Re: [Ikvm-developers] BadImageFormatException when deserializing Object with protected final field
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2011-09-06 14:13:38
|
Hi Christian, Thanks for the bug report and the repro. I will fix the bug, but if you want to work around the problem, here's what's causes ikvmc to generate a property for the field: 1) Panel is public 2) children is protected 3) the type of children (ChildControlList) is not public This results in an inconsistent accessibility of the field children (which would make it unusable from a subclass in another assembly), so ikvmc makes a property "children" (with its type the first public base class of ChildControlList) to make the "field" accessible by subclasses. To workaround the problem you can change any of the three conditions. Regards, Jeroen > -----Original Message----- > From: Christian Prochnow [mailto:pro...@op...] > Sent: Tuesday, September 06, 2011 15:42 > To: Dawid Weiss > Cc: ikv...@li... > Subject: Re: [Ikvm-developers] BadImageFormatException when > deserializing Object with protected final field > > Hi, > > attached is a sample that reproduces the problem. > Compile with "ikvmc ikvm-bug.jar" and run the exe file. > > Output: > > Exception in thread "main" cli.System.InvalidProgramException: > at > java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1233) > at > java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1972) > at > java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888) > at > java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774 > ) > at > java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) > at > java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) > at com.os.test.Main.main(Main.java:25) > > > If i change the visibility of "ChildControlList" to public, ikvmc does > not generate a property for the field, and everything works fine. > > > Regards, > > Christian > > > > -----Ursprüngliche Nachricht----- > Von: daw...@gm... [mailto:daw...@gm...] Im Auftrag von > Dawid Weiss > Gesendet: Dienstag, 6. September 2011 14:49 > An: Christian Prochnow > Cc: ikv...@li... > Betreff: Re: [Ikvm-developers] BadImageFormatException when > deserializing Object with protected final field > > If you post a minimal example it'll be easier to verify what's wrong. > > Dawid > > On Tue, Sep 6, 2011 at 2:11 PM, Christian Prochnow <prochnow@optimal- > systems.de> wrote: > > Hi, > > > > > > > > First of all .. thanks for this great project! It really helps us to > > get rid of some proprietary Java<->.NET bridge. > > > > > > > > > > > > Using the ikvmc compiler we receive a BadImageFormatException at > > runtime when an object, which contains a protected final field, is > deserialized. > > > > It only occurs when the field got wrapped by a property. > > > > The deserialization code assumes that the property has a setter, but > > in fact only a getter has been emitted. This leads to invalid IL code > > that is being generated by the FastFieldReflector (a call without a > Method). > > > > > > > > Is this a bug in ikvm ? > > > > > > > > > > > > > > > > Keep up the good work! > > > > > > > > > > > > Best regards, > > > > > > > > Christian > > > > > > > > > > > > > > > > > > > > i.A. Christian Prochnow > > > > Software Developer > > > > Software Development > > > > > > > > flexible software | for your way of working > > > > > > > > OPTIMAL SYSTEMS GmbH > > > > Cicerostraße 26, 10709 Berlin > > > > Tel.: 030 - 8 95 70 80 > > > > Fax: 030 - 8 95 70 88 88 > > > > E-Mail: pro...@op... > > > > Web: www.optimal-systems.de > > > > > > > > Treffen Sie OPTIMAL SYSTEMS live! > > > > Die nächsten Termine finden Sie hier. > > > > > > > > Lesen Sie den aktuellen OPTIMAL SYSTEMS Newsletter: > > > > http://www.optimal-systems.de/news > > > > ______________________________________________________ > > > > Sitz der Gesellschaft: Berlin > > > > HRB 38 560 Amtsgericht Charlottenburg - USt-IdNr.: DE 136 722 551 > > > > Geschäftsführer: Karsten Renz > > > > > > > > ---------------------------------------------------------------------- > > -------- Special Offer -- Download ArcSight Logger for FREE! > > Finally, a world-class log management solution at an even better > > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > > download Logger. Secure your free ArcSight Logger TODAY! > > http://p.sf.net/sfu/arcsisghtdev2dev > > _______________________________________________ > > Ikvm-developers mailing list > > Ikv...@li... > > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > > > > > > > > +----------------------------------------------------------------------+ > | Z1 SecureMail Gateway Info - http://www.zertificon.com | > +----------------------------------------------------------------------+ > | - Die Nachricht war weder verschluesselt noch digital unterschrieben | > +----------------------------------------------------------------------+ > |