Key B duplicated (likely due to Proguard?) issue
Answered
A user of my plugin reported the following issue
Plugin 'izhangzhihao.rainbow.brackets' failed to initialize and will be disabled. Please restart WebStorm.
com.intellij.diagnostic.PluginException: Key B duplicated; existingAdapter: ServiceAdapter(descriptor=Serv iceDescriptor(interface='null' , serviceImplementation='B', testServiceImplementation='nul l', headlessImplementation='null', overrides=false, configurationSchemaKey='null', preload=FALSE, client=null), pluginDescriptor=PluginDescrip tor(name=Codeium, id=com.codeium.intellij, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/WebStorm2022 .1/plugins/codeium, version=1.1.53, package=null, isBundled=false)); descriptor: B; app: Application (containerState=PRE_INIT) ; current plugin: izhangzhihao.rainbow.brackets
at com.intellij.serviceContainer.ComponentManagerImpl.registerS ervices(ComponentManagerImpl. kt:502)
at com.intellij.serviceContainer.ComponentManagerImpl.registerC omponents(ComponentManagerImpl .kt:251)
at com.intellij.openapi.client.ClientAwareComponentManager.regi sterComponents(ClientAwareComp onentManager.kt:63)
at com.intellij.idea.ApplicationLoader$initApplication$block$3. apply(ApplicationLoader.kt: 129)
at com.intellij.idea.ApplicationLoader$initApplication$block$3. apply(ApplicationLoader.kt)
at java.base/java.util.concurrent.CompletableFuture.uniComposeS tage(CompletableFuture.java: 1106)
at java.base/java.util.concurrent.CompletableFuture.thenCompose (CompletableFuture.java:2235)
at com.intellij.idea.ApplicationLoader.initApplication(Applicat ionLoader.kt:126)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invo ke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invo ke(NativeMethodAccessorImpl. java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl. invoke(DelegatingMethodAccesso rImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.intellij.idea.j.j(j.java:94)
at com.intellij.ide.h.j.j1.j(j1.java:137)
at com.intellij.ide.h.j.h2.j(h2.java:189)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invo ke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invo ke(NativeMethodAccessorImpl. java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl. invoke(DelegatingMethodAccesso rImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.intellij.idea.MainImpl.start(MainImpl.java:79)
at com.intellij.idea.StartupUtil.lambda$start$14(StartupUtil.ja va:260)
at java.base/java.util.concurrent.CompletableFuture$UniCompose. tryFire(CompletableFuture. java:1072)
at java.base/java.util.concurrent.CompletableFuture.postComplet e(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply .run(CompletableFuture.java: 1705)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply .exec(CompletableFuture.java: 1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec( ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue. topLevelExec(ForkJoinPool. java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPoo l.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker( ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Fork JoinWorkerThread.java:183)
I assume what happened is that both my plugin (Codeium) and another plugin (Rainbow Brackets) both use Proguard for obfuscation and both had an IntelliJ service whose class name was obfucsated to 'B', which resulted in a collision. I suppose I can fix this by modifying how I use Proguard, but shouldn't this be fixed on the IntelliJ side, perhaps by prefixing the service key with the plugin name?
Please sign in to leave a comment.
Ah I see. I think I should not have set
as this removes the package for the services altogether. My bad! Hopefully this is helpful to someone in the future.