Skip to content
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

c.i.p.PsiInvalidElementAccessException/j.l.IllegalStateException When Creating New Class #2420

Open
gudenau opened this issue Dec 24, 2024 · 0 comments

Comments

@gudenau
Copy link

gudenau commented Dec 24, 2024

Minecraft Development for IntelliJ plugin version

2024.3-1.8.2

IntelliJ version

2024.3.11

Operating System

Linux 6.12.4

Target platform

Fabric

Description of the bug

When creating a new class in a new source set that implements n.f.f.a.d.v1.DataGeneratorEntrypoint I got a few different error reports from Idea that fit into two different buckets:

com.intellij.psi.PsiInvalidElementAccessException: Element class com.intellij.psi.impl.source.tree.java.ClassElement of type CLASS (class com.intellij.psi.impl.java.stubs.JavaStubElementTypes$1)
	at com.intellij.psi.PsiInvalidElementAccessException.createByNode(PsiInvalidElementAccessException.java:81)
	at com.intellij.psi.impl.source.SubstrateRef$2.getContainingFile(SubstrateRef.java:76)
	at com.intellij.extapi.psi.StubBasedPsiElementBase.getContainingFile(StubBasedPsiElementBase.java:237)
	at com.intellij.extapi.psi.StubBasedPsiElementBase.getProject(StubBasedPsiElementBase.java:273)
	at com.demonwav.mcdev.platform.fabric.reference.FabricClientUseScopeEnlarger.getAdditionalUseScope$lambda$2(FabricClientUseScopeEnlarger.kt:52)
	at com.intellij.psi.search.GlobalSearchScope$LazyFilesScope.getFiles(GlobalSearchScope.java:917)
	at com.intellij.psi.search.GlobalSearchScope$AbstractFilesScope.contains(GlobalSearchScope.java:830)
	at com.intellij.psi.search.GlobalSearchScope$UnionScope.lambda$contains$0(GlobalSearchScope.java:544)
	at com.intellij.util.containers.ContainerUtil.find(ContainerUtil.java:807)
	at com.intellij.psi.search.GlobalSearchScope$UnionScope.contains(GlobalSearchScope.java:544)
	at com.intellij.psi.search.GlobalSearchScope$IntersectionScope.contains(GlobalSearchScope.java:394)
	at com.intellij.util.indexing.FileBasedIndexEx.processVirtualFiles(FileBasedIndexEx.java:620)
	at com.intellij.util.indexing.FileBasedIndexEx.processFilesContainingAllKeysInPhysicalFiles(FileBasedIndexEx.java:486)
	at com.intellij.util.indexing.FileBasedIndexEx.processFilesContainingAllKeys(FileBasedIndexEx.java:495)
	at com.intellij.util.indexing.FileBasedIndexImpl.processFilesContainingAllKeys(FileBasedIndexImpl.java:1191)
	at com.intellij.psi.impl.cache.impl.IndexCacheManagerImpl.processVirtualFilesWithAllWords(IndexCacheManagerImpl.java:85)
	at com.intellij.psi.impl.cache.impl.IndexCacheManagerImpl.collectVirtualFilesWithWord(IndexCacheManagerImpl.java:101)
	at com.intellij.psi.impl.cache.impl.IndexCacheManagerImpl.lambda$getVirtualFilesWithWord$0(IndexCacheManagerImpl.java:64)
	at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:230)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:113)
	at com.intellij.util.indexing.FileBasedIndexEx.ignoreDumbMode(FileBasedIndexEx.java:682)
	at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:229)
	at com.intellij.util.indexing.DumbModeAccessType.ignoreDumbMode(DumbModeAccessType.java:41)
	at com.intellij.psi.impl.cache.impl.IndexCacheManagerImpl.getVirtualFilesWithWord(IndexCacheManagerImpl.java:63)
	at com.intellij.codeInsight.daemon.problems.MemberUsageCollector$Companion.collect(MemberUsageCollector.kt:39)
	at com.intellij.codeInsight.daemon.problems.ProblemCollector$Companion.processUsages(ProblemCollector.kt:70)
	at com.intellij.codeInsight.daemon.problems.ProblemCollector$Companion.processMemberChange(ProblemCollector.kt:48)
	at com.intellij.codeInsight.daemon.problems.ProblemCollector$Companion.collect(ProblemCollector.kt:27)
	at com.intellij.codeInsight.daemon.problems.pass.ProjectProblemCodeVisionProviderKt.collectProblems(ProjectProblemCodeVisionProvider.kt:163)
	at com.intellij.codeInsight.daemon.problems.pass.ProjectProblemCodeVisionProviderKt.access$collectProblems(ProjectProblemCodeVisionProvider.kt:1)
	at com.intellij.codeInsight.daemon.problems.pass.ProjectProblemCodeVisionProvider.computeLenses(ProjectProblemCodeVisionProvider.kt:79)
	at com.intellij.codeInsight.daemon.impl.JavaCodeVisionProviderBase.computeForEditor(JavaCodeVisionProviderBase.kt:15)
	at com.intellij.codeInsight.hints.codeVision.CodeVisionPass$Companion.collect$lambda$3$lambda$2(CodeVisionPass.kt:74)
	at com.intellij.concurrency.ApplierCompleter.processArrayItem(ApplierCompleter.java:126)
	at com.intellij.concurrency.ApplierCompleter.processArray(ApplierCompleter.java:207)
	at com.intellij.concurrency.ApplierCompleter.execAll(ApplierCompleter.java:176)
	at com.intellij.concurrency.JobLauncherImpl.lambda$invokeConcurrentlyUnderProgressAsync$3(JobLauncherImpl.java:108)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:333)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:971)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$2(ApplierCompleter.java:158)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:674)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:749)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:673)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:169)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapAndRun$1(ApplierCompleter.java:150)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.executeByImpatientReader(AnyThreadWriteThreadingSupport.kt:544)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:176)
	at com.intellij.concurrency.ApplierCompleter.wrapAndRun(ApplierCompleter.java:150)
	at com.intellij.concurrency.JobLauncherImpl.lambda$invokeConcurrentlyUnderProgressAsync$4(JobLauncherImpl.java:108)
	at com.intellij.concurrency.JobLauncherImpl.safeIterate(JobLauncherImpl.java:176)
	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgressAsync(JobLauncherImpl.java:105)
	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:53)
	at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:51)
	at com.intellij.codeInsight.hints.codeVision.CodeVisionPass$Companion.collect(CodeVisionPass.kt:70)
	at com.intellij.codeInsight.hints.codeVision.CodeVisionPass$Companion.access$collect(CodeVisionPass.kt:43)
	at com.intellij.codeInsight.hints.codeVision.CodeVisionPass.doCollectInformation(CodeVisionPass.kt:111)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:67)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:427)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:30)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$3(PassExecutorService.java:423)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:351)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:971)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$4(PassExecutorService.java:413)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:674)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:749)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:673)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:412)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:388)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.cacheFileTypesInside(FileTypeManagerImpl.java:822)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$1(PassExecutorService.java:388)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.executeByImpatientReader(AnyThreadWriteThreadingSupport.kt:544)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:176)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:386)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:266)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1491)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2073)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2035)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
