Make enum CLI arguments match documented format#1787
Merged
skylot merged 1 commit intoskylot:masterfrom Feb 27, 2023
Merged
Conversation
Currently if you do `jadx --help`, it says the `--deobf-cfg-file-mode` option accepts the value `read-or-save`. However, if you give it that option, it instead prints the following error message: ``` java.lang.IllegalArgumentException: 'read-or-save' is unknown, possible values are: read, read-or-save, overwrite, ignore at jadx.cli.JadxCLIArgs$DeobfuscationMapFileModeConverter.convert(JadxCLIArgs.java:524) at jadx.cli.JadxCLIArgs$DeobfuscationMapFileModeConverter.convert(JadxCLIArgs.java:516) at com.beust.jcommander.JCommander.convertValue(JCommander.java:1340) at com.beust.jcommander.ParameterDescription.addValue(ParameterDescription.java:249) at com.beust.jcommander.JCommander.processFixedArity(JCommander.java:920) at com.beust.jcommander.JCommander.processFixedArity(JCommander.java:901) at com.beust.jcommander.JCommander.parseValues(JCommander.java:731) at com.beust.jcommander.JCommander.parse(JCommander.java:363) at com.beust.jcommander.JCommander.parse(JCommander.java:342) at jadx.cli.JCommanderWrapper.parse(JCommanderWrapper.java:37) at jadx.cli.JadxCLIArgs.processArgs(JadxCLIArgs.java:211) at jadx.cli.JadxCLI.execute(JadxCLI.java:35) at jadx.cli.JadxCLI.main(JadxCLI.java:20) ``` This commit changes all the enum parsers - except the one that already does this - to do the inverse string of `enumValuesString`, so the documented behavior works.
jakewins
commented
Feb 27, 2023
| @Override | ||
| public UseKotlinMethodsForVarNames convert(String value) { | ||
| try { | ||
| return UseKotlinMethodsForVarNames.valueOf(value.replace('-', '_').toUpperCase()); |
Contributor
Author
There was a problem hiding this comment.
Note that this one already did the - -> _ replacement.
One thing I'm unclear on is if the toUpperCase() should include the Locale.ROOT constant that the enumValuesString passes.. though I don't follow what that's doing - the characters in the enums are all ASCII to begin with?
skylot
approved these changes
Feb 27, 2023
Owner
|
@jakewins thanks! |
skylot
added a commit
that referenced
this pull request
Feb 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently if you do
jadx --help, it says the--deobf-cfg-file-modeoption accepts the valueread-or-save.However, if you give it that option, it instead prints the following error message:
This commit changes all the enum parsers - except the one that already does this - to do the inverse string of
enumValuesString, so the documented behavior works.❗ Please review the guidelines for contributing
Description
Please describe your pull request.
Reference issue it fixes.