我相信这与我的项目有关,与Android Studio本身无关。
据我了解,当我打开某些文件并且未执行语法高亮显示时,将抛出以下错误消息。但是,如果我通过删除一行代码来编辑文件,则会再次显示语法高亮。
仔细检查并查找stacktrace并不能真正指示出什么地方出了问题,所以我在这里。您知道什么地方可能出问题吗?
我尝试清除缓存,重新安装以及在Android Studio中使用不同的设置进行播放而没有任何效果,这使我相信这与项目直接相关。此外,如果我创建一个新项目,则语法突出显示将正常工作。
我所看到的...
完整的堆栈跟踪...
org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassMemberMatchingError$NoMatch: Couldn't match ClsMethodImpl:hashCode MemberIndex(index=10) (with 0 parameters)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder.assertMatches(LazyLightClassDataHolder.kt:145)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder.access$assertMatches(LazyLightClassDataHolder.kt:32)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder$LazyLightClassData$getOwnMethods$$inlined$map$lambda$1.invoke(LazyLightClassDataHolder.kt:138)
at org.jetbrains.kotlin.idea.caches.lightClasses.LazyLightClassDataHolder$LazyLightClassData$getOwnMethods$$inlined$map$lambda$1.invoke(LazyLightClassDataHolder.kt:100)
at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl.getClsDelegate(KtLightMemberImpl.kt)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl$_modifierList$2.invoke(KtLightMemberImpl.kt:47)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl$_modifierList$2.invoke(KtLightMemberImpl.kt:35)
at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl.get_modifierList(KtLightMemberImpl.kt)
at org.jetbrains.kotlin.asJava.elements.KtLightMemberImpl.getModifierList(KtLightMemberImpl.kt:52)
at org.jetbrains.kotlin.asJava.elements.KtLightMethodImpl.getModifierList(KtLightMethodImpl.kt:127)
at com.intellij.codeInsight.AnnotationUtil.isAnnotated(AnnotationUtil.java:244)
at com.intellij.codeInsight.AnnotationUtil.lambda$isAnnotated$4(AnnotationUtil.java:234)
at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449)
at com.intellij.codeInsight.AnnotationUtil.isAnnotated(AnnotationUtil.java:234)
at com.intellij.codeInsight.MetaAnnotationUtil.isMetaAnnotated(MetaAnnotationUtil.java:154)
at com.intellij.execution.junit.JUnitUtil.lambda$isJUnit5TestClass$1(JUnitUtil.java:280)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:140)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:87)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:139)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:126)
at com.intellij.execution.junit.JUnitUtil.isJUnit5TestClass(JUnitUtil.java:276)
at com.intellij.execution.junit.JUnit5Framework.isTestClass(JUnit5Framework.java:52)
at com.intellij.testIntegration.JavaTestFramework.isTestClass(JavaTestFramework.java:64)
at com.intellij.codeInsight.TestFrameworks.computeFramework(TestFrameworks.java:92)
at com.intellij.codeInsight.TestFrameworks.lambda$detectFramework$0(TestFrameworks.java:63)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:140)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:87)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:139)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:126)
at com.intellij.codeInsight.TestFrameworks.detectFramework(TestFrameworks.java:62)
at org.jetbrains.kotlin.idea.core.platform.impl.JvmIdePlatformKindTooling.getTestIcon(JvmIdePlatformKindTooling.kt:60)
at org.jetbrains.kotlin.idea.highlighter.KotlinTestRunLineMarkerContributor.getInfo(KotlinTestRunLineMarkerContributor.kt:66)
at com.intellij.execution.lineMarker.RunLineMarkerProvider.getLineMarkerInfo(RunLineMarkerProvider.java:46)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:174)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectInformation$3(LineMarkersPass.java:96)
at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:80)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:91)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:423)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1164)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:416)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:415)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:391)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:222)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:389)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
答案 0 :(得分:0)
自然而然地发布有关问题的消息时,解决方案很快就会显示出来。
我在一个类(实体)中覆盖了equals和哈希码,并且这两种方法都标记为final。每当数据类扩展Entity时都会出现此问题,我猜测是因为它试图创建自己的equals&hashcode方法,但是不能。
希望这可以帮助其他人!我认为该行为是正确的(数据类具有非常特定的equals / hashcode),因此我不认为这是Kotlin插件中的错误,但将来会希望收到更好的错误消息。