4 ms·
> The Java classpath is "flat" by default: you can only have one version of any given class [...] This has advantages: you avoid the Rust problem of "Foo is inc
by cesarb 5y ago
> The Java classpath is "flat" by default: you can only have one version of any given class [...] This has advantages: you avoid the Rust problem of "Foo is incompatible with Foo" because you had two different versions of Foo in your (transitive) dependencies.
The Java classpath is "flat" only if you use a single classloader. If you use multiple classloaders (for instance, with a plugin system where each plugin is loaded on its own classloader, to allow it to be dynamically loaded and unloaded), you can have multiple versions of any given class. At work, we have more than once had that "Foo is incompatible with Foo" problem (made more maddening because the "Foo is incompatible with Foo" error messages don't mention which classloader each "Foo" came from).
- sebazzz 5y agoThat's correct. This is especially noticable with application servers like Jboss that deliver their own libraries in the class path. Needing a slightly higher version of Hibernate is... interesting.