-
Notifications
You must be signed in to change notification settings - Fork 449
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
Child class overrides lambda in parent class #207
Comments
@cpalasanu Tested your project. Works fine for me. Parent button shows 'Parent onClick', child button shows 'Child onClick'. |
I just cloned this project, built it and ran it. Clicking on the parent button shows "Child onClick". |
@Yarikx what other configuration info can I provide? |
also deleted ~/.gradle/chaches and the behavior is the same |
Using the cfr decompiler, we see that the child activity class has a method that overrides the parent activity class: Parent: /*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* android.content.Context
* android.os.Bundle
* android.support.annotation.Nullable
* android.support.v7.app.AppCompatActivity
* android.view.View
* android.view.View$OnClickListener
* android.widget.Toast
*/
package com.orange.retrolambdatest;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.orange.retrolambdatest.ParentActivity$$Lambda$1;
public abstract class ParentActivity
extends AppCompatActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(this.getContentView());
this.findViewById(2131427412).setOnClickListener(ParentActivity$$Lambda$1.lambdaFactory$(this));
}
public abstract int getContentView();
/* synthetic */ void lambda$onCreate$0(View view) {
Toast.makeText((Context)this, (CharSequence)"Parent onClick", (int)1).show();
}
} Child: /*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* android.content.Context
* android.os.Bundle
* android.view.View
* android.view.View$OnClickListener
* android.widget.Toast
*/
package com.orange.retrolambdatest;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.orange.retrolambdatest.MainActivity$$Lambda$1;
import com.orange.retrolambdatest.ParentActivity;
public class MainActivity
extends ParentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.findViewById(2131427413).setOnClickListener(MainActivity$$Lambda$1.lambdaFactory$(this));
}
@Override
public int getContentView() {
return 2130968602;
}
@Override
/* synthetic */ void lambda$onCreate$0(View view) {
Toast.makeText((Context)this, (CharSequence)"Child onClick", (int)1).show();
}
} Both parent and child have the same method |
@calvarez-ov Super interesting. I believe it's related to latest updates of retrolambda (not gradle-retrolambda). Is it reproducible with lower versions of retrolambda? |
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.2.0' this fixes the issue so it's a problem in 2.3.0 |
I did some tests building the retrolambda project locally. It appears the bug appears in this commit: luontola/retrolambda@bf93245 I have not done any investigation to understand what part of that commit introduces the bug. |
I opened an issue in the retrolambda project: luontola/retrolambda#109 I guess this one here may be closed. |
Clicking on button_parent shows a Toast with "Child onClick"
test app: https://github.com/cpalasanu/RetrolambdaTest
The text was updated successfully, but these errors were encountered: