r/java • u/henk53 • Mar 22 '22
Java 18 released!
https://mail.openjdk.java.net/pipermail/jdk-dev/2022-March/006458.html43
u/Hall_of_Famer Mar 22 '22
This is great news. Come to think about it, we went from Java 6 to Java 9 in more than 10 years, but from Java 9 to Java 18 in less than 5 years. Over the last few years Java has added lots of missing modern features from other languages such as C#, Scala and Kotlin, it is a very different language from the Java 5 we wrote in 2000s. This also means that a lot of criticism for Java is no longer valid, the language has indeed come a long way.
23
u/Joram2 Mar 22 '22
The big projects still stuck on Java 8 are things like Apache Spark and Databricks and also Amazon's EMR environment. And then, of course customers that want to use that platforms have to use Java 8 as well.
The big obstacle to upgrading seems to be that those projects have tons of legacy dependencies on ancient projects that have been abandoned and removing those old dependencies or upgrading them is more effort than it's worth. Also the Sparks + Databricks people seem largely uninterested in supporting newer versions of Java. They put much more effort into supporting their Python developers, which makes sense, given that that's what most developers want.
On the bright side, projects like Kafka already support Java 17 and have officially deprecated Java 8 and they plan to drop Java 8 support in the next major release. Projects like Apache Flink seem close behind: They will formally deprecate Java 8 in 1.15 and add support for Java 17 in the next release, 1.16.
5
u/tristan97122 Mar 23 '22
The big projects still stuck on Java 8
Well Spring 6 and Spring Boot 3 will have a baseline of Java 17 so that will hopefully help quite a bit for people to stop finding excuses to not upgrade
4
u/rustyrazorblade Mar 23 '22
According to the Spark docs, it runs fine on 11 and I’m fairly sure I ran it on Java 11 at my last company.
151
u/Sand0rf Mar 22 '22
Laughs in Java 8
71
12
u/hippydipster Mar 22 '22
That's right. Tis the time of year to remind management we should prioritize upgrading our Java from java 8 to 9!
2
u/dadmda Mar 22 '22
I know for a fact we are never upgrading from Java 8 where I work, the code base is too big and the investment wouldn’t be worth it
8
u/gizmogwai Mar 23 '22
The investment will always be smaller than the one of a forced rewrite when the time comes. And it will come.
2
4
u/rbygrave Mar 23 '22
For how long is that strategy going to work though? Long enough for path to be a complete re-write?
It seems to me it should not be a case of the size of the code base per say but more if there are dependencies that don't support an upgrade? Dependencies locked into using Unsafe and such? I guess it also could be a case where a regression test is manual - big system -> big manual regression test etc
1
u/orangeandwhite2003 Mar 22 '22
Especially when they keep extending support for 8.
1
u/Sand0rf Mar 24 '22
Yeah, we're running Azul OpenJDK and Java 8 is the version that is supported longest of all, until 2030. https://www.azul.com/products/azul-support-roadmap/
12
3
u/darksmurff Mar 23 '22
I recently had a meeting with a potential client who literally told me there were parts of the code base stuck on an old java version that they planned to never migrate because it was too complex, and instead planned to bring all technical debt with them to the grave. My mouse hovered the "leave meeting" button for the rest of that interview.
3
1
11
u/Fruloops Mar 22 '22
Man I'm just in the process of migrating from 11 to 17 and getting pummeled with errors regarding IllegalAccessOperation because we have lots of reflective operations here and there. Oh the joys of upgrading.
16
u/BlueGoliath Mar 22 '22
Bit of a boring release. Hopefully 19 will be more exciting.
28
u/mauganra_it Mar 22 '22
Deprecating Finalization for Removal and UTF-8 sound pretty important to me. Not the most exciting I admit, but it can always happen with a regular release cadence that some of them are gonna be boring.
5
u/BlueGoliath Mar 22 '22
Sure, I guess, but there isn't anything major that we don't already know about being worked on. You'd think there would be talk about something new being worked on. What is JDK 19 going to be besides Panama previewing and pattern matching?
4
u/mauganra_it Mar 22 '22
It seems a RISC-V port is incoming. And who knows, they might just pull the trigger and land Panama. Or finalize Pattern Matching for switch.
I don't have desire for new stuff yet. Loose ends from Panama, Loom and Valhalla will rain JEP for years to come. Pattern matching or Withers for records would be cool of course.
2
u/Ancient-Career-2915 May 04 '22
Finalization
Any thoughts on how much work it will be to verify the removal of Finalization will be ok before an upgrade?
1
u/mauganra_it May 04 '22 edited May 04 '22
That's the problem with finalization bugs... they are very difficult to find and reproduce.
Finalization can already be turned off with the new VM flag
--finalization=disabled. JEP 421 recommends to profile the application with a realistic test suite to record a performance baseline. This can then be compared with the profiling data from a test run with disabled finalization. The JEP contains more details.Edit: definitely look for finalizers in your own source code already. Even though they might be legacy code, they will likely mean the least amount of trouble to fix since. If you find some in third-party code you are SOL.
1
u/Ancient-Career-2915 May 05 '22 edited May 05 '22
We don't use finalizers ourselves, but any third party library might.
I seem to remember that eg. the gzip stream handler in the jdk used a finalizer as a fallback to release resources?
1
u/mauganra_it May 05 '22
Is this class listed in JEP 421? I can't identify it myself. Some of them were already removed before JDK 18
11
u/GreenToad1 Mar 22 '22
Remember when we hoped for virtual threads to make it as preview in 17? Must say i am a bit disappointed.
14
u/Joram2 Mar 22 '22
Java 18 supposedly has two internal change necessary for Virtual threads, JEP 416 + 418. Here is the Virtual Thread JEP:
https://openjdk.java.net/jeps/8277131
I understand these big features take time. Project Loom does seem to be making progress. But Java 18 isn't interesting by itself.
3
u/dpash Mar 22 '22
virtual threads to make it as preview in 17
That was never going to happen. We've known for three months what was definitely going in or not.
3
u/BlueGoliath Mar 22 '22
Uh yeah, unless they skip steps virtual threads probably won't even be in preview for a few releases.
Panama should have been delivered or in preview by now but they are still putzing around with the API after like 3 years. WTF is going on?
8
u/Joram2 Mar 22 '22
I think Panama is waiting on Valhalla. Valhalla is like the big Java mega-project. It does seem to be making progress. They actually have JEPs you can follow. Project Loom seems actually close to being shipped as a preview at least.
4
7
u/Joram2 Mar 22 '22
Java 18 basically has nothing. It has internal changes and some super small stuff. Java 17 had tons of features. Java 19 probably will have lots of great stuff too so we can't be too disappointed to have one version with very little features.
I'm really hoping they preview either Valhalla stuff or Loom. The Amber syntax stuff is fun, but Valhalla + Loom are are more important big useful changes.
45
u/pron98 Mar 22 '22
Like most releases, JDK 18 improves performance and reduces footprint to save you money when running your applications; free money is not nothing.
13
u/elatllat Mar 22 '22 edited Mar 23 '22
reduces footprint
Thanks, that looks impressive.
I tested on a tomcat app and found 15% reduction in RAM use.
2
u/omegarisen Mar 23 '22
does this mean OCPJP 11 is useless?
3
u/papercrane Mar 23 '22
No. Just means you should be familiar with what's changed since Java 11.
Also, Holy crap it's been awhile, my last Java cert was SCJP 6.
3
u/vegetabluessg Mar 22 '22
Cries in java 7
2
u/acute_elbows Mar 22 '22
Does that get security patches?
2
1
u/viseradius Mar 22 '22
Why am I still learning for java 11?
6
1
0
u/code_rjt Mar 22 '22
This 6 month cadence of releasing Java version makes app modernization more challenging. It's gonna be a long run of upgrades for the enterprise apps I work with 😢
6
u/mauganra_it Mar 23 '22
If you managed to upgrade to Java 17, you already cleared most of the baggage that could cause trouble in the future. Other stuff that will cause trouble from then on are:
Thread.stop()will be axed by Project LoomProject Valhalla will make the constructors of wrapper classes private and will change the semantics of
==regarding themFinalization is deprecated for removal since Java 18
the Applet API and the SecurityManager are deprecated for removal since Java 17
the contents of the
jdk.unsupportedmodule (f.ex.Unsafe) will eventually be made inaccessible
-4
-18
u/ozzymozzy2211 Mar 22 '22
Still using java 8 and happy about it 😇
20
17
u/dpash Mar 22 '22
I wouldn't. Modern versions of Java have lots of small improvements that add up to a much better language. Switch expressions alone are worth the upgrade.
You're also likely to find yourself more and more left behind with libraries requiring modern JDKs.
5
u/ozzymozzy2211 Mar 22 '22
I was happy when I upgraded from 1.6 to 1.8 that's why I am still happy 🤣
0
Mar 22 '22
[deleted]
30
u/dpash Mar 22 '22
Keeping your dependencies up to date frequently massively reduces the pain of updating. I try to do it every fortnight.
3
u/FormatException Mar 23 '22
Im sick and tired of this crap (not knowing what fortnight means)
*looks up definition of fortnight angrily
12
u/agentoutlier Mar 22 '22
Yeah docker and github actions really changed the game.
I remember upgrading Jenkins once and it would not compile stuff because its Maven runner would not work with JDK 7 (and then later on JDK 9 albeit for different reasons ... this was before docker or pipeline groovy). Then having to try to fix it by modifying its not meant to be read by human workspace xml files. So basically at one brief point Jenkins could only compile JDK 8 stuff.
Jenkins has mostly fixed that (e.g. docker runners and config now human readable and checked in... well mostly).... but yeah an upgrade was like.... there goes my weekend.
The irony is none of that had to do with the JDK itself or modules... just other shit.
6
u/dpash Mar 22 '22
Creating docker images for your deliverables instead of a jar/war/ear means the Java version can be under the control of the developers rather than sysadmins. And the Java version is tied to the particular artefact.
4
u/agentoutlier Mar 22 '22
This is a win right? (for us it is)
8
u/dpash Mar 22 '22
Absolutely. When I was a sysadmin 10 years ago, I would have loved using docker to give devs the power to change versions and have a single consistent deployable blob.
Also means the production blob is exactly the same blob that got tested in staging and under CI.
0
8
Mar 22 '22
[removed] — view removed comment
30
u/brunocborges Mar 22 '22
The main question you should answer is: why aren't you moving past Java 8?
2
Mar 22 '22
[removed] — view removed comment
17
u/henk53 Mar 22 '22
Do you do the same with your operating systems? I.e. still on OS X 10.8 or so?
3
9
u/CheesecakeDK Mar 22 '22
Because it still has the longest LTS.
15
u/wildjokers Mar 22 '22
But if you aren't paying for support LTS doesn't matter.
6
Mar 22 '22
Yeah but management and bad developers don't understand this.
Most projects that are actively being developed should be on the release train. But here we are doing things that don't make sense 🤷🏿♂️.
2
u/DasBrain Mar 23 '22
I think this is a problem that will resolve by itself given enough time.
Java has a lot more interesting features now that I don't want to miss - my favorite feature is
record.And given enough time, more developers will find useful features they don't want to miss - so less developer actually want to develop with Java 8.
Which will make it harder to find developers for Java 8.
2
Mar 23 '22
Idk man I have a cowork who is a "senior" who this month wrote new code in Java 8 that used SQL.date and util.date. Alot of people just do this for the check, they don't stay current and will likely not even know the benefits of switching to a newer version. I bet there will be people who are openly hostile to switching.
2
3
u/orangeandwhite2003 Mar 22 '22
It does for security updates. Plus you have the option to pay for support.
6
u/wildjokers Mar 22 '22
If you aren't paying for support you don't get security updates after 6 months. Without support you might possibly get some security updates after 6 months if there happens to be an intersection between the current JDK and LTS release, and the vendor making the patch sends it upstream, and the patch happens to make its way down the updates stream.
If you aren't paying for support the only sure way to make sure you have the most secure JDK is to stay up-to-date with the 6 month release cycle.
3
u/orangeandwhite2003 Mar 22 '22
Yeah I guess they did switch it for 8 a few years ago to require a license for commercial use to get the updates. Of course they did switch it again with 17 so it will be supported for 1 year after the next LTS release without a license.
2
u/HecknChonker Mar 23 '22 edited Mar 23 '22
I don't understand. According to https://adoptium.net/support.html
OpenJDK provide a new feature release every six months, and a maintenance/security update based upon each active release every three months.
and
In addition, every three years one feature release will be designated as a Long Term Supported (LTS) release. We will produce LTS releases for at least four years. This assurance will allow you to stay on a well-defined code stream, and give you time to migrate to the next, new, stable, LTS release when it becomes available.
Where are you seeing security updates being stopping after 6 months? Security updates for java 18 stop in 2022, while security updates for java 1.8 don't stop until 2026.
1
u/wildjokers Mar 23 '22
As I said in my comment:
"Without support you might possibly get some security updates after 6 months if there happens to be an intersection between the current JDK and LTS release, and the vendor making the patch sends it upstream, and the patch happens to make its way down the updates stream."
Although I will add that Oracle is now promising security updates for 1 yr instead of 6 months (I am unsure if other vendors are following suit). That recent change (announced in Oct 2021) wasn't reflected in my comment, so where I said "6 months" pretend like I said "1 year". (see https://www.infoq.com/news/2021/10/oracle-jdk-free-again/)
1
u/HecknChonker Mar 23 '22
Again, I don't see how any of this applies to OpenJDK. I am not paying Oracle for any support, yet I still benefit from multiple years of security updates by sticking to LTS versions.
This means that there is a real momeyary benefit for large organizations to stick with LTS versions because it's much less expensive to update thousands of legacy apps to a new minor version of java with a security fix than it is to update them to a new major version.
1
u/mauganra_it Mar 23 '22
There will be no patches for things that are removed in upstream. For example, after the SecurityManager gets removed, LTS providers will have to write patches for new bugs by themselves. And they might choose to not distribute them for free.
0
8
u/alehel Mar 22 '22
Probably the work involved. We've got 2 people working full time on upgrading to Java 11 for the last couple of months. Still not there.
15
u/dpash Mar 22 '22
I'm guessing that the JDK is not the only thing you're needing to upgrade.
4
u/alehel Mar 22 '22
Good guess
7
u/dpash Mar 22 '22
In my experience, frequent, regular upgrades to dependencies is far less painful than waiting several years. I try to do it every two weeks.
5
u/BCSWowbagger2 Mar 22 '22
But the least painful upgrade schedule is the one my company has adopted: never.
5
u/mauganra_it Mar 22 '22
dun dun dun Log4Shell has entered the chat!!
11
u/BCSWowbagger2 Mar 22 '22
Aha, joke's on you! Our log4j libraries were so old they weren't affected by log4shell!
(More likely our libraries were just too old for anyone to check whether log4shell ran on them, so we still spent a couple weeks diking them all out. Then we patted our Java 8 instances nicely on the head and asked them continue working until the heat death of the universe. That's definitely what "sustaining support" means, right???)
8
u/dpash Mar 22 '22
It might not be painful now, but wait until you get a major security bug in an unsupported library. That's a whole lot of pain in a very short period of time.
10
1
u/rbygrave Mar 23 '22
least painful
I'd say it's more a form of gambling, it's rolling the dice ...
For projects with CI and automated testing, bumping dependencies is low cost. If CI and automated testing is not in place, then maybe it's good to prioritize that effort (and get low cost updates as a side effect) ?
1
u/razsiel Mar 22 '22
In case you (or anyone reading the comments) haven't heard about this: Renovatebot is amazing for maintaining dependency versions. When configured will make automatically and periodically make MR's for dependency upgrades, just approve them (provided CI didn't give issues) and done! Even gives you a handy link to the changelogs/source!
3
5
1
u/tristan97122 Mar 23 '22 edited Mar 23 '22
11 has more or less been the new standard industry-wide for the past 2 years or so (for apps, libraries are still mostly on 8), hopefully moving to 17 within the next year
Companies stuck on 7/8 are the same still running half their stuff on 6 and will start using 11 by the time Java 25 releases. There really isn’t much to do about it besides not working there; if you care about up-to-date anything it won’t be a good culture fit most likely…
1
Mar 23 '22
[removed] — view removed comment
2
u/tristan97122 Mar 23 '22
Most of them are migrating code from old codebases to Java. Future projects might get more recent releases of Java to start with I guess.
I might have agreed about 3-5 years ago, but if you're still on 8 by now, there definitely is something/someone pushing back along the chain of command.
Whether it be something somewhat arguable (lack of time, blocker proprietary lib bought 15 years ago) or straight up poor technical choices (fear of change on ops and/or dev side). 11 has definitely been out for long enough that it's a conscious choice to not upgrade by now.
2
-10
u/RedPill115 Mar 22 '22
1. There's several minor unimportant releases between now and then. Like 9 and 10 were never meant to be used or something.
2. Modules or sometgung after java 8 broke a bunch of stuff.
3. Again, nothing of importance has changed. In fact in a couple ways they made the language worse.
10
u/mauganra_it Mar 22 '22
Modules broke nothing at all and using them is still optional. Java 16 just started to restrict access to things that should never have been accessed directly neither by applications nor by libraries. Things that were always advertised as maintainability hazards and sometimes even have
internalin their package names.-3
u/RedPill115 Mar 22 '22
Modules broke nothing at all and using them is still optional.
And right in the same comment -
Java 16 just started to restrict access to things that should never have been accessed directly neither by applications nor by libraries. Things that were always advertised as maintainability hazards and sometimes even have internal in their package names.
Thes things it broke.
Might it just need updates and fixes for those? Maybe, but it's definitely more work than just throwing in a new jdk and everything works as normal.
1
u/mauganra_it Mar 23 '22
I don't see the contradiction. Modularizing the JDK and encapsulating Java's internals were really separate efforts. The latter even had its own flag to control it:
--illegal-access=<mode>. Note that some APIs likesun.misc.Unsafeare still not encapsulated.Oracle could also just have changed the names of all internal packages, but that obviously would not have been a permanent solution.
3
u/RedPill115 Mar 23 '22
What I know is that people that tried to upgrade often found things blew up on them and stopped working. A lot of the stuff that stopped working hasn't had anyone working on it in years.
Sometimes it works to just replace some libraries, sometimes it doesn't, but it's definitely more work than previous releases that were usually just update the jdk and things worked the same.
2
100
u/TehBrian Mar 22 '22
Dang, already? Well, that felt fast. I’m not complaining, though; I much prefer the consistent release schedule over one version once in a blue moon. Excited to try out the new features, and UTF-8 by default is a nice bonus too :-)