Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Int decompiled to bool #70

Open
ambergorzynski opened this issue Dec 1, 2023 · 0 comments
Open

Int decompiled to bool #70

ambergorzynski opened this issue Dec 1, 2023 · 0 comments

Comments

@ambergorzynski
Copy link

Hello, I am running some tests in Java bytecode (using Jasmin) and attempting to decompile the resulting class files using Procyon. In some cases Procyon incorrectly decompiles an int as a boolean, resulting in a switch on a boolean. This is technically recompilable (if –enable-preview is used during compilation), but it looks unintentional - what is causing this?

Thanks!

Version info

Procyon decompiler 0.6.0
OpenJDK 19.0.2 2023-01-17
x86_64 Ubuntu 22.04

Example

Example bytecode file, which I compile to a class file (ClassFile.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 1

	; switch
    lookupswitch
    	0: block_2
    	default : block_2

block_2:
  return

Decompiling the class file using Procyon gives this:

//
// Decompiled by Procyon v0.6.0
//

public class TestCase
{
	public static void main(final String[] array) {
    	switch (true) {
        	default: {}
    	}
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant