Changeset 15283


Ignore:
Timestamp:
05/16/20 06:29:32 (6 months ago)
Author:
Mark Evenson
Message:

abcl-introspect: fernflower decompiler working
Adapted from (Alan Ruttenberg)

Location:
trunk/abcl/contrib/abcl-introspect
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/contrib/abcl-introspect/fernflower.asd

    r15280 r15283  
    11(defsystem fernflower
     2  :depends-on (alexandria abcl-introspect)
    23  :homepage "https://github.com/fesh0r/fernflower"
    3   :version "2.5.0"
     4  :version "1.0.0.20271018"
    45  :description "An analytical decompiler for Java" :components
    56  ((:module mvn-libs :components
    6             ((:mvn "org.jboss.windup.decompiler.fernflower/fernflower/2.5.0.Final")))
     7      ((:mvn "org.jboss.windup.decompiler.fernflower/windup-fernflower/1.0.0.20171018")))
    78   (:module source
    89    :depends-on (mvn-libs)
  • trunk/abcl/contrib/abcl-introspect/fernflower.lisp

    r15280 r15283  
    1111
    1212(defun disassemble-class-bytes (object)
    13   (let ((sys::*disassembler*
    14           ;; FIXME: use same java that is hosting ABCL
    15           ;; !!! unclear options; wants to write output to filesystem
    16           (format nil "java -cp ~a org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler"
    17                   (fernflower-classpath))))
    18     (sys:disassemble-class-bytes object)))
     13  (uiop/stream::with-temporary-file (:pathname p :type "class")
     14    (ext::write-class object p)
     15    (let* ((directory
     16             (namestring (truename (make-pathname :directory (pathname-directory p)))))
     17     (path
     18             (namestring (truename p)))
     19           (command
     20       (format nil "java -cp ~a org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler ~a ~a"
     21                     (fernflower-classpath) p directory))
     22           (output
     23             (namestring (make-pathname :defaults p :type "java"))))
     24      (uiop:run-program command)
     25      (let ((result (alexandria:read-file-into-string output)))
     26        (sys::print-lines-with-prefix result)))))
    1927
    2028(eval-when (:load-toplevel :execute)
    2129  (pushnew `(:fernflower . abcl-introspect/jvm/tools/fernflower::disassemble-class-bytes)
    2230           sys::*disassemblers*)
    23   (format cl:*load-verbose* "~&; ~a: Successfully added fernflower disassembler.~%" *package*))
     31  (format cl:*load-verbose* "~&; ~a: Successfully added fernflower decompiler.~%" *package*))
    2432
    2533
Note: See TracChangeset for help on using the changeset viewer.