cfr icon indicating copy to clipboard operation
cfr copied to clipboard

API docs

Open ericdallo opened this issue 4 years ago • 5 comments

Hello, awesome project, I'm trying to use it on clojure-lsp to decompile .class files, any change of having a API docs on how to use CFR from JVM directly? I know I should probably use CFRDriver, but I may be missing something :)

ericdallo avatar Mar 26 '22 16:03 ericdallo

Or here's another one, which basically describes this page https://www.benf.org/other/cfr/api/

https://github.com/leibnitz27/cfr_client

leibnitz27 avatar Mar 27 '22 08:03 leibnitz27

Thank you both! I managed to make it work this way on Clojure: https://github.com/clojure-lsp/clojure-lsp/blob/master/lib/src/clojure_lsp/feature/dependency_content_reader.clj#L32-L35

But for some reason, getting the stdout is not always reliable, some times it comes as a empty string, my workaround was to write to a separated file and then read that file, is that any way to have a API that returns the string content instead of write to file or println?

ericdallo avatar Mar 27 '22 14:03 ericdallo

Your link is broken, can't read - but - you don't have to use stdout - use a sink as here : https://github.com/leibnitz27/cfr_client/blob/master/src/org/benf/cfr_client_example/WithBetterSink.java

leibnitz27 avatar Apr 01 '22 03:04 leibnitz27

Sorry, fixed link: https://github.com/clojure-lsp/clojure-lsp/blob/ce522c5ef10da0bd84cc4bef6cb57ceb8987f6c0/lib/src/clojure_lsp/feature/java_interop.clj#L33-L36

@leibnitz27 you mean I could use a custom sink to not print to stdout but return the content of the decompiled class?

ericdallo avatar Apr 01 '22 14:04 ericdallo