-
Notifications
You must be signed in to change notification settings - Fork 227
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
Anonymous class inside lambda expression causes Proguard to fail with 2.5.0 #121
Comments
Thanks for reporting this. 2.5.0 changes the signatures of the lambda methods, but apparently there is still some place which needs to be updated. Please show the code for those classes, as well as their .class files before and after converting them with Retrolambda. |
SomeClass.java:
MainActivity.java:
The issue is actually is an anonymous class inside lambda. See attaches for class files. |
I confirm that I have anonymous inner classes inside lambda where proguard fails
|
The cause of the warning is that the anonymous inner class has the lambda method in its EnclosingMethod attribute. So it will be necessary to update that reference. |
Same issue here: @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getStringExtra(WebScreen.WEB_PAGE_TITLE));
webView.post(() -> {
load(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(() -> {
progressBar.setVisibility(View.GONE);
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String responseBodyString;
responseBodyString = response.body().string();
runOnUiThread(() -> {
webView.loadData(responseBodyString, "text/html", "");
progressBar.setVisibility(View.GONE);
});
}
});
});
} |
luontola/retrolambda#121 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Nevermind :) |
This is a showstopper, I had to remove all Lambda code from our code base due to this bug. Is there an ETA for a fix? |
What about downgrading?
…On Wed, Feb 22, 2017 at 10:25 PM Emanuel Moecklin ***@***.***> wrote:
This is a showstopper, I had to remove all Lambda code from our code base
due to this bug. Is there an ETA for a fix.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEYmRDbA3lXKRFy6Czc6nqqHIakT8ks5rfPwtgaJpZM4LsEo4>
.
|
I downgraded to 2.4 retrolambda and 3.4 gradle-retrolambda but still got errors like this: Warning:com.xyz.sdk.core.RemoteServiceConnection$2$1: can't find enclosing method 'org.reactivestreams.Publisher apply(io.reactivex.Flowable)' in program class com.xyz.sdk.core.RemoteServiceConnection$2 We ProGuard libraries that are then published, these libraries build without issue but if we build an apk (with dependency to the published libraries) and use ProGuard for that apk then we get these errors. |
This bug happens when an anonymous class is created inside a lambda expression. The workaround is to change just those lambda expressions into anonymous classes. Or change the contained anonymous class into a lambda, if possible.
Have you done a clean build? |
I had a boring meeting. 😆 This should fix this issue. I'll create a release this evening. |
Awesome news! I hope this fixes the issue for me too since we have kind of a special setup. As mentioned we ProGuard an already ProGuarded library (aar) and only then do we get these errors, not while building the libraries (maybe this explains why we get the error with 2.4/3/4). I built it manually with clean/build/publish. |
Retrolambda 2.5.1 with this fix is now released |
I have a problem with proguard after updating to retrolambda 2.5.0 (No problem with 2.3.0 and 2.4.0)
The errors are the following, is something changed in 2.5.0 that can cause this error? My code hasn't changed and, if I revert to retrolambda 2.4.0 all works as expected.
P.S.: I used Proguard 5.2.1, so I updated it to the latest version (5.3.2) to be sure but it also fails
The text was updated successfully, but these errors were encountered: