GlowstoneMC / Bukkit2Sponge

An implementation of SpongeAPI for Bukkit servers (Glowstone, Spigot)
https://www.glowstone.net/
Other
18 stars 3 forks source link

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

Closed deathcap closed 9 years ago

deathcap commented 9 years ago

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, https://github.com/deathcap/GlowstonePlusPlus/pull/33, because both the server and Bukkit2Sponge plugin include javax.annotation (com.google.code.findbugs:jsr305)

deathcap commented 9 years ago

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 https://github.com/deathcap/GlowstonePlusPlus/commit/e9fcec5ec190929e4d63c06b76e3185e1be9af7b)

deathcap commented 9 years ago

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 https://github.com/deathcap/GlowstonePlusPlus/commit/8a75ed9a91ac7a5f5eda0cd7f70dca7e7b5b334d - the com.google.code.findbugs:jsr305 (formerly in Guava 10) dependency is not needed in Glowstone++ otherwise, can be removed and then Bukkit2Sponge loads