During querying provider Minecraft Plugin line marker (class com.demonwav.mcdev.insight.PluginLineMarkerProvider)

java.lang.IllegalStateException: Constraint inSmartMode cannot be satisfied
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:568)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.executeSynchronously(NonBlockingReadActionImpl.java:506)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl.executeSynchronously(NonBlockingReadActionImpl.java:222)
	at com.demonwav.mcdev.platform.fabric.reference.FabricClientUseScopeEnlarger.getAdditionalUseScope$lambda$2(FabricClientUseScopeEnlarger.kt:52)
	at com.intellij.psi.search.GlobalSearchScope$LazyFilesScope.getFiles(GlobalSearchScope.java:917)
	at com.intellij.psi.search.GlobalSearchScope$AbstractFilesScope.calcHashCode(GlobalSearchScope.java:850)
	at com.intellij.psi.search.SearchScope.hashCode(SearchScope.java:34)
	at java.base/java.util.Arrays.hashCode(Arrays.java:4599)
	at com.intellij.psi.search.GlobalSearchScope$UnionScope.calcHashCode(GlobalSearchScope.java:607)
	at com.intellij.psi.search.SearchScope.hashCode(SearchScope.java:34)
	at com.intellij.psi.search.GlobalSearchScope$IntersectionScope.calcHashCode(GlobalSearchScope.java:442)
	at com.intellij.psi.search.SearchScope.hashCode(SearchScope.java:34)
	at java.base/java.util.HashMap.hash(HashMap.java:338)
	at java.base/java.util.HashMap.put(HashMap.java:618)
	at java.base/java.util.HashSet.add(HashSet.java:229)
	at com.intellij.util.containers.ContainerUtil.map2LinkedSet(ContainerUtil.java:2756)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.uniteScopes(PsiSearchHelperImpl.java:1117)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.collectFiles(PsiSearchHelperImpl.java:1037)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.processGlobalRequests(PsiSearchHelperImpl.java:926)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.processGlobalRequestsOptimized(PsiSearchHelperImpl.java:907)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.processRequests(PsiSearchHelperImpl.java:830)
	at com.intellij.psi.search.SearchRequestQuery.processResults(SearchRequestQuery.java:21)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.UniqueResultsQuery.processResults(UniqueResultsQuery.java:37)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.forEach(AbstractQuery.java:75)
	at com.intellij.util.Query.anyMatch(Query.java:82)
	at com.demonwav.mcdev.platform.fabric.FabricModule.shouldShowPluginIcon(FabricModule.kt:78)
	at com.demonwav.mcdev.facet.MinecraftFacet.shouldShowPluginIcon(MinecraftFacet.kt:206)
	at com.demonwav.mcdev.insight.PluginLineMarkerProvider.getLineMarkerInfo(PluginLineMarkerProvider.kt:49)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:180)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectMarkers$2(LineMarkersPass.java:108)
	at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:97)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectMarkers(LineMarkersPass.java:104)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:77)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:67)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:427)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:30)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$3(PassExecutorService.java:423)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:351)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:971)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$4(PassExecutorService.java:413)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:674)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:749)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:673)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:412)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:388)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.cacheFileTypesInside(FileTypeManagerImpl.java:822)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$1(PassExecutorService.java:388)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.executeByImpatientReader(AnyThreadWriteThreadingSupport.kt:544)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:176)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:386)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:266)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1491)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2073)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2035)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)

These appear to make it so that Idea can no longer correctly do inspections, as the class had no members but Idea was reporting no errors even though the single abstract method was not implemented.

My source set was configured as follows (after the loom block):

sourceSets {
    datagen {
        java {}
    }

    datagen.compileClasspath += client.compileClasspath
    datagen.runtimeClasspath += client.runtimeClasspath
    datagen.runtimeClasspath += client.output
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant