June 20th, 2024

Moving to Java 17 or how I learned to stop worrying and love NoSuchMethodError

Icon Solutions upgraded to Java 17 in IPF 2024.1 for Spring 6 and Spring Boot 3 compatibility. Challenges included plugin and dependency adjustments, emphasizing centralized management and code cleanliness post-upgrade for smoother transitions.

Read original articleLink Icon
Moving to Java 17 or how I learned to stop worrying and love NoSuchMethodError

Icon Solutions recently upgraded all components to Java 17 in their IPF 2024.1 release. The lead engineer shared insights on the upgrade, highlighting reasons for the move, including support for new Java features and improved garbage collection. The decision was influenced by Spring 6 and Spring Boot 3's requirement for Java 17+. The upgrade process involved addressing compatibility issues with plugins and dependencies, particularly those related to Java EE to Jakarta EE transition. Despite challenges, the team documented their experiences to assist customers in similar upgrades. Lessons learned emphasized the importance of centralized dependency management and staying updated on plugin versions to facilitate smoother transitions. The blog post also touched on the need to maintain code cleanliness post-upgrade. The upgrade to Java 17 was seen as a valuable learning experience, ensuring compatibility with modern frameworks and technologies while prioritizing stability over early adoption of cutting-edge features.

Link Icon 8 comments
By @kelnos - 4 months
> Also, I’d argue this barely qualifies for the boy scout rule: does migrating the code to a more modern form of itself count as leaving it “neater than it was”?

"Barely" is an understatement. You just shouldn't do this as part of a big version migration. It's noise, and introduces more changes that could cause bugs, and then you end up wondering if the bugs were caused by the big version migration, or by all the little changes that were supposedly cosmetic.

Arguably you shouldn't make those types of changes on their own at all. If you're later refactoring the code for a "real" purpose, or making other type of changes in that area, sure, go ahead, the code that you're working on to their more modern forms. But otherwise they're akin to rewrites: the existing code works, and has been tested and debugged, and changing it just so it "looks more modern" is pointless.

By @readthenotes1 - 4 months
"Minimum Boy Scout: Is this a controversial take? Of course you should leave things neater than when you found them, but after moving a project to Java 17 I had lots of lovely attempts to help by IntelliJ: “Can be a record!”, “Can be a text block!”, “Use pattern variable!”, “Replace with switch expression!” – these are all wonderful suggestions, but you are soon distracted by them and it will make the job take that little bit longer."

This seems to be a application of the second system effect noticed by Fred Brooks in the 1960s (that the second version of a system is extraordinarily dangerous because of all the "while we're in here why don't we..." opportunities)

By @bitcharmer - 4 months
From my experience the biggest PITA with switching to jdk 17 and beyond is the module system (jigsaw). Very few projects utilize this in practice and instead of being a step forward it's a source of annoying runtime errors and typically results in a --add-opens mess on the command line too.

Moving away from traditional JNI (especially with critical JNI natives) also complicates what used to quick and easy work. But at least Panama clearly comes with interop and compiler-level improvements.

Jigsaw though... I can't even.

By @happymellon - 4 months
Java 17 was mostly a positive upgrade. Although in my slow moving bank we still managed to do this a while ago and mostly for the same reasons, Spring Boot let us scapegoat it! Having security put in tooling they don't understand so that it alerts whenever something is vaguely out of date has been annoying for systems that aren't consumer facing but instances like this make it worthwhile.

Thank you Spring Boot, and long may it continue.

By @michael_michael - 4 months
There are a few blog title/conference talk title cliches that I would love to toss in a volcano and never hear again:

X, or how I learned to stop worrying and love Y

X for fun and profit

A tale of two X

X considered harmful

By @CobrastanJorji - 4 months
Why is everybody migrating from Java 8 to Java 17 this week? Seems like this is not the first time I've seen this sort of thing on the front page in the last few days. Did some long term support thing happen?