本文介绍了选择并测试java反编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在尝试找到最好的java反编译器,我找到了这些:

Now I'm trying to find the best java decompiler, I found these:






  • http://java.decompiler.free.fr/
  • http://www.reversed-java.com/fernflower/
  • http://dj.navexpress.com/
  • http://cavaj-java-decompiler.en.softonic.com/

使用这些反编译器,我处理此类的字节代码:

With these decompilers I handle byte code of this class:

public class ss
{
public static void main(String args[])
{
  try{
   System.out.println("try");

  }
  catch(Exception e)
  {
   System.out.println("catch");
  }
  finally
  {System.out.println("finally");}
}
}

我得到以下结果:

fernflower:

public class ss {

   public static void main(String[] var0) {
      try {
         System.out.println("try");
      } catch (Exception var5) {
         System.out.println("catch");
      } finally {
         System.out.println("finally");
      }

   }
}

DJ Java Decompiler:

import java.io.PrintStream;

public class ss
{

    public ss()
    {
    }

    public static void main(String args[])
    {
        System.out.println("try");
        System.out.println("finally");
        break MISSING_BLOCK_LABEL_50;
        Exception exception;
        exception;
        System.out.println("catch");
        System.out.println("finally");
        break MISSING_BLOCK_LABEL_50;
        Exception exception1;
        exception1;
        System.out.println("finally");
        throw exception1;
    }
}

cavaj:

import java.io.PrintStream;

public class ss
{

    public ss()
    {
    }

    public static void main(String args[])
    {
        System.out.println("try");
        System.out.println("finally");
        break MISSING_BLOCK_LABEL_50;
        Exception exception;
        exception;
        System.out.println("catch");
        System.out.println("finally");
        break MISSING_BLOCK_LABEL_50;
        Exception exception1;
        exception1;
        System.out.println("finally");
        throw exception1;
    }
}

http://java.decompiler.free.fr/:

import java.io.PrintStream;
public class ss
{
  public static void main(String[] paramArrayOfString)
  {
    try
    {
      System.out.println("try");
    }
    catch (Exception localException)
    {
      System.out.println("catch");
    }
    finally {
      System.out.println("finally");
    }
  }
}

我看到最好的结果在反编译器中:

I see that the best result in decompiler: http://java.decompiler.free.fr/

为了测试,我编写了非常简单的代码。你怎么看,用什么代码来测试反编译器?也许这个想法比try {} catch(){} finally {}更好?

To test, I wrote very simple code. What do you think, what code to write to test decompilers? Maybe the idea is to better than a try{} catch(){} finally{}?

推荐答案

你使用的代码测试应该测试用于编译目标类的JDK中可用的功能。例如,如果您知道目标是用Java 1.5编写的,那么可以合理地假设代码可能包含,因此您需要确保所选的反编译器正确处理它们。根据我的经验,免费提供的反编译器在1-2版本支持的功能方面往往落后于JDK版本。

The code that you use to test should test the features available the in JDK used to compile the target class. For example, if you know that your target is written in Java 1.5, it is reasonable to assume that the code might include generics, so you will want to make sure that your chosen decompiler handles them properly. In my experience, the freely available decompilers tend to lag behind the JDK releases in terms of the features they support by 1-2 releases.

根据个人试错,总的来说往往做得最好。但是,如果您正在反编译以1.3或更低版本编写的代码,我还建议您提供,,在这个领域引领潮流。

CFR, Procyon, and Fernflower lead the way in this space.

这篇关于选择并测试java反编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 00:28