[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: guava-libraries 18?



* Thorsten Glaser:

> On Tue, 28 Oct 2014, Emmanuel Bourg wrote:
>
>> like to highlight that in Java you can't have two incompatible versions
>> of the same library on the classpath. So if elasticsearch pulls another
>> library that depends on guava but is incompatible with the version 18,
>> it's likely to break at runtime.
>
> That’s what a coworker told me last week, too. I was really
> amazed/puzzled.
>
> Apparently, you can get around this by writing custom class
> loaders. Can’t we “just” put one of these together with each
> library, so it only gets “its own” dependencies in a private
> code bubble?

We already ship many implementations of this idea.  Apache Felix and
Eclipse Equinox are examples, but I'm sure there are more.  OpenJDK
was working on another module framework at one point, but I don't know
the status of that (it was supposed to go into OpenJDK 8, but
obviously that didn't happen).

It's difficult to do class loader isolation unconditionally because if
references to classes leak across a module boundary, they are treated
as distinct by the JVM, resulting in failure at run time.


Reply to: