News for hackers. Stuff that matters.
Re:Java 20 Is Out! by FalconSensei on Tuesday March 21, 2023 @12:20PM (#35248388)
And here I am still on Java 8 :/
Re:Java 20 Is Out! by taftster on Tuesday March 21, 2023 @12:39PM (#35248696)
I mean, that's OK though. Not sure why this is considered such a bad thing. You're missing out on some new language features, sure, but Java 8 is still reliable and rock solid. There's lots of companies that have hesitation or even inability to upgrade, hopefully there's at least some initiative and/or direction to do so.

A company that is head-in-sand deliberately not upgrading from Java 8 is one thing. A company that is just being conservative and intentional about the upgrade path, that's another entirely different thing.

I don't mind a company that has using Java so much that it's just a slow process to getting on the next thing, hopefully it happens for you soon.

Re:Java 20 Is Out! by logistark on Tuesday March 21, 2023 @12:51PM (#35248918)
I think that the main problem upgrading beyond Java 8 is Java 9 and module system and a lot of javax package classes that were removed. It will be very helpful a tool that can detect what modules or classes that are being used by your codebase and add them as maven or gradle dependencies and add them to the classpath.
Re:Java 20 Is Out! by rerdavies on Tuesday March 21, 2023 @01:11PM (#35249214)
The main problem with upgrading beyond Java 8 is that it's Android! And we all know how THAT went.
Re:Java 20 Is Out! by FalconSensei on Tuesday March 21, 2023 @12:57PM (#35249012)
> I mean, that's OK though. Not sure why this is considered such a bad thing

For existing software, sure. But the problem I guess is when there are a lot of newer projects starting and everyone is stuck on the older version

Re:Java 20 Is Out! by taftster on Tuesday March 21, 2023 @01:28PM (#35249462)
Totally fair. I guess I would hope in that case that the new effort would target a modern Java release, preferably Java 17 or greater. If a company is sticking with Java 8 for new initiatives, yeah, they probably have a culture problem and are not going to be happy with that decision.
Re:Java 20 Is Out! by paulmd on Tuesday March 21, 2023 @01:19PM (#35249348)
There's very little reason not to upgrade from Java 8 at this point. Everything should be a drop-in replacement and there are significant performance benefits (garbage collection is leagues better) to doing so.

The bigger problem is that a lot of places are stuck on Oracle JDK - 8u252 is the last free version so a lot of places just decided they'd never upgrade, nor do they want to look at whether Temurin or Coretto would work for them (the answer is usually yes).

Re:Java 20 Is Out! by taftster on Tuesday March 21, 2023 @01:37PM (#35249603)
Almost. The Java module system (introduced in Java 9 and enforced in Java 11) still plagues companies and/or slow-to-update libraries. Particularly companies that have written a lot of their own in-house libraries and such.

Custom libraries have, unfortunately over the years, picked up the bad habits (by forking/following public libraries) relying on reflection and packages that shouldn't be directly used (sun.* packages, etc.). So companies are wedged in because they made the poor decision to rely on private packages. And now, Java 11+ enforces this by default.

There are open source Java libraries today that don't run unless you "add-exports" to basically everything. google-java-format comes to mind, because it's using an internal java code parser from the JDK, for example.

Re:Java 20 Is Out! by dtech on Tuesday March 21, 2023 @01:51PM (#35249802)
In the latest LTS those all can still be enabled, so while it is a serious problem when they are finally removed, for now it's not really a good reason to block an upgrade.
Re:Java 20 Is Out! by taftster on Tuesday March 21, 2023 @02:34PM (#35250470)
I think that's fair. Yes, there is an escape hatch currently available. But what is hard is knowing if your application is relying on any internal/private behavior that it shouldn't. Since the dependency hierarchy of most Java projects is very deep, it's hard to know if any dependencies of A -> B -> C -> D are going to call into restricted areas. You might not even know you have a problem until runtime, because you've --add-exports everything and now you have a stacktrace to try and deal with in production.

But yes, maybe not a good reason to completely block an upgrade. It's just postponing the pain, though.

Re:Java 20 Is Out! by TacoSteemers on Tuesday March 21, 2023 @01:32PM (#35249514)
> Everything should be a drop-in replacement

It isn't at all, in my opinion. Consider the introduction of the module system, for example.

Some libraries moved out of the core language.

Re:Java 20 Is Out! by awelxtr on Tuesday March 21, 2023 @02:28PM (#35250376)
Isn't 202 the last version?
Re:Java 20 Is Out! by agilob on Tuesday March 21, 2023 @02:43PM (#35250605)
Except 9, 11, 14 and 16 where breaking backwards incompatible changes were introduced? And then the talk of changes in libraries, remapping imports from JEE to Jakarta... that's a long, long way in Java.
Re:Java 20 Is Out! by 66fm472tjy7 on Tuesday March 21, 2023 @02:54PM (#35250786)
> Everything should be a drop-in replacement

This is not true for many applications. Due to the removal of many APIs from the JDK with Java 9, I needed the following dependency artifactIds to be able to move a JEE application with SOAP web services to Java 11: jaxb-api, jaxb-core, jaxb-runtime, istack-commons-runtime, jboss-jaxws-api_2.2_spec, glassfish-corba-omgapi, jboss-annotations-api_1.2_spec, activation, jboss-saaj-api_1.3_spec, saaj-impl, stax-ex, jsr181-api, txw2.

Many of these spec API/implementations are provided by different artifacts that are incompatible with each other. Some I only discovered when something failed at runtime as they perform implementation lookups and you don't get compile errors.

Additionally, many of the Maven plugins we used no longer worked and our application server failed to start.

Re:Java 20 Is Out! by twic on Tuesday March 21, 2023 @08:48PM (#35255116)
Are you really actually using CORBA? That would be heartwarming if so. Maybe just RMI over IIOP?
Re:Java 20 Is Out! by 66fm472tjy7 on Wednesday March 22, 2023 @02:39AM (#35257583)
It's far less exciting I'm afraid: we use [0] to generate our DB IDs and it implements org.omg.CORBA.portable.IDLEntity.

We could fork it and remove the interface or switch to ULID[1] instead.

[0] https://github.com/stephenc/eaio-uuid/blob/master/src/main/j...

[1] https://github.com/ulid/spec

Re:Java 20 Is Out! by twic on Wednesday March 22, 2023 @09:31AM (#35260732)
Shame :(

Given that interface is trivial, you could also just define it in your codebase. I've done that a few times for shimming small bits of log4j and Spring that some library uses, when i would rather not have those as a dependency.

Re:Java 20 Is Out! by rafaelturk on Tuesday March 21, 2023 @12:36PM (#35248656)
Impressive how many companies are stuck on quite old java versions. We are a core API for payments services, and we need to force our customers to upgrade to newer Java versions as most of them don't support newer encriptyion protocols
Re:Java 20 Is Out! by oaiey on Tuesday March 21, 2023 @12:55PM (#35248982)
Thank You for your service.
Re:Java 20 Is Out! by 0xDEF on Tuesday March 21, 2023 @12:46PM (#35248840)
It's interesting how the introduction of "modules" has forced so many to stick with C++17 and Java 8.
Re:Java 20 Is Out! by Longhanks on Tuesday March 21, 2023 @01:00PM (#35249065)
C++ has barely any feature complete compiler implementations and build systems aren’t ready for all of its additions, either (CMake and modules in particular). libstdc++ and libc++, gcc and clang are all not ready for production use or rather untested and/or buggy.

Unless you’re targeting MSBuild Visual Studio Solutions and Windows only, C++17 is currently the most up to date, stable, and battle-proven version.

Re:Java 20 Is Out! by acuozzo on Tuesday March 21, 2023 @01:32PM (#35249522)
It's a shame "C with classes", as C++ originally was, didn't stick around for parallel development.

I work with C daily and I'm well aware of its many shortcomings (e.g. its huge list of undefined behavior and its PDP11-centric view of modern architectures), but with some effort I believe it could function as a semi-portable second-level intermediate representation. Nim uses it as such, IIRC.

Compiling to C first would introduce some of its own issues, for sure, but I imagine doing so would alleviate the pressure the C++ standards committee puts on compiler vendors each time they expand the size of the kitchen sink.

Re:Java 20 Is Out! by soulbadguy on Tuesday March 21, 2023 @02:54PM (#35250790)
Rust ?
Re:Java 20 Is Out! by acuozzo on Tuesday March 21, 2023 @05:35PM (#35252904)
Rust compiles to C and then passes that C to a C compiler to generate machine code?
Re:Java 20 Is Out! by ghostwriter on Tuesday March 21, 2023 @05:28PM (#35252834)
> gcc and clang are all not ready for production use or rather untested and/or buggy.

Which items from this table are lying about GCC v11 support of C++20? [1] Which of the features are buggy in GCC v11-12?

[1] https://en.cppreference.com/w/cpp/compiler_support#cpp20

Re:Java 20 Is Out! by TheRealPomax on Tuesday March 21, 2023 @01:27PM (#35249448)
Perfectly fine for already written codebases or codebases that need to target hardware that's stuck in the past?

Just don't use it for new projects on modern hardware. Be on at least the current LTS version for that and enjoy a much more expressive language on a much better JVM.

Re:Java 20 Is Out! by SPBS on Tuesday March 21, 2023 @01:33PM (#35249531)
My codebase at work is written in Java 8, I honestly don't see what other benefits upgrading the language would bring. There's already so much code written in the old Java 8 style (which works), don't go trying to change how the code is written now. To me Java 8 is simple and boring like Go, with some imperfections like the lack of a native map data type.

I'd still upgrade for the new VM's better performance/security patches or whatever, but I don't need any language changes.

Re:Java 20 Is Out! by spacephysics on Tuesday March 21, 2023 @01:38PM (#35249621)
Big reason is security patches. But if the services are running in a VPN and don’t interact with outside world, it’s fine
Re:Java 20 Is Out! by keester on Tuesday March 21, 2023 @01:52PM (#35249817)
My understanding is that jdk8 has support from Oracle until 2030.
Re:Java 20 Is Out! by kaba0 on Tuesday March 21, 2023 @02:34PM (#35250460)
paid support. I’m not convinced that most of those companies that use older versions even know where their JDK comes from.
Re:Java 20 Is Out! by riku_iki on Tuesday March 21, 2023 @01:44PM (#35249708)
We migrated our codebase because multi line string literals somewhere in jdk14 made writing large SQL queries in java code so much easier.
Re:Java 20 Is Out! by dtech on Tuesday March 21, 2023 @01:47PM (#35249747)
I unfortunately encounter this mindset so much in Java programmers, and the similar "we don't need no feature X" even if the feature has proven themselves for a long time in a large amount of languages. I'm hesitant to bring it up, but I see a lot of Blub Paradox [1] among Java programmers. Heck, a lot of places disallow `var`, while over here in Kotlin-Python-Rust-C#-Typescript-Go-etc-land that's been the default since forever.

Taking this comment in good faith, the following language features from 9+ are incredibly useful for everyday programmers, you should give them a serious try before dismissing them:

- `var` local type inference

- record classes

- text blocks

- switch expressions

- sealed classes and interfaces

[1] http://paulgraham.com/avg.html

Re:Java 20 Is Out! by bcrosby95 on Tuesday March 21, 2023 @02:32PM (#35250431)
Var is nice. But I generally prefer to not require people to jump out of the current code to figure out the type of a variable. And yeah, I've worked in those other languages, and navigating unfamiliar code with var everywhere can be confusing, so I try to avoid that kinda thing.

Records are nearly useless to me. Immutability is great, but I need a way to derive new sets of information based upon an set of information. And the only way to do that is bug prone.

Text blocks are nice for writing SQL queries and other multi-line things. But I'm not sure how often I actually use it.

Switch expressions are nice because it gets me compile time checking for things I would previously use a runtime check for. Other than that, as they currently exist, they're meh.

Sealed classes are something I've not had a use for. Maybe libraries will eventually make good use of them.

So I would say there's some nice QOL things in here. But I think "incredibly useful" is overselling it.

The thing is, lots of these things are built to support a longer term roadmap towards better support for data oriented programming. I think that is a worthwhile goal to drive for - and the sum of the parts (many of which are still in preview) will be less than the whole together - but we don't have the whole, yet. That, to me, would pass the "incredibly useful" bar.

Re:Java 20 Is Out! by joaonmatos on Tuesday March 21, 2023 @03:53PM (#35251612)
`var` in Java is local for a reason. In most contexts I can think of the variable either was created above or was passed in as a parameter/object field. Unless you set it from a weirdly named creation pattern/function.

Regarding records, you never had someone update a POJO, add a field, and forget to update equals and hashCode?

Sealed classes are great for everything parsing/validation, in data modelling. They're not a solution for behavior polimorphism, but I don't think they were supposed to.

Re:Java 20 Is Out! by awelxtr on Tuesday March 21, 2023 @02:27PM (#35250364)
My main dependency only supports jdk 8 soooo...
Re:Java 20 Is Out! by therealdrag0 on Tuesday March 21, 2023 @02:41PM (#35250576)
People think boring is good but it’s not. Simplicity is good. Boring is just what you’re familiar with.

New features done right improve simplicity by abstracting away complexity or need to reinvent the wheel. For example Go devs having wrote their own list .map() functions is absurd.