diff options
| author | 2020-10-24 17:05:09 +0200 | |
|---|---|---|
| committer | 2020-10-24 17:17:04 +0200 | |
| commit | c0892ab3b6ec67f85b813ab610356b8dfc6eba2f (patch) | |
| tree | d9f5619698fb9a8f702228d37d7b55c9bc98c807 /enigma-cli/src/main/java | |
| parent | Merge pull request #320 from YanisBft/deobfuscated-panel (diff) | |
| download | enigma-c0892ab3b6ec67f85b813ab610356b8dfc6eba2f.tar.gz enigma-c0892ab3b6ec67f85b813ab610356b8dfc6eba2f.tar.xz enigma-c0892ab3b6ec67f85b813ab610356b8dfc6eba2f.zip | |
Do not abort decompile command on decompiler errors
As explained in PR #289, the decompilers may fail decompiling some
vanilla Minecraft classes. Although it is my opinion that these errors
should be fixed in the decompilers themselves, currently they render the
decompile CLI command useless, as no output is produced whatsoever.
The PR that was mentioned previously addressed this situation for the
GUI part of Enigma, but not for the CLI commands, which were left
untouched.
These changes modify the decompiler error strategy used by the
aforementioned CLI command to trace the errors, but continue decompiling
classes, so at least a partial output is generated. This way users will
be happy that the Enigma decompile command works, and developers will
still be motivated to fix the underlying issues.
Signed-off-by: AlexTMjugador <AlexTMjugador@users.noreply.github.com>
Diffstat (limited to 'enigma-cli/src/main/java')
| -rw-r--r-- | enigma-cli/src/main/java/cuchaz/enigma/command/DecompileCommand.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/DecompileCommand.java b/enigma-cli/src/main/java/cuchaz/enigma/command/DecompileCommand.java index cc628639..12a4e886 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/DecompileCommand.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/DecompileCommand.java | |||
| @@ -2,6 +2,7 @@ package cuchaz.enigma.command; | |||
| 2 | 2 | ||
| 3 | import cuchaz.enigma.EnigmaProject; | 3 | import cuchaz.enigma.EnigmaProject; |
| 4 | import cuchaz.enigma.ProgressListener; | 4 | import cuchaz.enigma.ProgressListener; |
| 5 | import cuchaz.enigma.EnigmaProject.DecompileErrorStrategy; | ||
| 5 | import cuchaz.enigma.source.DecompilerService; | 6 | import cuchaz.enigma.source.DecompilerService; |
| 6 | import cuchaz.enigma.source.Decompilers; | 7 | import cuchaz.enigma.source.Decompilers; |
| 7 | 8 | ||
| @@ -47,7 +48,7 @@ public class DecompileCommand extends Command { | |||
| 47 | ProgressListener progress = new ConsoleProgressListener(); | 48 | ProgressListener progress = new ConsoleProgressListener(); |
| 48 | 49 | ||
| 49 | EnigmaProject.JarExport jar = project.exportRemappedJar(progress); | 50 | EnigmaProject.JarExport jar = project.exportRemappedJar(progress); |
| 50 | EnigmaProject.SourceExport source = jar.decompile(progress, decompilerService); | 51 | EnigmaProject.SourceExport source = jar.decompile(progress, decompilerService, DecompileErrorStrategy.TRACE_AS_SOURCE); |
| 51 | 52 | ||
| 52 | source.write(fileJarOut, progress); | 53 | source.write(fileJarOut, progress); |
| 53 | } | 54 | } |