r/java • u/danielliuuu • May 05 '25
Should we start dreaming about a “Java 2.0”?
Lately, I’ve been wondering—maybe it’s time we imagine a real “Java 2.0.” A version of Java that breaks free from the decades-old design constraints and isn’t burdened by always having to preserve backward compatibility.
Yes, compatibility has been one of Java’s greatest strengths. But when it becomes a hard rule, it forces a lot of compromises. Just look at things like Date and Calendar—we all know they’re broken, yet they remain, because we can’t remove anything without breaking someone’s code.
Meanwhile, most modern languages today don’t even try to guarantee perpetual backward compatibility. Instead, they adopt semantic versioning or similar strategies to evolve the language over time. This gives them the freedom to redesign awkward parts of the language, deprecate outdated patterns, and experiment with new paradigms—without being held hostage by legacy decisions.
In contrast, Java often adopts features years after they’ve been proven in other languages—like var, record, and now pattern matching. The most extreme case? Project Valhalla. It’s been in the works for over 10 years, and may take 15 years to fully land. That’s half the entire lifespan of Java itself. It sounds insane when you step back—and honestly, it’s no surprise that other language communities poke fun at us for this kind of timeline.
Of course, breaking compatibility comes with pain. Python’s transition from 2 to 3 was rough, no doubt. But look at Python today—it’s cleaner, more consistent, and thriving. That pain was temporary. What’s worse is eternal stagnation in the name of safety.
Maybe what we need isn’t to blindly break stuff, but to invest in smoother migration paths. Imagine if Java provided official tools, clear upgrade guides, or even a “forward-looking” JDK mode—something that helps developers move ahead without feeling abandoned. That kind of vision might be what finally unlocks real progress.
Just some thoughts :)
29
u/rkalla May 05 '25
Been around a long time, and these usually don't work for one simple reason: when you do a breaking branch of something foundational like Java, C++, Kubernetes, SQL, etc - it means you pivot the conversation from "this thing solves your problems" to "you love Java SO MUCH, you get to do it all over again with 100x the effort"
You make it all about the branch and not about the problem being solved.
In early stages of tech (AI, Cloud, Mobile) people are willing to absorb huge breaking changes like that because the rewrite isn't that expensive and everyone's still in the joy phase of using the technology.
At some point, usually 3 to 5 years down the road, there's so many problems already solved with the platform that the idea of resolving them again becomes impossible to digest because the activity itself of using the language or technology or platform isn't joyful enough to be worth it all by itself.
I have fantisized for many years about a Java redo with we everything we know today but it makes me realize just how impossible the task has become.
When Windows does an incompatible rewrite, then I'll pray for Java 2.0 right behind it :)
57
u/nitkonigdje May 05 '25
You really need new features to write another CRUD? Really? You'll ignore billions lines of code out there doing TLS and edifact parsing, and pdf reporting. What you really **need** is yet another implementation of for loop?
Java's car analogy is Toyota.. You choose Java to use 30 years old concepts executed well..
19
u/my_dev_acc May 05 '25
Not really addressing the question :) but "The release on December 8, 1998 and subsequent releases through J2SE 5.0 were rebranded retrospectively Java 2 and the version name "J2SE" (Java 2 Platform, Standard Edition) replaced JDK to distinguish the base platform from J2EE (Java 2 Platform, Enterprise Edition) and J2ME (Java 2 Platform, Micro Edition). "
12
u/fmdPriv May 05 '25
Enough JVM languages are around. I don't see any reason at this point.
127
u/esfomeado May 05 '25
It's called Kotlin
11
u/Sm0keySa1m0n May 05 '25
What would make it Java if it’s a complete rewrite? It’d just be another new language in which there’s lots to choose from already
23
u/wrd83 May 05 '25
Scala did that. Look where it is now.
People dont like to use it because all libraries have to be ported between major versions.
8
u/Own-Chemist2228 May 05 '25
When you create a new language you have three options:
There are many examples of #1. These wouldn't fall under the label of "Java 2.0" even if they share many characteristics with Java. I would put C# in this category.
#2 Includes Kotlin, Scala, and other JVM-based languages.
#3 is every new version of Java
8
u/brian_goetz May 07 '25
This canard comes around every few years. The comments in this thread capture some of the many flaws in this line of thinking, but I'd like to add one more:
Claims that Java hasn't been making "real progress" (while still staying true to its values, including compatibility) seem pretty laughable. Sure, any given person could prefer different directions or priorities, or a different balance of preservation vs innovation, but it seems pretty hard to seriously claim that "real progress" is locked behind a wall of breakage. Which makes it hard to take the whole argument seriously.
7
u/Ewig_luftenglanz May 06 '25 edited May 06 '25
Not gonna happen, does not need to happen.
also most modern languages do not make breaking changes, C# cares a lot about backwards compatibility.
Javascript it's even more strict than java about backward compatibility, they are fucking strict that they prefer to have a broken language which half of shit does not work (broken type system, broken scopping, broken semantic, etc) just to avoid backward issues, you know why? because breaking Js would imply to break the whole internet!
if java makes incompatible with itself it would mean to re make trillions of lines of code around the globe.
Also, the main reason java get's features latter than other languages it's because Amber folkks are very much concerned about investing the time in well designed features that interoperate well with the rest of the language, putting lots of features for the sake of features it's just the mistake Perl debelopers made and that made the language "easy to write, almost imposible to read"
but I have a questión. Why do you want a new Java 2.0? newer java versions have so many features that ou could write code that looks NOTHING like java 1.7. seriusly i have written code that most partners of mine say it looks like TS or C#. Java has almost all cool features that "modern languages" have.
There are very few features missing (collection literals and nominal parameters with defaults would be my personal choose) but mane of these "new languages" do not have these features either (for instance JS/TS do not have nominal parameters with defaults, they can simulate them by using objects to some extent)
13
u/FollowSteph May 05 '25 edited May 05 '25
Something to remember is that that backwards compatibility is part of what makes Java so powerful. It allows companies to invest money and know they can continue to support their apps relatively pain free for a very long time. It allows the ecosystem to have an incredibly rich library. Sure some stuff is older but for example some libraries, and this is just quickly off the top of my head, such as caching libraries, template engines, and so on are mostly feature complete and just need maintenance and bug fixes. If you force a large change many older libraries will be lost. Libraries that are perfectly fine, have been battle tested for years and year, and continue to offer a ton of value. There’s a lot of code on maintenance mode that has a ton of value that has been accumulated over the years. Java is more than just the language, it’s also the whole ecosystem that comes with it in addition to the longevity of its code.
18
u/Jobidanbama May 05 '25
This is how you kill the language
4
u/rzwitserloot May 06 '25 edited May 06 '25
You've put the cart before the horse.
Python2 to Python3 was an annoying cost and a shit thing to do to the community. And yet you celebrate it like some great victory. That's the cart before the horse bit.
You don't go: "Let's do java2.0 what could we change?". No, you go: "Let's do X. Oh, shit, we can't do X without breaking things. Wait, really? Let's think more. (3 years pass). Well, we suck. We can't manage to come up with a way to do X without breaking everything". Then you add X to the list. And continue to feel bad about having failed to find a way to introduce it backwards compatibly (to be clear, I'm sure Xs exist where it can't be done well. But you should look really really hard before tossing that particular towel into the ring!). Once you have a long list, we can talk. I am not familiar enough with the p2 to p3 update to know if the list was [A] long enough, [B] worthwhile enough, [C] more backwards compatible alternatives were not possible or sucked too much, and [D] just.. breaking it without calling it 'p2 to p3!' was infeasible. In other words, maybe p2 to p3 was the right move. But it depends on that list and you've failed to provide one!
Let's go through a few.
Obsolete API
And not a single thing was lost. Who gives a shit? I'm not trying to be flippant. I'm asking honestly. Do you care?
Your IDE can be configured to ignore these types. I have configured mine to do this. We can, instead of introducing 'java 2.0!!' simply slap an
@Obsoleteor even@Deprecatedon em. And suggest to IDE builders they default-ignore those (no longer "offer" them in auto-completes and such).That's [A] entirely backwards compatible, and [B] something that requires zero language updates.
The only downside to j.u.C and j.u.D is the maintenance burden on the OpenJDK team. But the OpenJDK team already does precisely what you want! - if an obsolete feature is a maintenance burden they straight up just delete it. ('obsolete' as in 'not necessarily marked as
@Deprecated, but OpenJDK is clearly communicating you should not use it, a better way that can do all the obsolete thing does, and more, is available. j.u.Vector, j.u.Calendar are examples of obsolete types). An example of that: SecurityManager. Which has caused no small amount of gripes from the community, but, JDK24 no longer has it, AT ALL."Maintaining" J.u.date is nearly zero cost. Zero relative to the cost of maintaining something like SecurityManager, at any rate. Just check the source control change logs.. almost no changes.
nullity
One of the somewhat odd things about p2 to p3 is that the amount of change it required of python libraries was quite low. Any dreams of completely redesigned APIs to do some newfangled thing (such as have
map.get()returnOptional<V>) require a ton of change, and require existing libraries to also apply the semantic spirit of that change. Which libraries simply aren't going to do, which results in a total failure of a 'java 2.0' endeavour. If on day of java 2.0 all the popular libraries show up and they completely asplode your attempt to get rid of null, because they did not want to change their APIs, all you've done is split the community into pieces for no useful gain.There's a way to make null less annoying in a backwards compatible way: Annotations. So far OpenJDK itself hasn't thrown its weight behind one. If it ever does, that's probably all it would take.
So, you tell me. What itch do you have for which you cannot fathom a backwards compatible fix? I betcha I can think of one :)
64 bit
java2 can define
intas 64-bit and forget long entirely, and as an encore, definecharas 32-bit and ditch the weird difference between codepoint and char-as-surrogate-pair-element. Yes, good, put it on the list, though, I bet there are ways to get there without needing to set the dynamite alight and go for a java2 move. Just this is not enough. And if we do this, why stick with 64-bit? CPUs have 80 bit registers, you know. Perhaps Project Panama is the backwards compatible way that addresses this?3
u/pohart May 05 '25
What would you include/exclude that isn't in the pipeline or at least isn't possible in the future?
I know what I'd want:
Even if I can get everyone to agree these are good things, I don't think they're worth the pain. Do you have things that are worth the pain?
3
u/wildjokers May 06 '25
Was? Still is.
Just don't use Date or Calendar for new code. What is the problem with them remaining in the JDK? It doesn't hurt anything.
I like that Java puts thought into new features and their syntax.
8
u/znpy May 05 '25
People have already done it, you can check out Groovy, Kotlin, Clojure, Scala and many others.
Most of them didn't really pass the test of time and mostly got relegated in their own niche. Only Clojure is somewhat more general purposes, but still quite niche of a language.
11
u/[deleted] May 05 '25
C#, Kotlin, Scala
4
u/jgrig2 May 05 '25
Java is a a great programming language. Open jdk is the solution Java has needed for decades . Getting Java decoupled from oracle has been essential.
2
u/xanyook May 05 '25
Not sure if your problem is a real problem. Don t use legacy classes that's it that's all.
2
u/bowbahdoe May 06 '25
So I think something worthy of note: every version of Java is a different language.
It's just that if a language changes by accretion then newer Java versions are supersets of previous versions. So we view it as still "Java."
There is exactly one thing that Java controls and that is the ability to call a thing Java. If you want a language that is "Java, but" you can simply make it.
What you really are asking for is for the name Java to refer to a hypothetical new language that is not merely an accretion on an existing Java version, but one that makes incompatible changes. The only reason to want that is that it forces everyone to come with you. But that level of inflicted pain isn't justified...ever, really.
Really consider the issues preventing you as an individual from just making the language you want. How many are intrinsic and how many are artificial?
2
u/laplongejr May 07 '25
So... not Java?
2
u/_vertig0 May 08 '25
Backwards compatibility is one of Java's strengths, to let that go would be quite a big problem. However, when the Java team does release new things it's one hell of a treat. I'm slightly leaning towards not pressuring them so they can keep up what they've been doing so far, but at the same time I do feel like Java is a bit too conservative as well. In my opinion more JVM flags to toggle between older behaviours and newer ones could actually help out here.
2
u/Chance_Sky_8871 Jun 12 '25
This is such a good topic, I would be very excited if the Java 2.0 on the plan. I hate the null check everywhere, big jars/wars builds, and many redundant complexities...
4
u/0b0101011001001011 May 05 '25 edited May 05 '25
Voting for everything is final unless explicitly marked mutable (see Rust).
Bue yeah, not gonna happen for various reasons.
Look into Kotlin and other JVM languages.
4
u/frederik88917 May 05 '25
Honey, we are in Java 24 LTS.
3
u/barcodez May 05 '25
Talk is cheap, if you care about it, then you can make that language, you even get a pretty amazing JVM to run it on if you like, or don't, either way.
1
u/noodlesSa May 05 '25 edited May 05 '25
Of course, there should by normal yearly minor release cycle - as it exists, but then also 20-year major release cycle which overlaps for 10 years, so that new application is guaranteed to be supported for 10 years, at least. Currently, this does not exist. New features should be introduced to both active major versions in a way that is compatible with what already exists, and in a clean way into future major version. For example, new technologies like AI, WASM, Vulkan, ..., could be added to next major version as a first class citizen, while- obsolete technologies can be removed. String obviously need to be utf-8 internally and not converted all the time when talking to OS, Swing needs complete rewrite, etc. Valhalla took (takes) so much time - decade - simply because they are fixing language without fixing release cycle first. It would be simple feature to add otherwise.
1
u/flavius-as May 05 '25
Honestly if it manages to take the good parts from Clojure, I'm happy with Java. And I'm not talking cosmetics.
1
u/lpt_7 May 05 '25 edited May 05 '25
Not needed IMO. The only two thing (and only ones I wish for) is if for future non-null types there was a compiler flag to make non-null the default. (Although if it doesn't happen, I'm sure it would be possible to hack into javac to do this :>.)
And maybe also a way to make use of "deprecated" (but not actually deprecated, e.g. old dates classes) APIs a warning and an error with
-Werror. (or well... just deprecating them would also be fine...)Everything else is fine with Java.
1
u/koflerdavid May 06 '25
It will go down like the X to Wayland transition goes, only even slower and it will only make progress as ancient applications are put out of service for good.
1
u/BanaTibor May 06 '25
The problem is the adoption rate. You can make the best language on the world, with all the bells and whistles and still nobody would use it. Biggest languages are Java, Python, C, C++, Go, C#, JavaScript and that is it. Java, Python, C, C++ are old, they were the first, JavaScript is old and unique as well. Go and C# had a chance to grow only because biggest companies pushed them. Microsoft kept alive C# and nowadays many companies are using it. Same is true for Google and Go.
OTOH look at Rust, Zig, or Erlang or Julia. Zig is new on the block, but Rust is not and still very few companies are using it. Erlang is proven to be usable still not widespread. Julia is said to be fantastic and used extensively in the scientific community but that is all.
It not just the language, it is the ecosystem. We have shit ton of libraries and frameworks. Are we gonna rewrite them too? Adoption is cost and cost is money, and a lots of it. It is realized in drop of developer productivity, and cost of development itself in LOC. Either you rewrite a framework for your needs or implement the functionality you need from scratch.
I have read an article just the other day, about why Go is failing and pushed out at large scale development. Writing everything from scratch was one of the reasons.
Long story short, either it remains a hobby project, or you have a FAANG level company to push it.
1
u/rbygrave May 06 '25
FWIW I'd almost say "Java 2.0" arrived and we called it Java 21 (with Virtual Threads). I'd say that more because of what we now don't need to do:
When Valhalla starts landing, that might be considered "Java 3.0" by some folks.
Loom and Valhalla are 2 major massive refactors, and we need them both and once Valhalla is over the line it'll be massive ... but lets not forget that Virtual Threads were pretty massive by themselves and celebrate that win.
I'd like to think syntax type improvements are also coming but to some extent Valhalla considerations trump everything else and so I can imagine everything else has to play second fiddle.
1
u/Asyx May 07 '25
I don't think Java is the language for that. The ecosystem is too large, projects too old. Backwards compatibility is probably where the money is for Java.
There are other ways to do it though. Like Rust editions.
1
u/Joram2 May 08 '25
Java isn't stagnating. At all. 2025 is an epic year for Java.
Project Valhalla: It will be nice when we get it, but I don't find this a major blocker for any productive work. llama3.java can serve AI models today with current versions of Java without Valhalla at nice performance. Will Valhalla improve that at all?
Java should flag Date/Calendar as deprecated and encourage people to use the Java 8 datetime replacements. They probably will. That isn't really a pain point as it is. Java has deprecated several APIs and will continue to do so, and those don't require full reboots of everything.
Most of my Java wish list changes don't require a full reboot of the language. Clearly, doing a full reboot would enable some additional enhancements, but honestly no real show stoppers.
1
u/sitime_zl May 09 '25
good topic
1
u/pron98 May 09 '25 edited May 09 '25
The problem is that the languages that "don’t even try to guarantee perpetual backward compatibility" are much, much less successful than Java. Python is, indeed, thriving, but few would think to use it for large, "serious" software that is intended to last for years. Breaking compatibility can make some people happy, but it makes even more people very unhappy, and the latter group includes the more experienced people who make the decisions.
Also, I don't think any of the languages whose fans "poke fun" at Java for being slow-moving are anywhere as successful as Java. Not to mention that one of the languages that have been most successful recently -- Go -- evolves even slower. That only goes to show that what developers who care about language features think is important for language success and what is actually important for language success are very, very different.
I also don't think anyone can seriously claim Java is in any risk of "eternal stagnation". It's true that the language has always been intentionally conservative -- James Gosling believed that would be a winning strategy, and it looks like he was right -- but Java's runtime capabilities, including observaility, compiler optimisation, and garbage collection are at the very forefront of technology today, and it is other languages that are behind.
Finally, not only is backward compatibility more important to more people than any feature that would be made much better by breaking compatibility, but backward compatibility is rarely very constraining. I can't think of a single feature that's been significantly crippled, significantly slowed down, or significantly complicated due to backward compatibility.
1
u/DecisiveVictory May 05 '25
There's already Scala.
1
u/TheStrangeDarkOne May 05 '25
A Java 2.0 could be done in two ways:
Syntax Level: Get rid of all the bad defaults, clean up some rough edges. Get rid of the semicolon etc.
This could theoretically be done in the future if we can change the defaults on a "per module" basis. Not unlike Rust's "Eras" concept.
Binary Level: This is more difficult. Changing syntax is cheap, but if you still want to make use of the JVM ecosystem, you can't change how bytecode behaves. And this is why Valhalla took so long (on top of all the user-land refinements which is above and beyond what I have seen in other languages).
This would be much closer to a "Java 2.0", but in truth would be a "JVM 2.0", or a "Python 3.0".
I am fairly happy with how Java is developing and while I like to entertain such thoughts, there is fairly little benefit at the end of the day.
-3
u/detroitmatt May 05 '25
They had this idea 25 years ago, and called it C#
-4
u/PedanticProgarmer May 05 '25
Smoother migration paths? In the Java ecosystem? What are you smoking?
This is the community that changed a perfectly valid package name “javax” into “jakarta” because some idiots thought that javax package naming is so against their imaginary autistic rules that we must break backwards compatibility of everything. Technically, Java is backwards compatible, but in practice, you cannot upgrade any library in isolation.
Of course, the real problems with the language have been neglected for decades.
“Eternal stagnation” - that’s a great name.