evant / gradle-retrolambda

A gradle plugin for getting java lambda support in java 6, 7 and android
Apache License 2.0
5.3k stars 449 forks source link

BUG: Compile Error - Gradle task: compileRetroLambdaDebug (reproducible) #249

Open smp4903 opened 7 years ago

smp4903 commented 7 years ago

Using lambda expressions with the Handler to post a Runnable inside an AjaxCallback produces a compile error. However, using the regular anonymous class works fine AND using the lambda expression outside of the callback also works.

The produced error is:

Error:Execution failed for task ':app:compileRetrolambdaDebug'.

Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

The error seems to be produced by the interaction between RetroLambda and AndroidQuery.

Sample project to reproduce

Simply try to compile the project.

The specific code that triggers the bug:

    new Handler().post(() -> { });         // works

    AjaxCallback<Bitmap> callback = new AjaxCallback<Bitmap>() {
        @Override
        public void callback(String url, final Bitmap bitmap, AjaxStatus status) {

            new Handler().post(() -> { });        // does NOT work

            new Handler().post(new Runnable() {     // works
                @Override
                public void run() {

                }
            });
        }
    };