Skip to content

Class initialization must not depend on services if first class decompiling starts early #35

@ZZZank

Description

@ZZZank

The "starts early" can be reproduced by pinning a decompiled source and restart Idea. This error will be reported on project opening

Image

java.lang.Throwable: org.vineflower.ijplugin.ClassicVineflowerPreferences <clinit> requests com.intellij.psi.codeStyle.AppCodeStyleSettingsManager 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:1586)
	at com.intellij.serviceContainer.ComponentManagerImplKt.getOrCreateInstanceBlocking(ComponentManagerImpl.kt:1555)
	at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:751)
	at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:695)
	at com.intellij.psi.codeStyle.CodeStyleSettingsManager.getInstance(CodeStyleSettingsManager.java:184)
	at com.intellij.application.options.CodeStyle.getDefaultSettings(CodeStyle.java:50)
	at org.vineflower.ijplugin.ClassicVineflowerPreferences.<clinit>(ClassicVineflowerPreferences.kt:39)
	at org.vineflower.ijplugin.VineflowerInvoker.decompile(VineflowerInvoker.kt:93)
	at org.vineflower.ijplugin.VineflowerDecompilerBase$Companion.getText(VineflowerDecompilerBase.kt:39)
	at org.vineflower.ijplugin.VineflowerDecompilerLight.getText(VineflowerDecompilerLight.kt:12)
	at org.vineflower.ijplugin.VineflowerDecompilerLight.getText(VineflowerDecompilerLight.kt:6)
	at com.intellij.psi.impl.compiled.ClassFileDecompiler.decompile(ClassFileDecompiler.java:29)
	at com.intellij.openapi.fileEditor.impl.LoadTextUtil.loadText(LoadTextUtil.java:503)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerBase.loadText(FileDocumentManagerBase.java:114)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerBase.getDocument(FileDocumentManagerBase.java:64)
	at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManagerKt$createEditorCompositeModel$1$1$document$1.invokeSuspend$lambda$0(EditorCompositeModelManager.kt:47)
	at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:114)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable$lambda$4(InternalReadAction.kt:104)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$3$lambda$2$lambda$1(cancellableReadAction.kt:32)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:351)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:972)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$3$lambda$2(cancellableReadAction.kt:30)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:157)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:28)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:103)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:87)
	at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:74)
	at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:16)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invokeSuspend(InternalReadAction.kt:53)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invoke(InternalReadAction.kt)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.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:49)
	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:62)
	at com.intellij.openapi.application.CoroutinesKt.readAction(coroutines.kt:29)
	at com.intellij.openapi.fileEditor.impl.EditorCompositeModelManagerKt$createEditorCompositeModel$1$1$document$1.invokeSuspend(EditorCompositeModelManager.kt:46)
	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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions