Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5352

Create public addURL method to PluginClassLoader


    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • 1.14.4
    • Yes

      This suggestion is specific for the newer java versions, more specifically java 9 or above.

      A lot of plugins on spigot that try to be as lightweight as possible, as well as work on a server network tend to load external libraries into their own class loader.

      A few examples of those things that I found on spigot:

      This approach worked perfectly fine for java 8, yet the version of the language is now a total of four major updates behind the latest release of java and the used call


      now ends up in an illegal access warning (https://stackoverflow.com/questions/50251798/what-is-an-illegal-reflective-access).

      To fix this, spigots plugin class loader class (org.bukkit.plugin.java.PluginClassLoader) can implement a wrapper for the protected method of its parent class (the URLClassLoader).

      Addition to the PluginClassLoader:

      public void addURL(URL url) {

      This change has absolutely no affect on any of spigots behavior, as the method is not called at all during the normal class loader creation, but allows plugin developers to updated smoothly to java 9 or newer without having to sacrifice the ability to dynamically load libraries or other java classes into the plugins own class loader.

            Unassigned Unassigned
            LynxPlay Bjarne Koll
            2 Vote for this issue
            6 Start watching this issue