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

2.0 - IllegalStateException: Index is not created for INDEX ID (when running test) #1608

Open
bohdan-harniuk opened this issue Apr 29, 2024 · 0 comments
Labels

Comments

@bohdan-harniuk
Copy link

What happened?

The indexes defined in my plugin are inaccessible during test execution. Since my plugin is located within my company's private repository, I'm unable to provide access for assistance with reproducing the bug. However, I have managed to replicate this issue using a simple plugin that declares a new index and tests its data presence. You can find the replicated bug in the following open repository: https://github.com/bohdan-harniuk/ii-plugin-indexes-bug

The configuration files in the open repository match those declared in my company's private repository:

  • build.gradle.kts
  • gradle.properties
  • settings.gradle.kts

Relevant log output or stack trace

Path for java installation '/Users/b.harniuk/Library/Java/JavaVirtualMachines/jbr-17.0.9/Contents/Home' (IntelliJ IDEA) does not contain a java executable
> Configure project :
[org.jetbrains.intellij.platform] You are currently using the org.jetbrains.intellij.platform.migration which is dedicated only to help with the migration process from the Gradle IntelliJ Plugin 1.x to IntelliJ Platform Gradle Plugin 2.0.
As soon as you'll handle all configuration problems, remember to remove this plugin from your `plugins {}` block and eventually rename the `intellij {}` extension to `intellijPlatform {}`.
Note: We encourage avoiding configuring tasks directly, like: patchPluginXml { ... }, publishPlugin { ... }, signPlugin { ... }, ...
      Use the `intellijPlatform { }` extension instead:
      
intellijPlatform {
    ...
    
    pluginConfiguration { ... }
    publishing { ... }
    signing { ... }
    ...
}
IntelliJ Platform Extension: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
Migration guide: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-migration.html
> Task :checkKotlinGradlePluginConfigurationErrors
> Task :initializeIntellijPlatformPlugin SKIPPED
> Task :patchPluginXml UP-TO-DATE
> Task :verifyPluginProjectConfiguration UP-TO-DATE
> Task :compileKotlin UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :pluginDescriptors UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :instrumentCode UP-TO-DATE
> Task :instrumentedJar UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :compileTestFixturesKotlin NO-SOURCE
> Task :compileTestFixturesJava NO-SOURCE
> Task :processTestFixturesResources UP-TO-DATE
> Task :testFixturesClasses UP-TO-DATE
> Task :instrumentTestFixturesCode UP-TO-DATE
> Task :testFixturesJar UP-TO-DATE
> Task :inspectClassesForKotlinIC UP-TO-DATE
> Task :compileTestKotlin UP-TO-DATE
> Task :compileTestJava NO-SOURCE
> Task :processTestResources UP-TO-DATE
> Task :testClasses UP-TO-DATE
> Task :instrumentTestCode UP-TO-DATE
> Task :prepareSandbox UP-TO-DATE
> Task :buildSearchableOptions SKIPPED
> Task :jarSearchableOptions SKIPPED
> Task :pluginUnderTestMetadata UP-TO-DATE
> Task :prepareTestSandbox UP-TO-DATE
> Task :prepareTest UP-TO-DATE
Configuration file for j.u.l.LogManager does not exist: /Users/b.harniuk/.gradle/caches/transforms-4/2fcb74b3de3ccbdc2bfe36effff20748/transformed/PS-2024.1/test-log.properties
[   2731]   WARN - #c.i.s.ComponentManagerImpl - com.intellij.lang.javascript.boilerplate.NpmPackageProjectGenerator <clinit> requests com.intellij.notification.NotificationGroupManager instance. Class initialization must not depend on services. Consider using instance of the service on-demand instead.
[   3298]   WARN - #c.i.i.s.i.StartupManagerImpl - Migrate com.jetbrains.indices.viewer.HijackMemoryWidget to ProjectActivity [Plugin: com.jetbrains.hackathon.indices.viewer]
com.intellij.diagnostic.PluginException: Migrate com.jetbrains.indices.viewer.HijackMemoryWidget to ProjectActivity [Plugin: com.jetbrains.hackathon.indices.viewer]
	at com.intellij.ide.startup.impl.StartupManagerImpl.runPostStartupActivities(StartupManagerImpl.kt:275)
	at com.intellij.ide.startup.impl.StartupManagerImpl.access$runPostStartupActivities(StartupManagerImpl.kt:68)
	at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$4.invokeSuspend(StartupManagerImpl.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:270)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

