Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glowstone/Guava 10 compatibility (vs Guava 17) #5

Closed
deathcap opened this issue Apr 23, 2015 · 6 comments · Fixed by #10
Closed

Glowstone/Guava 10 compatibility (vs Guava 17) #5

deathcap opened this issue Apr 23, 2015 · 6 comments · Fixed by #10

Comments

@deathcap
Copy link
Contributor

Glowstone (tested on build 123) currently bundles Guava version 10 (see https://github.com/GlowstoneMC/Glowkit/pull/68 Update to Guava 17), but SpongeAPI requires Guava 17, therefore Bukkit2Sponge uses it (and relocating to avoid version conflicts breaks interface contracts, see #3), failing to load due to this version difference:

18:11:08 [SEVERE] Error occurred while enabling Bukkit2Sponge v0.5 (Is it up to date?)
java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.build()Lcom/google/common/cache/Cache;
at com.google.inject.internal.WeakKeySet.(WeakKeySet.java:55)
at com.google.inject.internal.InheritingState.(InheritingState.java:65)
at com.google.inject.internal.InjectorShell$Builder.getState(InjectorShell.java:203)
at com.google.inject.internal.InjectorShell$Builder.lock(InjectorShell.java:114)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.inject.Guice.createInjector(Guice.java:96)
at com.google.inject.Guice.createInjector(Guice.java:73)
at com.google.inject.Guice.createInjector(Guice.java:62)
at io.github.deathcap.bukkit2sponge.Bukkit2Sponge.load(Bukkit2Sponge.java:54)
at io.github.deathcap.bukkit2sponge.Bukkit2Sponge.onEnable(Bukkit2Sponge.java:47)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:324)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404)
at net.glowstone.GlowServer.enablePlugins(GlowServer.java:726)
at net.glowstone.GlowServer.start(GlowServer.java:477)
at net.glowstone.GlowServer.main(GlowServer.java:106)

Bukkit2Sponge unfortunately can't downgrade to Guava 10 since SpongeAPI needs Guava 17. Maybe this conflict can be solved by dynamically relocating Guava in the plugin classloader (in addition to maven-shade-plugin relocation at build time).

@jamierocks
Copy link

We modify Bukkit like https://github.com/CanaryBukkitTeam/BukkitC for CanaryBukkit. You could do the same for SpongeAPI?

@phase
Copy link

phase commented Apr 23, 2015

@jamierocks It'd be better to use "vanilla" Sponge, so it's compatible with everything. It might be possible to make small changes.

@deathcap
Copy link
Contributor Author

Yeah I'd like to use SpongeAPI unmodified if at all possible, easier than maintaining a fork, and the SpongePowered team seems open to changes if there's anything reasonable that would need to be changed there.

But changing SpongeAPI to use Guava 10 is, sadly, not feasible - not only would that be a downgrade, but would also break Guava 17 compatibility with plugins. As I understand it, they have to stick to 17 because that's what Minecraft uses (notwithstanding bundling their own relocated version).

On the Bukkit API side, fixed this in Glowstone++ by using a Glowkit/Bukkit updated with Guava 17 (via Spigot-Bukkit), so its now only a problem on the original Glowstone, and potentially older Bukkit server implementations. When did Spigot update Bukkit to use Guava 17, I think it was Minecraft 1.8? or 1.7? Maybe worth just dropping older version support..

@deathcap
Copy link
Contributor Author

A possible reason to support Guava 10 in older servers:

https://forums.spongepowered.org/t/bukkit2sponge-an-implementation-of-spongeapi-for-bukkit-servers/6747/22

nice smile but my moded servers are still in 1.6.4 so no chance to use it frowning

@jamierocks
Copy link

Why not just use Spigot's version of bukkit?

@deathcap deathcap mentioned this issue Apr 27, 2015
@deathcap
Copy link
Contributor Author

@jamierocks https://forums.glowstone.net/t/spigots-new-1-8-bukkit-api/68/25

PR #10 adds class relocation so the Guava is independent from whatever the server platform bundles. With this change Bukkit2Sponge loads on Glowstone (and still loads on Glowstone++), and should also work on other servers using Bukkit 1.7.10-derived/earlier APIs (untested).

deathcap added a commit that referenced this issue Apr 27, 2015
Relocate Guava at build and runtime for backward compatibility. Closes GH-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants