[ANN] clj-java-decompiler - decompile any Clojure form into Java in the REPL

179 views
Skip to first unread message

Alexander Yakushev

unread,
Jan 29, 2018, 9:58:38 AM1/29/18
to Clojure
I'm happy to release clj-java-decompiler[1] today, a wrapper around Procyon[2] Java decompiler. With it, you can cut the feedback loop of writing a file, AOT-compiling it, and then running the classes through a decompiler to a single call in the REPL.

user> (clj-java-decompiler.core/decompile
       
(loop [i 100, sum 0]
         
(if (< i 0)
            sum
           
(recur (unchecked-dec i) (unchecked-add sum i)))))

// ... Output trimmed

   
public static Object invokeStatic() {
       
long i = 100L;
       
long sum = 0L;
       
while (i >= 0L) {
           
final long n = i - 1L;
            sum
+= i;
            i
= n;
       
}
       
return Numbers.num(sum);
   
}

You can read more about my motivation, usage scenarios, and other information regarding Java decompilers in my post "Introspection tools: Java decompilers"[3].

Laurens Van Houtven

unread,
Jan 29, 2018, 11:26:34 AM1/29/18
to clo...@googlegroups.com
This is awesome! Thanks Alexander!

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Howard Lewis Ship

unread,
Jan 29, 2018, 1:14:33 PM1/29/18
to clo...@googlegroups.com
Very impressive; this is already answering some nagging questions I've had about code generation, especially with protocols and defrecord.
--
Howard M. Lewis Ship

Senior Mobile Developer at Walmart Labs

Creator of Apache Tapestry
Reply all
Reply to author
Forward
0 new messages