fix: CFR default options populated incorrectly
@@ -37,10 +37,16 @@ public class CfrDecompiler extends Decompiler<String> {
for (PermittedOptionProvider.ArgumentParam<?, ?> param : OptionsImpl.getFactory()
.getArguments()) {
String defaultValue = getOptValue(param);
- // Value is conditional based on version, just take the first given default.
- if (defaultValue != null && defaultValue.contains("if class"))
- defaultValue = defaultValue.substring(0, defaultValue.indexOf(" "));
+ if (defaultValue != null) {
+ // For options that depend on other options or class file specifics, ignore them
+ if (defaultValue.contains("Value of option") || defaultValue.contains("if class"))
+ continue;
+ // Only populate boolean options
+ if (defaultValue.equals("true") || defaultValue.equals("false"))
map.put(param.getName(), defaultValue);
+ // There are only a few non-boolean options, and even supplying 'recpass'
+ // causes some issues in edge cases (https://github.com/leibnitz27/cfr/issues/253)
+ }
}
ConfDecompile config = getController().config().decompile();
if (config.showSynthetic) {
