GlowstoneMC/Bukkit2Sponge

Glowstone++: java.lang.SecurityException: sealing violation: package javax.annotation is sealed

deathcap opened this issue · 2 comments

When loading on Glowstone++ build 201, Bukkit2Sponge fails with:

17:51:57 [INFO] Loading plugins...
17:51:58 [SEVERE] Error loading /Users/admin/minecraft/Glowstone++/plugins/bukkit2sponge-0.5.jar/javax.annotation.ParametersAreNullableByDefault
java.lang.SecurityException: sealing violation: package javax.annotation is sealed
    at java.net.URLClassLoader.getAndVerifyPackage(URLClassLoader.java:388)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:417)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at net.glowstone.shiny.plugin.PluginLoader.loadJar(PluginLoader.java:66)
    at net.glowstone.shiny.plugin.PluginLoader.loadPlugins(PluginLoader.java:44)
    at net.glowstone.shiny.plugin.ShinyPluginManager.loadPlugins(ShinyPluginManager.java:86)
    at net.glowstone.shiny.Shiny.load(Shiny.java:63)
    at net.glowstone.GlowServer.start(GlowServer.java:451)
    at net.glowstone.GlowServer.main(GlowServer.java:109)

loads fine on Glowstone build 123. Probably a conflict with Glowstone++'s own SpongeAPI implementation, GlowstoneMC/Glowstone#33, because both the server and Bukkit2Sponge plugin include javax.annotation (com.google.code.findbugs:jsr305)

Hint from thomas15v on https://forums.spongepowered.org/t/bukkit2sponge-an-implementation-of-spongeapi-for-bukkit-servers/6747/12:

I would say, try to relocate javax.inject because the javax package looks kinda sealed.

This might need to be fixed in Glowstone++, since the javax.annotation package (@optional annotations etc.) is needed by SpongeAPI plugins. The conflict probably wasn't seen in Glowstone because it uses annotations from Guava 10 instead (moved out of Guava 17 into a jsr305 package, see GlowstoneMC/Glowstone@e9fcec5)

javax.annotation is actually only used one place, in GlowScheduler for @nullable (see http://stackoverflow.com/questions/3800033/guava-r07-gwt-and-javax-annotation-nullable), added in GlowstoneMC/Glowstone@8a75ed9 - the com.google.code.findbugs:jsr305 (formerly in Guava 10) dependency is not needed in Glowstone++ otherwise, can be removed and then Bukkit2Sponge loads