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

强颜欢笑 提交于 2019-12-05 19:33:16

The problem with formatting for debug comes from jadclipse and not from jad. jad does not have that capability.

The jadclipse plug-in has a little code section in a class names 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);
   }

}

Basically it tries to align the output from jad.

So the root cause is that jad produces an output that is not necessarily in reading order. Unfortunately I cannot shed light on why jad acts that way. According to jad help there is no way of controlling the order.

I noticed in jadclipse that if you set JadClipse->Formatting->Don't insert a newline before opening brace - it will reduce the number of /* <-MISALIGNED-> */ segments due to the nature of how it works.

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

JD-Eclipse is a very good decompiler which also handles java 7 features.

It doesn't have an "Align code for debugging" feature yet but I added one myself. I've been using it for the last year.

I also handle the cases when the line has to be moved back; I still mark it as MISALIGNED to signal the special case but at least it's placed on the right line.

If anyone wants to give it a try it can be download from here. More details inside README.txt

I use jad with as little formatting as possible and then I use eclipse's format command, as I can make it match my preferred style from the preferences.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!