News for hackers. Stuff that matters.
Re:JDK 15 by geerlingguy on Tuesday September 15, 2020 @11:27AM (#24482321)
/me nervously glances at all the production infrastructure I manage that's still on JDK 7 or 8.

I've just recently been able to upgrade some things to JDK 11.

Re:JDK 15 by elric on Tuesday September 15, 2020 @11:31AM (#24482381)
JDK 11 is the current LTS version, so that's probably fine. With 2 releases per year, it's hard to follow the bleeding edge. Especially if you have to ship stuff to clients.
Re:JDK 15 by Freak_NL on Tuesday September 15, 2020 @12:10PM (#24482932)
Yeah, this seems to be par for the field. Java 11 is what you should be targetting now. We're in the middle of the 8 to 11 migration as well.

I got the impression (but please correct me if I'm wrong) that only this year most major libraries got all the kinks worked out for Java 11. In particular, when using them together.

Guice is one that only recently got the nasty (but relatively harmless) warning you get when using it with Java 11 under control.

Java 17 is the next long term support release, so most of us working on longer lived code bases will probably skip all the releases in between. It doesn't seem worth the effort, because if the Java 9 and 10 experience is anything to go by, you will be hunting down issues with Maven plugins, transitive dependencies, and libraries holding back for now all day.

Re:JDK 15 by krzyk on Wednesday September 16, 2020 @02:16AM (#24490032)
> [...] if the Java 9 and 10 experience is anything to go by, you will be hunting down issues with Maven plugins, transitive dependencies, and libraries holding back for now all day.

You had issues with 10? The only issues I got were with Java 9, because introduction of modules broke some stuff. Later it was just making sure that ASM or aspectj/lombok is in the most recent version that has new JDK version added, which might have been a problem in 10 (I know I was trying to upgrade on day 1).

But nowadays, all the most popular libraries are on par with the next Java version that is in the works at least a month before the release.

Since JDK 12, I just do an upgrade every 6 months and had no issues so far.

And if you don't ship software to clients then there is almost no downsides to upgrading and a lot of upsides.

If you do ship software to clients you should be using jlink, this way you ship smaller binaries and clients don't need to worry about JDK, because you will provide it to them .

And you also need to lookup what LTS means in case of Java - it is not the same as in e.g. Ubuntu.

In Ubuntu you get free of charge fixes in LTS, in Java you need to buy an LTS version from someone (they will make fixes there) OR use the latest JDK version (which gets all the fixes free of charge).

Re:JDK 15 by vips7L on Tuesday September 15, 2020 @04:57PM (#24486611)
> Guice is one that only recently got the nasty (but relatively harmless) warning you get when using it with Java 11 under control.

Personally I've dropped guice and just stick to Weld anymore since it's the reference implementation of the standard. I haven't had any problems running it on JDK 14.

Re:JDK 15 by pron on Tuesday September 15, 2020 @04:16PM (#24486234)
It's not hard because the changes are small and gradual, and you have to update your JDK every quarter anyway -- whether you use the current version or an old one -- just to get the security patches. It's just a matter of how that work is spread. It's likely that updating once every 3 years is more work overall. Plus, you've done that already back when there were still major releases, and the semi-annual feature releases didn't get a new integer number (8u20, 8u40 etc. were big feature releases).

Plus, keep in mind that LTS is a paid service. What appears to be "free LTS" isn't really LTS, but builds of the OpenJDK Updates projects. Those builds serve as the basis for various paid LTS offerings, but in themselves they don't actually maintain the full JDK. OpenJDK Updates just backports stuff from the mainline version. If you're using a component that's been removed from the mainline -- and you probably do or else you'd upgrade -- then that component is not maintained in OpenJDK Updates (so-called "free LTS") because there's nothing to backport from.

The only version that's 100% maintained for free is the current JDK (15 as of today).

Re:JDK 15 by elric on Wednesday September 16, 2020 @04:54AM (#24490809)
> It's not hard because the changes are small and gradual

Size isn't the only issue. Version number of fetishism is very much a thing in large companies. Megacorps and banks are very slow to update. I can't tell my customers to switch to Java 15 tomorrow (or even next year). Especially after the complexity of upgrades to 9 and 11, both of which broke things in many subtle ways. This may not be an issue for many applications, but it was certainly an issue for us and our customers.

Re:JDK 15 by pron on Wednesday September 16, 2020 @05:00AM (#24490848)
9 was the last major release ever, and it was a big one at that (bigger than 8). And since most people skipped both 9 and 10, there was even more work. If you use the current version, all that will never ever be necessary again. If you don't, this will happen over and over, and worse: because OpenJDK's development ignores vendor's LTS services, things can disappear between one of the versions with LTS and another without warning. Because your customers don't educate themselves they're condemning themselves to an eternity of pain (paid support, higher upgrade effort, more hardware) when salvation is already here (free support [1], lower overall upgrade effort than ever in Java's history, plus always enjoying the hardware savings).

I admit that doing away with major releases, giving the feature releases new version names, and the last ever major release was too much all at the same time and is confusing. But the payoff in learning what actually happened is big, as is the loss in not. Your customers might be losing both time-to-market and serious money for a lack of a day's worth of education. They can start here: https://blogs.oracle.com/java-platform-group/update-and-faq-...

[1]: The only version for which you get free support from anyone is the current version. No one offers free LTS for old versions. https://news.ycombinator.com/item?id=24487298

Re:JDK 15 by Yeroc on Tuesday September 15, 2020 @05:29PM (#24486923)
That's not true unless you mean "free LTS" JDK from Oracle. There are several other projects providing free LTS, TCK-certified builds including: RedHat OpenJDK & Amazon Corretto to name two off the top of my head.
Re:JDK 15 by pron on Tuesday September 15, 2020 @06:07PM (#24487298)
No one offers free LTS (or, rather, what you call "free LTS" is very different from a real LTS service, which is always paid, and you might not be getting what you think you are). The "LTS release" you get for free are builds of OpenJDK Updates. Try to open an issue on, say, Nashorn against a "free" LTS 11 and see if it gets addressed. It won't be -- unless you actually pay for a real LTS -- because Nashorn has been removed from the mainline and there's nothing to backport. Same for CMS or any other package or component that's been removed.

If you're using one of those "free LTS" distributions you should know that you're using a JDK that's not fully maintained. The only JDK version that's fully maintained completely free is the current version. To be fully safe and run maintained software you can either use the current version for free or use an old version and pay someone for LTS.

Maintaining a JDK is a lot of work. There are a couple of hundred full-time developers working on OpenJDK tip and maintaining the current release; there are ~10 full-time engineers (probably less) from all companies combined maintaining both OpenJDK 8u and 11u. For real support for an old version you must pay.

(I work on OpenJDK at Oracle)

Re:JDK 15 by magicpointer on Wednesday September 16, 2020 @12:12PM (#24494039)
This situation is still a bit hard to understand for me as a simple Java dev. Until now I thought that there were 3 kinds of "LTS":

1) OpenJDK Updates binary builds: they take the source code of the project, build it, and provide binaries. Examples I know are AdoptOpenJDK and the free Azul OpenJDK distribution.

2) Open source LTS: they take the OpenJDK Updates project, then add bugfixes they did for their PAYING customers. They publish the source code of the result. Here I see RedHat OpenJDK (such as the OpenJDK 8/11 builds distributed with RHEL 7/8). Those are then made available for free in binary form as well, such as part of CentOS. If you want a big fixed in those versions you have to pay, but you can benefit from bug fixes made for others. "LTS" here means as long as the RHEL version lives.

3) Paid LTS with custom support. Those do the same as 2, but don't release the source or binaries to the public, only to paid customers. Maybe there are even custom builds for specific customers. That would be Oracle mainly, and Azul and IBM as well.

What's unclear to me is if fixes from 2 flow into 1. Also, I don't know which kind Coretto is (Probably 1).

Is that a correct assessment of the situation?

Re:JDK 15 by pron on Wednesday September 16, 2020 @05:13PM (#24497995)
Almost, although I have to say you know much more than most. Because OpenJDK itself is open-source, all versions are open, except for Oracle's for its paying customers, because Oracle, as the main developer of OpenJDK, owns the source code.

There are other differences, too. Adopt, made by a particularly amateurish team at IBM that is barely involved with the OpenJDK project and quite unfamiliar with its workings, isn't a member of the vulnerabilities team and so gets access to security fixes later than all other vendors (and that's not the only thing that makes their build more problematic than all others). Among those that do participate in OpenJDK to varying degrees, including Amazon, there are differences in how much of the changes to their branded forks they upstream to OpenJDK Updates (RH upstreams more; Azul less).

Anyway, the important thing to know is that there is only one version that is fully supported for free -- the current one, and so the safe choices are either some paid LTS or the current version.

Re:JDK 15 by fomine3 on Thursday September 17, 2020 @08:50PM (#24511795)
Maybe you should call not LTS but "Oracle's LTS" ? OpenJDK is open so any company should be able to provide own "LTS" but it's differ from Oracle's LTS and you argue that Oracle's LTS is superior than others. (I agree Oracle has great resource to maintain LTS and still manages CVEs)

> Anyway, the important thing to know is that there is only one version that is fully supported for free -- the current one, and so the safe choices are either some paid LTS or the current version.

It looks like overstatement for me but reasonable perspective for Oracle employee.

Re:JDK 15 by pron on Thursday September 17, 2020 @09:03PM (#24511866)
What I'm saying is that you can buy LTS from Oracle, Red Hat, Bellsoft, or Azul -- that's how all of them make their money off of OpenJDK -- but not a single one of them offers it for free (and neither does Amazon, whose JDK staff is smaller than or similar to Bellsoft's).
Re:JDK 15 by koreth1 on Tuesday September 15, 2020 @06:42PM (#24487588)
While it's definitely important to be aware of what exactly you're getting for your non-money from different JVM vendors, I think that point of view underestimates how many people use LTS versions purely to tick a "we are using supported software versions" box in their corporate bureaucracy's paperwork, and never intend to actually ask for any support at all.
Re:JDK 15 by pron on Tuesday September 15, 2020 @07:55PM (#24488072)
The question is what level of maintenance is required to call something "supported." But yes, there is some maintenance done for free on old versions of the JDK in OpenJDK Updates in the form of backports.

The thing is that the money saved in hardware/hosting by running the current version would more than pay for any update costs. By using the current version, companies will be using better maintained software and paying less money for it. Those "free LTS" builds, which aren't really LTS, is a mind game that keeps companies on old versions that cost more money to run in the hopes that people will ultimately pay for real maintenance, perhaps once they fall behind too far.

Re:JDK 15 by techdevangelist on Tuesday September 15, 2020 @11:46AM (#24482588)
Lucky! We still have a mix of 1.6, 1.7, and 1.8; our recent big upgrade came from moving a few apps from 1.6 to 1.8... we’ll get to this jdk in about 15 years.
Re:JDK 15 by skrebbel on Tuesday September 15, 2020 @12:20PM (#24483053)
I'm clearly missing something, but why is this so hard? I thought Java made a point of being fully backward compatible, both at the source level and the binary level (.class/.jar)? Is that true? If so, why is upgrading to a later jdk more work than, well, installing the newer version?
Re:JDK 15 by sgift on Tuesday September 15, 2020 @12:27PM (#24483149)
Between JDK8 and 9 there was the introduction of the module system, which broke many systems, cause they did somethings they weren't allowed to do in the first place (and which wasn't included in the backwards compatibility guarantees): Access internal JDK classes. There were some compromises to make it still work (e.g. they continued to allow access to some parts of sun.misc.unsafe until there's a replacement with the same performance, cause most of the things in there are pretty fast), but some things just didn't work with the module system and had to be changed.

By now, I'd say if you depend on a library that still doesn't work on JDK9+ you should replace it, but depending on your requirements that may not be so easy and so some people are still stuck on JDK8.

Re:JDK 15 by tandr on Tuesday September 15, 2020 @12:31PM (#24483190)
(not gp) It is about stability, and that magical ephemeral "Something". In software, like JDK or OS, "Something" does change all the time with bug fixes and maybe even just a different builds. Jump from 8 to 11 has a lot of Somethings changed, and transition is not always painless.

I have tests that use JSON serialization and deserialization (and then some), and they pass perfectly fine on Java 8 runtime, but fail in exactly same place on Java 11, without recompilation. I have spent some non-zero time trying to get to the bottom, but so far without much luck.

Re:JDK 15 by correct_horse on Tuesday September 15, 2020 @12:58PM (#24483545)
gson uses reflection to serialize types, including standard library types, which are not guaranteed to have the same fields from one release to another. Presumably the people who write the jdk realized this potential source of bugs and tried to prevent it from happening, meaning fewer ambiguities about what changes are breaking at the expense of breaking gson (and probably others). see: https://github.com/google/gson/issues/1216
Re:JDK 15 by koreth1 on Tuesday September 15, 2020 @06:47PM (#24487618)
Java is better about this than most languages but they still break things sometimes.

For example, in addition to the module system, Java 9 changed the implementation of some of its XML rendering libraries and caused meaningful behavior changes.

https://github.com/CodeFX-org/java-9-wtf has a list of some of the stuff that broke.

That said, 8 -> 9 was the only really painful transition in my experience. Since then the upgrades have been smoother.

Re:JDK 15 by pvg on Tuesday September 15, 2020 @12:35PM (#24483239)
It's true for the most part, ideally and on average, even between major JDK versions. But there are zillions of production setups out there which are not ideal or average and in turn are made up of not-entirely-ideal or not-entirely-average other software which itself has to go through and verify the upgrade is sane, etc, recursively. Add things like support relationships to all of this and pretty soon you're looking at real work.
Re:JDK 15 by djsumdog on Tuesday September 15, 2020 @12:40PM (#24483287)
Starting with 9 we saw a lot of functions depreciated for a decade finally removed and other breaking comparability changes. Moving up the Java version system is finally going to stop dependency rot, but there is a lot of old stuff out there, with old dependencies. This might be a Python2/3 moment for Java.
Re:JDK 15 by cesarb on Tuesday September 15, 2020 @02:32PM (#24484906)
A lot (more than you'd expect) of Java projects and libraries depend, directly or indirectly, on the ASM library (https://en.wikipedia.org/wiki/ObjectWeb_ASM), often including a built-in renamed copy. Newer versions of Java add new functionality on the bytecode generated by the Java compiler (in a backwards compatible way, that is, newer versions of Java can fully read bytecode generated by older versions of the Java compiler), and the ASM library has to be updated to understand that new functionality. The Java bytecode verifier has also become more strict, rejecting bytecode generated by older versions of the ASM library and other bytecode generators (things like the "Illegal type in constant pool" error).

And in the particular case of Java 9, they decided to deprecate several things, and quickly removed them in Java 11 (that is: with less than a year warning, and no warning if you follow only the long-term versions). That includes a lot of J2EE classes which previously came with the JRE, and now became external dependencies (with the most recent version of these external dependencies sometimes having slightly different behavior).

Re:JDK 15 by johnc1231 on Tuesday September 15, 2020 @12:57PM (#24483533)
Having Apache Spark as a dependency kept us locked into JDK 8 for ages. They've finally got things updated now, but I don't know what their hold up was.
Re:JDK 15 by cmckn on Tuesday September 15, 2020 @01:08PM (#24483669)
Same here, though it doesn't seem like they've upgraded fully. The Dockerfile[0] for their Kubernetes base images are pinned at 1.8, for example. I bit the bullet and built Spark against newer JDK's myself in the last couple years, but look forward to ditching that.

The Hadoop ecosystem has definitely been dragging its feet on JDK bumps.

[0] https://github.com/apache/spark/blob/master/resource-manager...

Re:JDK 15 by pixl97 on Tuesday September 15, 2020 @12:39PM (#24483280)
>I thought Java made a point of being fully backward compatible

In theory yes.

In practice the plugin and scanning systems the software I use has had a multitude of failures between JDK8 and 11.

Re:JDK 15 by Semaphor on Tuesday September 15, 2020 @12:31PM (#24483187)
There are at least some versions that aren’t binary compatible. Because of that we have one system stuck on JDK 7 :/
Re:JDK 15 by dariusj18 on Tuesday September 15, 2020 @12:41PM (#24483314)
Lots of garbage collection changes and jvm flag changes that are not compatible too.
Re:JDK 15 by Marazan on Tuesday September 15, 2020 @12:23PM (#24483100)
How Java counts CPUs in a Docker like world has changed multiple times since JDK8.

That might not sound too important but it has an effect on GC chosen amd obviously how you might have tuned your thread pools.

Re:JDK 15 by krzyk on Wednesday September 16, 2020 @02:11AM (#24490008)
The things you migrated to JDK 11, can be easily migrated to JDK 15 (or at least 14, if you have some libs depending on Nashorn), the biggest issue with migration was JDK 9 (because of the modules), so if you are past that then it is a breeze.
Re:JDK 15 by watt on Tuesday September 15, 2020 @11:31AM (#24482377)
Not to worry: next LTS release will be Java 17, scheduled for September 2021 - next year.
Re:JDK 15 by krzyk on Wednesday September 16, 2020 @02:25AM (#24490073)
And you know that LTS in case of Java is meaningless if you don't have a support bundle bought for real money?

The only free of charge LTS is the latest java version, all versions n-1, n-2 are out of free support, you can only buy one.