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

Canonical record constructor performing assignment uses wrong variable name #319

Open
Marcono1234 opened this issue May 19, 2022 · 0 comments · May be fixed by #327
Open

Canonical record constructor performing assignment uses wrong variable name #319

Marcono1234 opened this issue May 19, 2022 · 0 comments · May be fixed by #327
Labels

Comments

@Marcono1234
Copy link
Contributor

CFR version

c69ed17

Compiler

javac 17

Description

When the canonical constructor of a record performs an operation on one of the implicit parameters and assigns the value to the record component, CFR might erroneously use a CFR-generated parameter name instead of the component name.

Example

Source code:

record Record2(int test, String myString) {
    Record2 {
        myString = myString.trim();
    }
}

Decompiled output:

record Record2(int test, String myString) {
    Record2 {
        string = string.trim();
    }
}

❌ The output uses the implicit parameter with a CFR-generated name (string) which would cause a compilation failure.

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

Successfully merging a pull request may close this issue.

1 participant