harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spark shen <smallsmallor...@gmail.com>
Subject Re: [classlib] how to verify private/package private field which is required by serialized form?
Date Mon, 27 Nov 2006 01:40:49 GMT
Nathan Beyer 写道:
> On 11/26/06, Andrew Zhang <zhanghuangzhu@gmail.com> wrote:
>> On 11/27/06, Spark Shen <smallsmallorgan@gmail.com> wrote:
>> >
>> > Reflection may be feasible, but a downside hit on performance.
>> >
>> > I have a suggestion: writing a subclass, open that field using a 
>> getter,
>>
>>
>> How can we get the field if it's private?
>
> Write an accessor that looks up the declared field, set it as
> accessible and then read it. This requires that the security policy
> allows it.
Good idea. And IMHO, this may not over-perform reflection. :-)

Best regards
>
> -Nathan
>
>>
>> and
>> > then customize serialization process for this subclass to deliberate
>> > invoke
>> > this getter. Is this possible?
>> >
>> >
>> > 2006/11/26, Andrew Zhang <zhanghuangzhu@gmail.com>:
>> > >
>> > > Hi folks,
>> > >
>> > > I encountered a problem when writing serialization test for
>> > > SerialJavaObject
>> > > class. There're two fields are required by serialized form: 
>> Object obj,
>> > > and
>> > > Vector chain. But there's no public method is available to get chain
>> > > variable. The question comes:
>> > > How can I verify deserilized object, by reflection? How do we handle
>> > such
>> > > problem in other modules? Any suggestions?
>> > >
>> > > Thanks in adavance!
>> > >
>> > > --
>> > > Best regards,
>> > > Andrew Zhang
>> > >
>> > >
>> >
>> >
>> > --
>> > Spark Shen
>> > China Software Development Lab, IBM
>> >
>> >
>>
>>
>> -- 
>> Best regards,
>> Andrew Zhang
>>
>>
>



Mime
View raw message