[go: up one dir, main page]

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

aload_0 - astore_2 for different types produces wrong code #333

Open
maxatka opened this issue Dec 11, 2022 · 0 comments
Open

aload_0 - astore_2 for different types produces wrong code #333

maxatka opened this issue Dec 11, 2022 · 0 comments
Labels

Comments

@maxatka
Copy link
maxatka commented Dec 11, 2022

CFR version

CFR 0.153-SNAPSHOT (d6f6758)

Compiler

openjdk version "1.8.0_332"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (Temurin)(build 25.332-b09, mixed mode)

Description

cfr produces wrong java code on this bytecode:

  private void func(android.widget.TextView[], android.view.View);
    descriptor: ([Landroid/widget/TextView;Landroid/view/View;)V
    flags: ACC_PRIVATE, ACC_SYNTHETIC
    Code:
      stack=7, locals=10, args_size=3
         0: aload_0
         1: iconst_0
         2: putfield      #14                 // Field abc:I
         5: new           #52                 // class java/lang/StringBuilder
         8: astore_2
         9: aload_2
        10: invokespecial #53                 // Method java/lang/StringBuilder."<init>":()V
        13: iconst_0

As a result I've got:

    private /* synthetic */ void func(TextView[] textViewArray, View object) {
        int n;
        this.abc = 0;
        object = new StringBuilder();
        for (n = 0; n < 49; ++n) {
            object.append(...

Hint: the argument object variable isn't a View any more, it's a StringBuilder instance, and append() cannot be called.

Example

@maxatka maxatka added the bug label Dec 11, 2022
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