Intellij 插件:无法初始化组件状态异常
Intellij Plugin: Cannot init component state exception
我正在尝试使用 Settings->Tools
中的一些配置创建一个 Intellij Idea 插件。
我有一个 ApplicationService
来保存和保存这些配置,但是调用 ServiceManager.getService(MyService.class)
时出现异常,并且在重新打开 Intellij Idea 时配置不会保留。
这是异常的堆栈跟踪:
com.intellij.diagnostic.PluginException: Cannot init component state [Plugin: org.mycompany.mycompany-plugin]
at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:116)
at com.intellij.configurationStore.ComponentStoreWithExtraComponents.initComponent(ComponentStoreWithExtraComponents.kt:50)
at com.intellij.serviceContainer.ComponentManagerImpl.initializeComponent$intellij_platform_serviceContainer(ComponentManagerImpl.kt:358)
at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:58)
at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:41)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:115)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:69)
at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:411)
at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:394)
at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:20)
at com.mycompany.config.SettingsService.getInstance(SettingsService.java:14)
at com.mycompany.config.SettingsConfigurable.reset(SettingsConfigurable.java:46)
at com.intellij.openapi.options.ex.ConfigurableWrapper.reset(ConfigurableWrapper.java:177)
at com.intellij.openapi.options.ex.ConfigurableCardPanel.reset(ConfigurableCardPanel.java:166)
at com.intellij.openapi.options.ex.ConfigurableCardPanel.lambda$createConfigurableComponent(ConfigurableCardPanel.java:118)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
(a lot more lines here)
Caused by: java.lang.UnsupportedOperationException: configurationSchemaKey must be specified for com.mycompany.config.SettingsService
at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:369)
at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:100)
... 113 more
除了它是一个 ApplicationService XML 参数之外,我没有找到关于“configurationSchemaKey”的文档 - 但我找不到我应该在其中输入什么值。一.
我是这样定义服务的:
<applicationService
serviceImplementation="com.testmycode.config.SettingsService"
id="com.testmycode.config.SettingsService"/>
我错过了什么?
configurationSchemaKey
属性 是 ServiceDescriptor
的一部分,描述为:
Cannot be specified as part of {@link State} because to get annotation, class must be loaded, but it cannot be done for performance reasons.
但是,创建此类处理设置的服务并不常见。
请查看您当前的实施并遵循 IntelliJ Platform SDK DevGuide 中的 Introduction to Settings 指南。
我正在尝试使用 Settings->Tools
中的一些配置创建一个 Intellij Idea 插件。
我有一个 ApplicationService
来保存和保存这些配置,但是调用 ServiceManager.getService(MyService.class)
时出现异常,并且在重新打开 Intellij Idea 时配置不会保留。
这是异常的堆栈跟踪:
com.intellij.diagnostic.PluginException: Cannot init component state [Plugin: org.mycompany.mycompany-plugin]
at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:116)
at com.intellij.configurationStore.ComponentStoreWithExtraComponents.initComponent(ComponentStoreWithExtraComponents.kt:50)
at com.intellij.serviceContainer.ComponentManagerImpl.initializeComponent$intellij_platform_serviceContainer(ComponentManagerImpl.kt:358)
at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:58)
at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:41)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:115)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:69)
at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:411)
at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:394)
at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:20)
at com.mycompany.config.SettingsService.getInstance(SettingsService.java:14)
at com.mycompany.config.SettingsConfigurable.reset(SettingsConfigurable.java:46)
at com.intellij.openapi.options.ex.ConfigurableWrapper.reset(ConfigurableWrapper.java:177)
at com.intellij.openapi.options.ex.ConfigurableCardPanel.reset(ConfigurableCardPanel.java:166)
at com.intellij.openapi.options.ex.ConfigurableCardPanel.lambda$createConfigurableComponent(ConfigurableCardPanel.java:118)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
(a lot more lines here)
Caused by: java.lang.UnsupportedOperationException: configurationSchemaKey must be specified for com.mycompany.config.SettingsService
at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:369)
at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:100)
... 113 more
除了它是一个 ApplicationService XML 参数之外,我没有找到关于“configurationSchemaKey”的文档 - 但我找不到我应该在其中输入什么值。一.
我是这样定义服务的:
<applicationService
serviceImplementation="com.testmycode.config.SettingsService"
id="com.testmycode.config.SettingsService"/>
我错过了什么?
configurationSchemaKey
属性 是 ServiceDescriptor
的一部分,描述为:
Cannot be specified as part of {@link State} because to get annotation, class must be loaded, but it cannot be done for performance reasons.
但是,创建此类处理设置的服务并不常见。
请查看您当前的实施并遵循 IntelliJ Platform SDK DevGuide 中的 Introduction to Settings 指南。