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

New libraries feature cannot load the same library in two different plugins

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • Java 11.0.10
      Windows 10.0.19042
      Running under Docker containers (Docker 20.10.6)

    • 3090-Spigot-9fb885e-90a4d64 (MC: 1.16.5)
    • Yes

      Context
      I am developing two plugins, one of which is a "library" plugin (providing useful features to be reused in my projects) and the other one being a specific feature (in my case a lottery plugin). I wrote both of them in Kotlin, and they also use some other libraries (e.g. SQL libraries). I decided to use the new libraries keyword in the plugin.yml file to load all my libraries (Kotlin, SQL connectors...) from Spigot instead of shading them inside my plugins (which I would very much like to avoid returning to).

      The issue
      When the first "library" plugin loads, it goes well, and it does the small amount of things it does by itself without any issue (which means that the libraries keyword works). Unfortunately, when the second plugin tries to load and execute code, it throws a JVM loader constraint violation (full stacktrace attached). Basically, a class that was previously loaded by the first plugin's class loader was then loaded by the second plugin's one, and it won't work.

      Steps to reproduce
      1. Create two very simple plugins and add a common library in both
      2. In the onEnable, use the same class from this library in both plugins
      3. Compile both and start a server with them

      If needed, I can provide two test plugins

       

        1. bug.zip
          41 kB
        2. spigot bug.png
          spigot bug.png
          81 kB

            Unassigned Unassigned
            Zodiia Manon Grivot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: