Cannot use Clojure in plugin due to classloader restrictions

I am trying to develop a Clojure language plugin that is written in Clojure (so it can invoke existing Clojure linters, analyzers, etc. as libraries). In theory this should be possible since Clojure runs on the JVM and has an “invoke from Java” API, but the classloader restrictions in recent versions of Sonarqube make it not work. This is because Clojure uses the context classloader when it starts up.

I have a prototype plugin that loads initially, sets the context classloader to the one Sonarqube is using for the plugin, and invokes some Clojure code (I get a “hello world” from the Clojure side). But then when it tries to load at a later stage of startup (when the classloader security restrictions are actually enforced), it fails due to the .getClassLoader() call.

I think this is the same issue as reported here: Access denied ("java.lang.RuntimePermission" "getClassLoader") for Plugin in Computing Engine of SQ 8.0 and SQ 8.1

Is there anything that could be done here to allow using Clojure in plugins?