|
Quick Lists
|
|
Bug ID:
|
4174797
|
|
Votes
|
0
|
|
Synopsis
|
Serialization should not use reflection to set final fields
|
|
Category
|
java:serialization
|
|
Reported Against
|
1.2fcs
|
|
Release Fixed
|
1.3(kestrel-beta)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4174574
,
4174803
,
4250960
|
|
Submit Date
|
18-SEP-1998
|
|
Description
|
The current spec for Field.set says that IllegalAccessException is thrown if the underlying field is final. The spec for AccessibleObject does not say that it overrides "final". However, serialization depends on being able to use setAccessible to set final fields, when performing default serialization, and the current implementation allows this (i.e., does not match the spec). Either the spec needs to be changed, or serialization needs some other mechanism for accomplishing this.
|
|
Work Around
|
N/A
|
|
Evaluation
|
This looks like a documentation bug, but see the comments.
The technical issues need to be clarified, and then forwarded to the doc folks.
xxxxx@xxxxx 1998-09-21
I am nervous about the spec blessing setting of final fields via
reflection, more thought is required becuase we don't know how this
affects optimizing VMs. For 1.2 let us consider this a bug in
the implementation that serialization relies on -- unfortunately,
implementation bugs have a tendency to become features, despite which
we are placing this in the back burner.
Note also that we have a related wort in System.setErr() and friends
setting a final field through a native method.
xxxxx@xxxxx 1998-09-24
We should fix reflection to behave according to its spec once again. The
implementation was changed in mid 97 so that serialization could be
written entirely in Java, but the spec change did not go through an
appropriate process and was never documented.
Two things need to be done to fix this bug:
[1] Serialization needs to use JNI Set<type>Field Routines to set fields,
instead of Field.set*().
[2] JVM_SetField and JVM_SetPrimitiveField need to be changed to not allow
final fields to be set.
xxxxx@xxxxx 1999-06-29
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |