Skip to content

Int decompiled to bool #70

@ambergorzynski

Description

@ambergorzynski

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: {}
    	}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions