androidlintandroid-lintretrolambda

Lint crashes with an exception during analysis with classes that contain retrolambda


I'm using retrolambda with android-retrolambda-lombok but lint crashes anyway during :app:lintVital** task.

These two are in my projects build.gradle and I excluded com.android.tools.external.lombok as in readme.

classpath 'me.tatarka:gradle-retrolambda:3.4.0'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'

Here's the stacktraces:

Failed converting ECJ parse tree to PSI for file **DataBase.java
java.lang.IllegalArgumentException: org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference
at com.android.tools.lint.psi.EcjPsiBuilder.toExpression(EcjPsiBuilder.java:977)
at com.android.tools.lint.psi.EcjPsiBuilder.toFunctionalExpression(EcjPsiBuilder.java:1038)
at com.android.tools.lint.psi.EcjPsiBuilder.toExpression(EcjPsiBuilder.java:969)
at com.android.tools.lint.psi.EcjPsiBuilder.toArguments(EcjPsiBuilder.java:2281)
at com.android.tools.lint.psi.EcjPsiBuilder.toCallExpression(EcjPsiBuilder.java:1094)
at com.android.tools.lint.psi.EcjPsiBuilder.toExpression(EcjPsiBuilder.java:959)
at com.android.tools.lint.psi.EcjPsiBuilder.toCallExpression(EcjPsiBuilder.java:1085)
at com.android.tools.lint.psi.EcjPsiBuilder.toExpression(EcjPsiBuilder.java:959)
at com.android.tools.lint.psi.EcjPsiBuilder.toCallExpression(EcjPsiBuilder.java:1085)
at com.android.tools.lint.psi.EcjPsiBuilder.toExpression(EcjPsiBuilder.java:959)
at com.android.tools.lint.psi.EcjPsiBuilder.toCallExpression(EcjPsiBuilder.java:1085)
at com.android.tools.lint.psi.EcjPsiBuilder.toExpression(EcjPsiBuilder.java:959)
at com.android.tools.lint.psi.EcjPsiBuilder.toReturnStatement(EcjPsiBuilder.java:2022)
at com.android.tools.lint.psi.EcjPsiBuilder.toStatement(EcjPsiBuilder.java:1861)
at com.android.tools.lint.psi.EcjPsiBuilder.toBlock(EcjPsiBuilder.java:1811)
at com.android.tools.lint.psi.EcjPsiBuilder.toMethod(EcjPsiBuilder.java:913)
at com.android.tools.lint.psi.EcjPsiBuilder.initializeClassBody(EcjPsiBuilder.java:798)
at com.android.tools.lint.psi.EcjPsiBuilder.toClass(EcjPsiBuilder.java:700)
at com.android.tools.lint.psi.EcjPsiBuilder.toFile(EcjPsiBuilder.java:2518)
at com.android.tools.lint.psi.EcjPsiBuilder.create(EcjPsiBuilder.java:387)
at com.android.tools.lint.EcjParser$EcjResult.findFile(EcjParser.java:348)
at com.android.tools.lint.EcjParser.parseJavaToPsi(EcjParser.java:634)
at com.android.tools.lint.client.api.JavaPsiVisitor.visitFile(JavaPsiVisitor.java:277)
at com.android.tools.lint.client.api.LintDriver.visitJavaFiles(LintDriver.java:1571)
at com.android.tools.lint.client.api.LintDriver.checkJava(LintDriver.java:1551)
at com.android.tools.lint.client.api.LintDriver.runFileDetectors(LintDriver.java:1090)
at com.android.tools.lint.client.api.LintDriver.checkProject(LintDriver.java:935)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:454)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:395)
at com.android.tools.lint.LintCliClient.run(LintCliClient.java:131)
at com.android.build.gradle.internal.LintGradleClient.run(LintGradleClient.java:146)
at com.android.build.gradle.tasks.Lint.runLint(Lint.java:255)
at com.android.build.gradle.tasks.Lint.lintSingleVariant(Lint.java:224)
at com.android.build.gradle.tasks.Lint.lint(Lint.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:624)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:607)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:61)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:45)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:233)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

And another one:

Unexpected failure during lint analysis of App.java (this is a bug in lint or one of the libraries it depends on)
IllegalArgumentException:EcjPsiBuilder.toExpression(EcjPsiBuilder.java:977)<-EcjPsiBuilder.toFunctionalExpression(EcjPsiBuilder.java:1038)<-EcjPsiBuilder.toExpression(EcjPsiBuilder.java:969)<-EcjPsiBuilder.toArguments(EcjPsiBuilder.java:2281)

Solution

  • This is a bug in lint. It looks like this happens when you are using a functional method reference which includes a wildcard. I can reproduce it, so I've filed this tracking bug https://code.google.com/p/android/issues/detail?id=232383 and I plan to get it into 2.3.

    (Sadly there's no workaround; the only thing you can do is to locate the relevant source file (listed in the stacktrace but redacted here, e.g. *Database.java), look for your functional references (::), and try removing the generics in the call and just suppress generics warnings instead.)