procyon icon indicating copy to clipboard operation
procyon copied to clipboard

try with resources decompilation is not accurate

Open sadaaithal opened this issue 4 years ago • 2 comments

I was suggested to open this java decompiler issue from here https://github.com/deathmarine/Luyten/issues/290

A jdk8 class file with "try with resources" code doesnt decompile correctly Here's the source image

And here's what the tool outputs ( im using v0.5.4) in my default config

image

I couldn't find past issues around this area. Is this addressed in any of the recent builds? thanks in advance!

sadaaithal avatar Nov 10 '21 18:11 sadaaithal

This is probably fixed for the next release (javac changed the pattern it emits for try-with-resources sometime after JDK8).

mstrobel avatar Feb 04 '22 21:02 mstrobel

I'm seeing this same issue with --compiler-target 1.8 as well: java -jar procyon-decompiler-0.6.0.jar -o ./sources-ROOT/classes --compiler-target 1.8 SomeJava8Class.class

The .class file was compiled with Java 1.8.0_101.

The resulting .java file shows the same odd Throwable t2 = null; try { ... } sequence instead of try (...) { ... }.

WizGeek avatar Oct 18 '22 17:10 WizGeek