How to make the plugin CCTL aware of the Service Provider type that java.utils.ServiceLoader looks for
I'm running into an issue, where one of the library I'm depending on uses java.utils.ServiceLoader to load a service provider. The java.utils.ServiceLoader uses the Thread Context Class Loader (CCTL) to load the service provider.
In plugin, the CCTL set for the thread is com.intellij.util.lang.UrlClassLoader, if I take a look at the urls of this com.intellij.util.lang.UrlClassLoader instance, then I don't see the file url to the jar containing the service provider java type that java.utils.ServiceLoader is attempting to load.
I have the dependency containing service provider type added in build.gradle, I can see that this jar is available only in plugin class loader which is com.intellij.ide.plugins.cl.PluginClassLoader (PCL)
I don't want to override the CCTL with PCL since com.intellij.util.lang.UrlClassLoader might have dependencies the InelliJ plugin system uses for it's own internal processing.
So I guess the question is - how can I make com.intellij.util.lang.UrlClassLoader aware of the dependency that contain the type I want java.utils.ServiceLoader to load?
Post is closed for comments.
https://youtrack.jetbrains.com/issue/IDEA-241229