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

Exception: Class initialization must not depend on services. Consider using instance of the service on-demand instead. #75

Closed
sgoudham opened this issue Aug 7, 2024 · 1 comment · Fixed by #81
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sgoudham
Copy link
Contributor

sgoudham commented Aug 7, 2024

Since merging #68, I'm actually starting to see this error on startup:

java.lang.Throwable: com.github.catppuccin.jetbrains_icons.IconPack <clinit> requests com.github.catppuccin.jetbrains_icons.settings.PluginSettingsState instance. Class initialization must not depend on services. Consider using instance of the service on-demand instead.
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
	at com.intellij.serviceContainer.ComponentManagerImplKt.checkOutsideClassInitializer(ComponentManagerImpl.kt:1588)
	at com.intellij.serviceContainer.ComponentManagerImplKt.getOrCreateInstanceBlocking(ComponentManagerImpl.kt:1557)
	at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:746)
	at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:690)
	at com.github.catppuccin.jetbrains_icons.settings.PluginSettingsState$Companion.getInstance(PluginSettingsState.kt:21)
	at com.github.catppuccin.jetbrains_icons.IconPack.<init>(IconPack.kt:6)
	at com.github.catppuccin.jetbrains_icons.IconPack.<clinit>(IconPack.kt:9)
	at com.github.catppuccin.jetbrains_icons.IconProvider.<init>(IconProvider.kt:15)
	at com.intellij.serviceContainer.ComponentManagerImpl.findConstructorAndInstantiateClass(ComponentManagerImpl.kt:900)
	at com.intellij.serviceContainer.ComponentManagerImpl.doInstantiateClass(ComponentManagerImpl.kt:909)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:894)
	at com.intellij.openapi.extensions.impl.SimpleConstructorInjectionAdapter.instantiateClass(XmlExtensionAdapter.kt:103)
	at com.intellij.openapi.extensions.impl.XmlExtensionAdapter.doCreateInstance(XmlExtensionAdapter.kt:52)
	at com.intellij.openapi.extensions.impl.XmlExtensionAdapter.createInstance(XmlExtensionAdapter.kt:33)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapter(ExtensionPointImpl.kt:403)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.createExtensionInstances(ExtensionPointImpl.kt:376)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensionList(ExtensionPointImpl.kt:222)
	at com.intellij.openapi.extensions.ExtensionPointName.getExtensionList(ExtensionPointName.kt:54)
	at com.intellij.util.PsiIconUtil.getIconFromProviders(PsiIconUtil.kt:16)
	at com.intellij.ide.PsiBasedFileIconProvider.getIcon(PsiBasedFileIconProvider.java:19)
	at com.intellij.ide.FileIconUtil.getIconFromProviders(FileIconUtil.kt:23)
	at com.intellij.util.IconUtilKt.computeFileIconImpl(IconUtil.kt:559)
	at com.intellij.openapi.fileEditor.impl.EditorsSplittersKt$computeFileEntry$tabIconTask$1$1.invoke(EditorsSplitters.kt:1058)
	at com.intellij.openapi.fileEditor.impl.EditorsSplittersKt$computeFileEntry$tabIconTask$1$1.invoke(EditorsSplitters.kt:1057)
	at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:104)
	at com.intellij.openapi.application.rw.InternalReadAction.access$insideReadAction(InternalReadAction.kt:15)
	at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:94)
	at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:93)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$2$lambda$1$lambda$0(cancellableReadAction.kt:31)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:291)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:965)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$2$lambda$1(cancellableReadAction.kt:29)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:155)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:27)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:93)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:77)
	at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:64)
	at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:15)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invokeSuspend(InternalReadAction.kt:43)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invoke(InternalReadAction.kt)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invoke(InternalReadAction.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:163)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
	at com.intellij.openapi.application.rw.InternalReadAction.runReadAction(InternalReadAction.kt:39)
	at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAction(PlatformReadWriteActionSupport.kt:38)
	at com.intellij.openapi.application.ReadWriteActionSupport.executeReadAction$default(ReadWriteActionSupport.kt:15)
	at com.intellij.openapi.application.CoroutinesKt.constrainedReadAction(coroutines.kt:58)
	at com.intellij.openapi.application.CoroutinesKt.readAction(coroutines.kt:25)
	at com.intellij.openapi.fileEditor.impl.EditorsSplittersKt$computeFileEntry$tabIconTask$1.invokeSuspend(EditorsSplitters.kt:1057)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)

The icons still load after this exception so I thought it was another plugin causing it. If it can't be fixed soon then I'll revert the PR and we can push out v1.6.1 which includes support for 2024.2.

cc: @thelooter

@sgoudham sgoudham added bug Something isn't working help wanted Extra attention is needed labels Aug 7, 2024
@sgoudham
Copy link
Contributor Author

sgoudham commented Aug 7, 2024

Actually, I don't think #68 is the root cause cause I still get these errors on the build from #71 which makes me think that it's a deeper incompatibility with IDE version 2024.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant