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=ServiceDescriptor(interface='null', serviceImplementation='B', testServiceImplementation='null', headlessImplementation='null', overrides=false, configurationSchemaKey='null', preload=FALSE, client=null), pluginDescriptor=PluginDescriptor(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.registerServices(ComponentManagerImpl.kt:502)
    at com.intellij.serviceContainer.ComponentManagerImpl.registerComponents(ComponentManagerImpl.kt:251)
    at com.intellij.openapi.client.ClientAwareComponentManager.registerComponents(ClientAwareComponentManager.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.uniComposeStage(CompletableFuture.java:1106)
    at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
    at com.intellij.idea.ApplicationLoader.initApplication(ApplicationLoader.kt:126)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.java:260)
    at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(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(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.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?

0
1 comment

Ah I see. I think I should not have set 

repackageclasses("")

as this removes the package for the services altogether. My bad! Hopefully this is helpful to someone in the future.

0

Please sign in to leave a comment.