-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Description
Hello, I am running some tests in Java bytecode (using Jasmin) and attempting to decompile the resulting class files using Procyon. I have run into a problem whereby Procyon inserts unreachable break statements within switch statements. I understand that this is not the typical use case for Procyon but it would be interesting to know whether the decompilation failure is due to the bytecode switch statements being constructed in a way that is out-of-scope for Procyon, or something else.
Thanks!
Version info
Procyon decompiler 0.6.0
OpenJDK 19.0.2 2023-01-17
x86_64 Ubuntu 22.04
Example
A simple example bytecode file is below, which I compile to a class file (here: TestCase.zip).
.class public TestCase
.super java/lang/Object
; default constructor
.method public <init>()V
aload_0
invokespecial java/lang/Object/<init>()V
return
.end method
.method public static main([Ljava/lang/String;)V
.limit stack 5
.limit locals 6
block_0:
bipush 3
; switch
lookupswitch
0: block_2
default : block_2
block_2:
bipush 3
; switch
lookupswitch
0: block_3
default: block_3
block_3:
return
.end method
The decompiled Procyon output is this:
//
// Decompiled by Procyon v0.6.0
//
public class TestCase
{
public static void main(final String[] array) {
switch (3) {
default: {
switch (3) {
default: {
return;
}
}
break;
}
}
}
}
Recompiling this gives the following error:
TestCase.java:15: error: unreachable statement
break;
^
1 error
Metadata
Metadata
Assignees
Labels
No labels