在使用包含 retrolambda 的 类 进行分析期间,Lint 崩溃并出现异常

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

我将 retrolambda 与 android-retrolambda-lombok 一起使用,但 lint 在 :app:lintVital** 任务期间无论如何都会崩溃。

这两个在我的项目 build.gradle 中,我排除了 com.android.tools.external.lombok 自述文件中的内容。

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

这是堆栈跟踪:

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.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)

还有一个:

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)

这是 lint 中的错误。当您使用包含通配符的功能方法引用时,看起来会发生这种情况。我可以重现它,所以我已经提交了这个跟踪错误 https://code.google.com/p/android/issues/detail?id=232383 我打算把它放到 2.3 中。

(遗憾的是,没有解决方法;您唯一能做的就是找到相关的源文件(在堆栈跟踪中列出但在此处进行了编辑,例如 *Database.java),查找您的功能参考(:: ),并尝试在调用中删除泛型,而只抑制泛型警告。)