I'm having a small issue where some java classes compiled in eclipse are slightly different from the classes compiled by a standalone ecj (from the same source code). How can I find the version of ecj that is being used by eclipse? (I'm assuming that's where the difference is)
Asked
Active
Viewed 1,653 times
5

Andrew Eisenberg
- 28,387
- 9
- 92
- 148

aditsu quit because SE is EVIL
- 4,019
- 1
- 34
- 48
-
Did you compile them with `javac`? I've come across a similar post a while ago http://stackoverflow.com/questions/3061654/what-is-the-difference-between-javac-and-the-eclipse-compiler – Georgian Aug 28 '13 at 21:13
-
@GGrec In eclipse I just compiled normally, it uses ecj afaik. For the standalone compilation, I specifically used ecj. There should be no javac involved. – aditsu quit because SE is EVIL Aug 28 '13 at 21:15
-
Huh. Interesting. I'm curious to see a relevant answer. Are you decompiling your classes by any chance? How do you notice the difference? – Georgian Aug 28 '13 at 21:27
-
@GGrec rsync :) But I guess I could compare the disassembled code too, I'll look into that – aditsu quit because SE is EVIL Aug 28 '13 at 21:30
-
Yeah javap -c shows some small differences, such as pop vs astore_1. Anyway I might have an answer... – aditsu quit because SE is EVIL Aug 28 '13 at 21:48
1 Answers
3
The version of ecj is specified by the version of JDT that you are using. Go to Help -> About Eclipse -> Installation Details -> Plugins. Look for the org.eclipse.jdt.core version.
I'm guessing that this will answer your question as posed here, but probably won't solve your problem as to why the classes are different.
You should also realize that if you use different options for compilation, then your class files may be slightly different. I forget offhand how to specify options in ecj (I think you pass in a properties file). But inside of Eclipse, the options are specified by merging the workspace and the project options. I'd guess that your differences come from an options mismatch rather than a version mismatch (just a guess though).

AlbeyAmakiir
- 2,217
- 6
- 25
- 48

Andrew Eisenberg
- 28,387
- 9
- 92
- 148
-
Yeah I got a similar answer on irc, I was about to post it. Here it's more like "Help -> About Eclipse -> Installation Details -> Plugins". The version I got is 3.8.3.xx-20130703-1700-e42-RELEASE which seems to imply ecj 3.8.3. – aditsu quit because SE is EVIL Aug 28 '13 at 21:56
-
I think the differences are due to optimization changes or sometimes bug fixes. It could also possibly be due to different options, but in order to find out, I should use the same ecj version first anyway :) – aditsu quit because SE is EVIL Aug 28 '13 at 22:01
-
I see you have groovy-eclipse installed, which uses a patched version of the JDT core plugin. If you want to use the same ecj, then make sure to use the one from groovy-eclipse. – Andrew Eisenberg Aug 28 '13 at 23:19