Bug 244273 - [1.4][compiler]Inconsistency Output Bytes between javac and Eclipse Compiler with options -g{lines, vars}
Summary: [1.4][compiler]Inconsistency Output Bytes between javac and Eclipse Compiler ...
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-15 02:36 EDT by william.zeng CLA
Modified: 2010-09-14 00:27 EDT (History)
3 users (show)

See Also:


Attachments
source file and runtime file, disassembly result (28.04 KB, application/octet-stream)
2008-08-17 21:26 EDT, william.zeng CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description william.zeng CLA 2008-08-15 02:36:31 EDT
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.
Comment 1 Olivier Thomann CLA 2008-08-15 13:36:03 EDT
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.
Comment 2 william.zeng CLA 2008-08-17 21:26:34 EDT
Created attachment 110186 [details]
source file and runtime file, disassembly result
Comment 3 william.zeng CLA 2008-08-17 21:34:50 EDT
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!
Comment 4 Olivier Thomann CLA 2008-08-19 15:18:38 EDT
You cannot run javac from Eclipse without using an ant script.
Comment 5 Olivier Thomann CLA 2008-08-19 15:19:31 EDT
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.
Comment 6 Olivier Thomann CLA 2008-08-19 15:22:18 EDT
The differences are mostly different indexes in the constant pool. Nothing to worry about.
Comment 7 Olivier Thomann CLA 2010-08-05 17:21:05 EDT
Closing as INVALID.
There is no reason why Eclipse compiler output would be identical to javac one.
Comment 8 Srikanth Sankaran CLA 2010-09-14 00:27:26 EDT
Verified for 3.7 M2