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

Ternary Expression Causing Decompilation Type Error #349

Open
xxh160 opened this issue Sep 8, 2023 · 0 comments
Open

Ternary Expression Causing Decompilation Type Error #349

xxh160 opened this issue Sep 8, 2023 · 0 comments
Labels

Comments

@xxh160
Copy link

xxh160 commented Sep 8, 2023

CFR version

CFR 0.153-SNAPSHOT (24c7433-dirty)

Compiler

javac 11.0.20.1

Description

CFR may exhibit type errors in the decompilation of ternary expressions.

Example

Example code is as follows:

class T1 {
    public Object foo(boolean b) {
        Integer i1 = 1;
        return ((b) ? i1 : (Byte[]) new Object[] { (byte) -98 });
    }
}

The decompiled code is as follows:

/*
 * Decompiled with CFR 0.153-SNAPSHOT (24c7433-dirty).
 */
class T1 {
    T1() {
    }

    public Object foo(boolean bl) {
        Byte[] byteArray = Integer.valueOf(1);
        return bl ? byteArray : (Byte[])new Object[]{(byte)-98};
    }
}

Integer.valueOf(1) returns an int type instead of Byte[] type, which causes a compilation error.

@xxh160 xxh160 added the bug label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant