leibnitz27 / cfr

This is the public repository for the CFR Java decompiler
https://www.benf.org/other/cfr
MIT License
1.93k stars 249 forks source link

Question: Is there any switch to specify a single class to be decompiled? #343

Open drori200 opened 1 year ago

drori200 commented 1 year ago

Got a situation where i need to decompile only a specific class, looking at the switches and their descriptions the only thing that works like what I need is jarfilter but i don't know how to specify the regex for a single class. doing `--jarfilter "com.example.className" or "com.example.className.class" do not work.

leibnitz27 commented 1 year ago

You might get additional classes because the argument is a regex not a simple string

C:\code\cfr\target\classes>java -jar c:\Downloads\cfr-0.135.jar --help jarfilter CFR 0.135

'jarfilter':

Substring regex - analyse only classes where the fqn matches this pattern. (when analysing jar).

Range : string


i.e. org.benf.(foo|bar).Bob would match multiple classes. (and strictly speaking the dot will match any character, but hey laziness ;) )

I suspect what you're hitting is

org.benf.cfr.reader.bytecode.CodeAnalyser

will match

org.benf.cfr.reader.bytecode.CodeAnalyserWholeClass

because it's a regex, you can just anchor it.

--jarfilter "^org.benf.cfr.reader.bytecode.CodeAnalyser$"