What would be a more accurate decompiler than jad for Eclipse to get rid of <-MISALIGNED ->?

I have used jad for many years, most of them with the Jadclipse plugin for eclipse, which makes it quite usable. Especially with "Align Debugging Code", which allows you to see decompiled code for any line in the stack trace. Very nice.

Unfortunately, I have seen more and more that the <- MISALIGNED โ†’ compiler โ†’ is idle, which is most likely because jad expects the class file to be in order, which clearly does not correspond to the Java 6 runtime library. Therefore, when writing the file, and the instruction says "this is line 100", then 99 empty lines are written, and if then the next instruction says "this is for line 10", then jad cannot rewind to put this output there, but simply prints from the comment that itโ€™s not in that place.

Here is an example HttpURLConnection:

  protected HttpURLConnection(URL url, Proxy proxy, Handler handler1) { /* <-MISALIGNED-> */ /* 603*/ super(url); /* <-MISALIGNED-> */ /* 192*/ ps = null; /* <-MISALIGNED-> */ /* 196*/ errorStream = null; /* <-MISALIGNED-> */ /* 199*/ setUserCookies = true; /* <-MISALIGNED-> */ /* 200*/ userCookies = null; /* <-MISALIGNED-> */ /* 220*/ currentProxyCredentials = null; /* <-MISALIGNED-> */ /* 221*/ currentServerCredentials = null; /* <-MISALIGNED-> */ /* 222*/ needToCheck = true; /* <-MISALIGNED-> */ /* 223*/ doingNTLM2ndStage = false; /* <-MISALIGNED-> */ /* 224*/ doingNTLMp2ndStage = false; /* <-MISALIGNED-> */ /* 226*/ tryTransparentNTLMServer = NTLMAuthentication.supportsTransparentAuth(); /* <-MISALIGNED-> */ /* 227*/ tryTransparentNTLMProxy = NTLMAuthentication.supportsTransparentAuth(); / 

The question now is if there is another decompiler that generates more accurate line output. The actual decompilation does not have to be extremely large or anything else, but I really like it to look like Java Stack Trace. If this works well with Jadclipse, it is even better.

+4
source share
3 answers

The formatting issue for debugging comes from jadclipse , not from jad . jad does not have this feature.

The jadclipse plugin has a small section of code in the class names of DebugAlignWriter , which does this:

 if((align = getAlignTarget(aLine)) != -1) { if(align < curLine) { if(curLine != 0) { out.write(10); } out.write("/* <-MISALIGNED-> */ "); out.write(aLine); curLine++; } else if(align == curLine) { out.write(aLine); } else { for(; align > curLine; curLine++) { out.write(10); } out.write(aLine); } 

}

It basically tries to align output from jad .

So the main reason is that jad creates output that is not necessarily in reading order. Unfortunately, I cannot shed light on why jad acts this way. According to jad help there is no way to control the order.

I noticed in jadclipse that if you set JadClipse-> Formatting-> Do not insert a new line before opening the brackets - it will reduce the number of /* <-MISALIGNED-> */ segments because of the nature of how it works.

In addition, if you checked the Output option before methods , it can increase the number of segments /* <-MISALIGNED-> */ , so avoid this.

+2
source

JD-Eclipse is a very good decompiler that also handles java 7 functions.

It does not yet have the function "Align Code for Debugging", but I added it myself. I used it over the past year.

I also handle cases where the line needs to be moved backward; I still mark it as MISALIGNED to signal a special case, but at least it's placed on the right line.

If someone wants to try it, you can download it from here . More details inside README.txt

+1
source

I use jad with minimal formatting, and then use the eclipse format command, as I can make it fit my preferred style from the settings.

0
source

All Articles