Re: final transient fields serialization

2009-12-03 Thread David M. Lloyd
This is exactly the solution I present to users of JBoss Marshalling. The access check performed verifies that the field being updated is a non-static instance field (final or otherwise, any access level) of the caller's class; IllegalAccessException is then not thrown at "runtime" when the fi

Re: final transient fields serialization

2009-12-03 Thread Tom Hawtin
Peter Jones wrote: Regarding a language solution, though, I don't see how to avoid making a [...] `readObject` is a `psuedo-constructor`. Ideally it would be a real constructor (with choice of defaultReadObject/readFields similar to super), but that would require significant changes to the J

Re: final transient fields serialization

2009-12-02 Thread Peter Jones
Pawel, I agree that the current reflection approach is unwieldy and otherwise problematic. Regarding a language solution, though, I don't see how to avoid making a mess of the definite assignment/unassignment semantics for final fields. (Of course deserialization itself effectively subve

Re: final transient fields serialization

2009-11-29 Thread Pawel Veselov
Hi Peter, not at all, I was late on replying to all the answers I've got myself. Anyway, my thoughts around this were that I wouldn't consider it reasonable to put that much, and that kind of code around re-instantiation of final transient fields, at least for the sheer sake of them being final.

Re: final transient fields serialization

2009-11-29 Thread Peter Jones
On Nov 10, 2009, at 2:30 AM, Rémi Forax wrote: Le 10/11/2009 00:38, David M. Lloyd a écrit : On 11/09/2009 03:30 PM, Pawel Veselov wrote: [snip] It seems that it would be nice if either the final fields were initialized in a separate block that would be executed on deserialization, or if rea

Re: final transient fields serialization

2009-11-29 Thread Peter Jones
Pawel, Sorry for the late followup, but you might also want to read these RFEs: http://bugs.sun.com/view_bug.do?bug_id=6379948 http://bugs.sun.com/view_bug.do?bug_id=6252102 -- Peter On Nov 9, 2009, at 6:54 PM, David Holmes - Sun Microsystems wrote: Pawel, Pawel Veselov said the following

Re: final transient fields serialization

2009-11-09 Thread Rémi Forax
Le 10/11/2009 00:38, David M. Lloyd a écrit : On 11/09/2009 03:30 PM, Pawel Veselov wrote: Hi, it again caught my attention, and I though that may be there is something that can be done about this. The issue is obvious -- having 'final transient' instance fields makes little sense if the object

Re: final transient fields serialization

2009-11-09 Thread David Holmes - Sun Microsystems
Pawel, Pawel Veselov said the following on 11/10/09 07:30: it again caught my attention, and I though that may be there is something that can be done about this. The issue is obvious -- having 'final transient' instance fields makes little sense if the object is ever serialized. Logically, ther

Re: final transient fields serialization

2009-11-09 Thread David M. Lloyd
On 11/09/2009 03:30 PM, Pawel Veselov wrote: Hi, it again caught my attention, and I though that may be there is something that can be done about this. The issue is obvious -- having 'final transient' instance fields makes little sense if the object is ever serialized. Logically, there may be pe