Summary: | Serialization: readResolve does not work | ||
---|---|---|---|
Product: | gcc | Reporter: | Daniel Bonniot <bonniot> |
Component: | libgcj | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | CC: | gcc-bugs, java-prs |
Priority: | P2 | ||
Version: | 4.0.0 | ||
Target Milestone: | --- | ||
Host: | i386-debian-linux-gnu | Target: | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2005-07-24 19:36:35 | |
Bug Depends on: | 21785 | ||
Bug Blocks: |
Description
Daniel Bonniot
2005-02-23 15:29:37 UTC
After some investigation, I think I understand what is going wrong. It seems like readResolve is only called if it is declared in the deserialized object's class. However, it should also be searched for in the classes's parents, provided the method there is visible (that is, normal rules apply). I submitted a related testcase to mauve: http://sources.redhat.com/ml/mauve-patches/2005/msg00032.html Submitting the mauve testcases, with a classpath patch on the way. Hmm, I get: Exception in thread "main" java.lang.Error: java.lang.ClassNotFoundException: Enum$Color at Enum.main (Enum.java:34) Caused by: java.lang.ClassNotFoundException: Enum$Color at java.lang.Class.forName (natClass.cc:91) at java.io.ObjectInputStream.resolveClass (ObjectInputStream.java:782) at java.io.ObjectInputStream.readClassDescriptor (ObjectInputStream.java:534) at java.io.ObjectInputStream.readObject (ObjectInputStream.java:228) at java.io.ObjectInputStream.readObject (ObjectInputStream.java:275) at Enum.main (Enum.java:29) Which looks like a different bug. FYI, my patch for solving this bug in classpath is https://savannah.gnu.org/patch/index.php?func=detailitem&item_id=3893 My copyright assignment is on its way... I cannot comment on the current behaviour of gcc, as my nightly build seems borked. The new behaviour is caused by PR21785, which currently masks this bug. Note that this is fixed in Classpath but not in libgcj as we still have divergences in serialization. Closing as won't fix as libgcj (and the java front-end) has been removed from the trunk. |