3 ms·
I love Java, I love the ecosystem. It's been a 25 year journey. I will be the first to admit that I have not adopted "modern Java", mostly with all of the func
by whartung 2y ago
I love Java, I love the ecosystem. It's been a 25 year journey.
I will be the first to admit that I have not adopted "modern Java", mostly with all of the functional stuff (notably all of the collection streams and what not).
I certainly enjoy easy lambdas, but I don't necessarily code stuff up that way.
I'm not big on locked down classes, as a general rule. I won't say I never use "private", but it wouldn't bother me if that didn't exist. I can't say I'd "never" use records, but I'm so used to the boiler plate, I don't really see it any more.
My one issue, though, is simply how heavy handed the Java 9 module system is. I have a desktop app, and I use the module system to lighten up the JRE that it bundles. But that's an edge case (to me).
I'm just not a fan of it, I find it gets in the way more than anything, and it just seems more forced than optional.
Outside of building JREs, does anyone use the module system for anything?
- MichaelNolan 2y agoMy understanding is that the module system is primarily for library developers and not application developers. You can use the module system to strongly encapsulate your internals, which allows you to change those internal implementations without having to worry that some client is depending on it.
- vips7L 2y agoIt’s for both really. The module system comes into play when application developers what to ship a jlinked runtime. You can make the size of your JVM executable down to like 35MB or smaller.
- kernal 2y agoGraalVM uses it to build its native executables.
- gergo_barany 2y agoYou can build GraalVM native images from modularized code, but you can also build them from non-modularized code.
- kernal 2y agoWouldn't the native executable be smaller using modularized code?
- gergo_barany 2y agoI don't see why it would be. The native image static analysis decides on the level of individual classes, methods, and even class fields what to include in the image and what not. It doesn't compile entire packages or modules into the image, only parts it considers reachable. And the module system shouldn't influence this reachability analysis I think.