10

Many IDE's debugger match the physical line number. I'm looking for java decompiler with saving actual line number in decompiling code.

http://java.decompiler.free.fr/ is not one.

Jason S
  • 184,598
  • 164
  • 608
  • 970
qwazer
  • 7,174
  • 7
  • 44
  • 69
  • it shows you line numbers in comments. – Bozho Apr 29 '11 at 12:03
  • I'm not sure I understand the question; you want a decompiler that reproduces the original line numbers from the original .java source code? – Joseph Ottinger Apr 29 '11 at 12:04
  • 1
    line number in comment's doesn't satisfy me, becouse IDE debugger doesn't bind line number in comments – qwazer Apr 29 '11 at 12:10
  • +1 I've favorited the question because I'm looking for that since a long time. There are a couple of Java decompilers around but jad is getting old (can't cope with Java 5) and there is no good replacement in sight. – Aaron Digulla Apr 29 '11 at 12:22
  • I suppose, that's possible to write my own reorder algoritm, that input jd decompiled file with line numbers in comment and output reordered java code, that can be used with IDE Debugger. May be i'll write this small programm on this holiday's – qwazer Apr 29 '11 at 12:38
  • 4
    The next version, of JD-Eclipse, will include this feature. The current version can not align the decompiled source code with original line numbers, but an extension, written by Alex Kosinsky, adds blank lines in the source code. Maybe, it can help you. http://java.decompiler.free.fr/?q=node/554 – Emmanuel Dupuy Apr 30 '11 at 12:24

5 Answers5

6

I have released a companion plugin to JD Eclipse which fixes the line numbers issue and makes it easier to switch between real and decompiled source: http://mchr3k-coding.blogspot.co.uk/2012/07/realignment-for-jd-eclipse.html

mchr
  • 6,161
  • 6
  • 52
  • 74
  • 2
    Github repo: https://github.com/mchr3k/jdeclipse-realign - works fantastically well on Eclipse 3.7/Java 6; finally an easy way to debug without source! – Caspar Aug 24 '12 at 10:05
3

I actually added an "Align code for debugging" feature to JD-Eclipse. I've been using it for the last year.

If anyone wants to give it a try until Emmanuel Dupuy releases his own version, you can get it from here. More details inside README.txt

esandrei
  • 41
  • 2
2

Have you tried JadClipse

Nikunj
  • 3,100
  • 2
  • 20
  • 19
  • 2
    +1 Note: JadClipse reorders the source code after jad has decompiled it trying to move the lines to where they belong (enable "Align Code For Debuggin"). That sometimes works. But since JAD doesn't work well with all new features in Java 5, it also break often. – Aaron Digulla Apr 29 '11 at 12:25
0

You might want to look at this, as well:

https://github.com/shimonmagal/jdgui-source-line-fixer

It takes in the zip from jd-gui and outputs a different zip, with line numbers fixed.

Not the most convenient maybe, but does the job.

user967710
  • 1,815
  • 3
  • 32
  • 58
0

I've tried all of the decompilers I'm aware of for Eclipse and I've yet to see one that lines up the original line numbers with the source it shows. The JD-Eclipse plugin you referenced comes the closest with comments for the original line numbers. It's too bad it doesn't munge the generated source to line them up. Generally the best thing to do is track down the original source to attach to Eclipse. Otherwise you just have to hunt for the line number in the comments with JD-Eclipse.

WhiteFang34
  • 70,765
  • 18
  • 106
  • 111