Vineflower / vineflower

Modern Java decompiler aiming to be as accurate as possible, with an emphasis on output quality. Fork of the Fernflower decompiler.
https://vineflower.org/
Apache License 2.0
1.13k stars 83 forks source link

Add option to exclude classes from decompilation with regex #370

Closed mvisat closed 2 months ago

mvisat commented 2 months ago

Sometimes it's unnecessary to decompile certain classes, for example libraries such as Apache Commons. Skipping the decompilation of these classes can speed up the overall decompilation time. Currently there is --only option, but it doesn't cover cases where we don't know which classes in the JAR to decompile.

This PR adds that option to the decompiler (currently it's --excluded-class-regex or -exc for shorthand). It will skip the decompilation if the specified regex matches the fully qualified name of the class.

Examples:

# exclude all classes in org.apache package
java -jar vineflower.jar '-exc=org/apache/.*' input.jar out_dir

# exclude classes from multiple packages
java -jar vineflower.jar '-exc=org/(apache|bouncycastle)/.*|com/google/android/.*' input.jar out_dir