想修改tools.jar里面的一个类,jdk自带的源码没有,网上down下来的源码版本对不上,错误一堆,用反编译出来的源码也是错误一大堆。谁有好什么解决方法没?

解决方案 »

  1.   

    混淆器肯定是没有的,就是jdk的tools里面的com.sun.tools.javac.jvm.ClassReader
    整个类有点大,加上里面有很多内部类和匿名类,我用jad反编译出来完全没办法用
      

  2.   

    开始也想是继承一个新类,关键问题是我调用时不是直接调用的这个类,中间还会走很多其他的class,而且都一样的没有源码。
      

  3.   

    搞定了,javassist果然强大。                    CtClass ctclass=pool.get("com.sun.tools.javac.jvm.ClassReader");
    CtMethod m=ctclass.getDeclaredMethod("readClassFile");
    String s=FileUtil.readFile("a.txt", "gbk");
    m.insertBefore(s);
    byte[] b=ctclass.toBytecode();
    FileOutputStream f=new FileOutputStream("ClassReader.class");