Community
Participate
Working Groups
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
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 ***