aload_0 - astore_2 for different types produces wrong code
maxatka opened this issue · comments
Max@Kalyzée commented
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.