Community
Participate
Working Groups
Build ID: M20071023-1652 Steps To Reproduce: 1. in Ant Script <javac sourcepath="" srcdir="." destdir="." source="1.3" target="1.2" debug="on" (debuglevel="vars" | debuglevel="lines")> <include name="${any}.java"/> </javac> 2.Eclipse Comipler Settings with: .compiler compliance level:1.4 .use default compliance settings .class file generation selectd "add varaible attributes to generated class files" or "add line number attributes to generated class files" 3.To compile a same .java file with above methods, but obtain different .class file. 4. Use javap to disassemble two class file and compare, find inconsistency bytes. So a big trouble found in the progress that I identified the source file version with using javap tool between the classfile compiling with Ant Script and Eclipse(Eclipse compiling output is running on the Product Environment, Ant Script output come from the SCM ). More information: We are using a official JDK to develop Java program, and wish to obtain official output .class to run on official JRE. I surely didn't need Eclipse Compiler to help me.
You cannot expect .class files produced by javac and the Eclipse compiler to be identical byte-per-byte. If you better describe the differences we might tell you why they are there. Would you have a source file to try ? Lowering severity as right now there is not enough information to classify this as critical.
Created attachment 110186 [details] source file and runtime file, disassembly result
Comment on attachment 110186 [details] source file and runtime file, disassembly result Hey, I think about it is not a bug but a functional requirement. Whether, we can select classical javac but not eclipse compiler in eclipse? Pls don't suggest me to use Ant integrated with Eclipse. Thx!
You cannot run javac from Eclipse without using an ant script.
You could however run the Eclipse batch compiler from your ant script to make sure you end up with the same .class files using Eclipse and using an ant script outside of Eclipse.
The differences are mostly different indexes in the constant pool. Nothing to worry about.
Closing as INVALID. There is no reason why Eclipse compiler output would be identical to javac one.
Verified for 3.7 M2