14:05:38,281 SEVERE                 #TestFramework - Test failed 
java.lang.IllegalStateException: Index is not created for `com.my.module.ModuleIndex` 
	at com.intellij.util.indexing.FileBasedIndexImpl.getIndex(FileBasedIndexImpl.java:1291) 
	at com.intellij.util.indexing.FileBasedIndexEx.processAllKeys(FileBasedIndexEx.java:147) 
	at com.intellij.util.indexing.FileBasedIndexImpl.processAllKeys(FileBasedIndexImpl.java:838) 
	at com.intellij.util.indexing.FileBasedIndexEx.processAllKeys(FileBasedIndexEx.java:134) 
	at com.intellij.util.indexing.FileBasedIndexEx.getAllKeys(FileBasedIndexEx.java:128) 
	at com.my.module.indexing.ModuleIndexProvider.getAllModules(ModuleIndexProvider.kt:11) 
	at com.my.module.indexing.ModuleIndexTest.testIndexData(ModuleIndexTest.kt:9) 
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) 
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) 
	at junit.framework.TestCase.runTest(TestCase.java:177) 
	at com.intellij.testFramework.UsefulTestCase.lambda$runBare$11(UsefulTestCase.java:483) 
	at com.intellij.testFramework.UsefulTestCase.lambda$wrapTestRunnable$13(UsefulTestCase.java:504) 
	at com.intellij.testFramework.UsefulTestCase.runTestRunnable(UsefulTestCase.java:408) 
	at com.intellij.testFramework.fixtures.BasePlatformTestCase.runTestRunnable(BasePlatformTestCase.java:109) 
	at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:424) 
	at com.intellij.testFramework.UsefulTestCase.lambda$runBare$12(UsefulTestCase.java:491) 
	at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$3(EdtTestUtil.java:80) 
	at com.intellij.openapi.application.impl.RwLockHolder.runWriteIntentReadAction(RwLockHolder.kt:70) 
	at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$4(EdtTestUtil.java:79) 
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308) 
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792) 
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739) 
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733) 
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) 
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) 
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761) 
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:326) 
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) 
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) 
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) 
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) 
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) 
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) 



Index is not created for `com.my.module.ModuleIndex`
java.lang.IllegalStateException: Index is not created for `com.my.module.ModuleIndex`
	at com.intellij.util.indexing.FileBasedIndexImpl.getIndex(FileBasedIndexImpl.java:1291)
	at com.intellij.util.indexing.FileBasedIndexEx.processAllKeys(FileBasedIndexEx.java:147)
	at com.intellij.util.indexing.FileBasedIndexImpl.processAllKeys(FileBasedIndexImpl.java:838)
	at com.intellij.util.indexing.FileBasedIndexEx.processAllKeys(FileBasedIndexEx.java:134)
	at com.intellij.util.indexing.FileBasedIndexEx.getAllKeys(FileBasedIndexEx.java:128)
	at com.my.module.indexing.ModuleIndexProvider.getAllModules(ModuleIndexProvider.kt:11)
	at com.my.module.indexing.ModuleIndexTest.testIndexData(ModuleIndexTest.kt:9)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at junit.framework.TestCase.runTest(TestCase.java:177)
	at com.intellij.testFramework.UsefulTestCase.lambda$runBare$11(UsefulTestCase.java:483)
	at com.intellij.testFramework.UsefulTestCase.lambda$wrapTestRunnable$13(UsefulTestCase.java:504)
	at com.intellij.testFramework.UsefulTestCase.runTestRunnable(UsefulTestCase.java:408)
	at com.intellij.testFramework.fixtures.BasePlatformTestCase.runTestRunnable(BasePlatformTestCase.java:109)
	at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:424)
	at com.intellij.testFramework.UsefulTestCase.lambda$runBare$12(UsefulTestCase.java:491)
	at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$3(EdtTestUtil.java:80)
	at com.intellij.openapi.application.impl.RwLockHolder.runWriteIntentReadAction(RwLockHolder.kt:70)
	at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$4(EdtTestUtil.java:79)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:326)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)


> Task :test
CompileCommand: exclude com/intellij/openapi/vfs/impl/FilePartNodeRoot.trieDescend bool exclude = true
com.my.module.indexing.ModuleIndexTest > testIndexData FAILED
    java.lang.IllegalStateException at ModuleIndexTest.kt:9
1 test completed, 1 failed
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///Users/b.harniuk/Projects/IiPluginIndexesBug/build/reports/tests/test/index.html
* Try:
> Run with --scan to get full insights.
BUILD FAILED in 16s
20 actionable tasks: 2 executed, 18 up-to-date

Steps to reproduce

  1. clone repository: https://github.com/bohdan-harniuk/ii-plugin-indexes-bug.git
  2. run test: com.my.module.indexing.ModuleIndexTest#testIndexData

Gradle IntelliJ Plugin version

2.0.0-beta1

Gradle version

8.7

Operating System

macOS

Link to build, i.e. failing GitHub Action job

No response

@bohdan-harniuk bohdan-harniuk changed the title java.lang.IllegalStateException: Index is not created for INDEX ID 2.0 - IllegalStateException: Index is not created for INDEX ID (when running test) Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant