Bug 30357 - Incompatibility of serialization with sun jdk
Summary: Incompatibility of serialization with sun jdk
Status: RESOLVED DUPLICATE of bug 30209
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0.2   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 2.1 M5   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-28 03:48 EST by Martin Hackmann CLA
Modified: 2003-01-28 06:21 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Hackmann CLA 2003-01-28 03:48:33 EST
I compiled the following java file with eclipse and with the sun JDK 1.3.1_05. 
The compiler compliance level was '1.3' and to ' use default compliance'.

The generated class files were different because of the use of the ".class"-
expression which yield to differen internal variables in the class file (I 
havent checked if the specification is really clear hear) The problem is, that 
this difference yield to a different serialveruid. The consequence is that the 
generated classes are not compatible when using object serialization for 
example in Java RMI.

This java-File shows the Problem:

import java.io.Serializable;

public class TestSerialVerUID implements Serializable {
    public Class getMyClass() {
        return TestSerialVerUID.class;
    }
}

The result of serialver of the JDK 1.3.1_05-generated class:
TestSerialVerUID:    static final long serialVersionUID = -2440654353074320297L;

The result of serialver of the wsasd 5.0 (eclipse 2.0.2) generated class:
TestSerialVerUID:    static final long serialVersionUID = -2440654353074320297L;

To demonstrate the difference here the output of javap of the
JDK 1.3.1_05-generated class:

Compiled from TestSerialVerUID.java
public class TestSerialVerUID extends java.lang.Object implements 
java.io.Serializable {
    static java.lang.Class class$TestSerialVerUID;
    public TestSerialVerUID();
    public java.lang.Class getMyClass();
    static java.lang.Class class$(java.lang.String);
}

The javap-output of the eclipse-generated class:
Compiled from TestSerialVerUID.java
public class TestSerialVerUID extends java.lang.Object implements java.io.Serial
izable {
    static java.lang.Class class$0;
    public TestSerialVerUID();
    public java.lang.Class getMyClass();
}

I hope this hints will help you to fix this problem.

Best regards

Martin Hackmann
Comment 1 Philipe Mulet CLA 2003-01-28 06:21:50 EST
This isn't a bug, but an implementation issue which isn't covered by the Java 
specs. None of the compiler is right or wrong for this aspect, they just happen 
to behave differently on an unspecified behavior.

See more information in bug 30209

*** This bug has been marked as a duplicate of 30209 ***