|classes compiled by Eclipse are different from classes using ANT build.xml file created by Eclipse. [message #642739]
||Thu, 02 December 2010 10:06
| No real name
Registered: May 2010
Using: (commandline) Apache Ant version 1.8.1 and Eclipse Platform Version: 3.4.2 (Ganymede)|
I've a project in Eclipse which consists of 117 Java files. When I do an Eclipse buildall 135 .class file are generated (135 instead of 117 because inner classes are used).
I created an build.xml file for Ant using File->Export->Ant buildfile. I checked 'create target to compile project using Eclipse compiler' . When I run this ant file from the commandline 137 .class file are generated and the programs can be run. I've noticed a few things and have a few questions:
1) I used a diff program called 'beyond compare' (BC) to compare the generated classes by Eclipse and Ant. It turns out that the generated classes are different.
2) The Ant file generated two extra .class files like JCatImportMapping$1.class. There is a JCatImportMapping.java file which contains two innerclasses which results in .class files like JCatImportMapping$JCatImportMappingItem.class. I've decompiled the JCatImportMapping$1.class using a program called JD-GUI (uses JC-core) and the contents is
Hence the .class is in principle empty !!
3) I've decompiled a few .class file generated by Eclipse and Ant. Functionally they probably are the same but the decompiled sourcecode is different. Static blocks at the bottom instead of at the top, if statements where arguments are split across multiple lines, even two if blocks which have changed places. I decompiled x.class generated by Eclipse, decompiled it and changed file x.java with the decompiled version. When I tell eclipse to compile the x.java file the generated x.class file is different then the original x.class
1) Does anyone know why the classes created by Eclipse and the Ant file created by Eclipse generate are different .class files?
2) Is there a way to instruct Ant to geneate the same .class files as Eclipse?
3) Is there a way to see what exactly Eclipse compiles and with what parameters when I do a buildall.
3) Does anyone know where the two new .class come from and what there function is. To me it sounds like they don't do anything.
4) With regard to decompiling. I've read at http://www.faqs.org/docs/Linux-HOWTO/Java-Decompiler-HOWTO.h tml that to check if a decompiler functions properly one has to compile the sourcode of the the decompiled .class file and then the orginal .class and the newly created one have to be the same. This clearly isnt' the case here. Do I need another decompiler or is this what one can expect?
Any help is very much appreciated.
[Updated on: Thu, 02 December 2010 10:12]
Report message to a moderator