3 ms·
"It's not meant to solve the problem of having different library versions on the same classpath" It kind of is - there's a single API call that lets you instan
by native_samples 5y ago
"It's not meant to solve the problem of having different library versions on the same classpath"
It kind of is - there's a single API call that lets you instantiate a module graph with every module mapped to its own classloader. At that point modules work as you'd expect, and package overlaps only create errors if they're both being imported into a single module (where it'd be ambiguous at the language level).
As the article explains, this isn't on by default only because (supposedly) some popular frameworks would break due to assumptions about how classloaders are used in practice.
And here we hit a sort of weakness in how Java is developed. I've seen this justification given several times over the years for why module isolation isn't on by default. At no point are the frameworks in question named. Which frameworks break when this is on? And why can't I just flip a command line flag to enable or disable it? This compatibility argument is left hanging but no details are given, which is unfortunate - if the frameworks in question were named, maybe they'd fix their assumptions or other people would and classpath conflicts could be fixed.
- mjburgess 5y ago> It kind of is - there's a single API call that lets you instantiate a module graph with every module mapped to its own classloader.... This is what I would expect -- and hence would likely solve most of my issues managing the classpath.