Everyone Said Java Was Dead. Java 25 Just Made Python Developers Uncomfortable.
8 min readRaj Kanjariya

THE COMEBACK NOBODY EXPECTED
For years, developers left Java for Python, Kotlin, and Go — citing verbosity, slow evolution, and outdated concurrency. Java 25 shipped virtual threads, pattern matching, scoped values, and module imports. Here’s what actually changed — and why the conversation just got complicated.
Three years ago, a developer posted on Hacker News:
“I switched from Java to Python. I’m never going back. Java is a language frozen in 2005 pretending to be modern**.”**
1,400 upvotes. 300 comments agreeing.
Last month, a different developer replied to that thread:
“Have you looked at Java 25**?”**
The “Java is dead” narrative has been running since approximately 2015. Python took over data science. Go took distributed systems. Kotlin replaced Java on Android. Every conference had a talk titled something like “Why We Moved from Java to [X].”
The argument was real. Java was verbose. Its concurrency model was painful. Evolution was glacial. Writing a simple REST endpoint required classes, interfaces, factories, and enough boilerplate to fill a small novel.
But Java didn’t die. It did something more interesting.
It changed.
Java 25 is the brand-new Long-Term Support (LTS) release of Java, released on September 16, 2025. It succeeds Java 21, which introduced numerous improvements, particularly in simplifying the language and in concurrency management with Virtual Threads.
If your mental model of Java was formed before 2021, you’re thinking about a different language. The Java that earned its reputation for verbosity and pain looks almost nothing like what ships in 2025.
Here’s what actually changed.
The Feature That Should Have Made More Noise
Virtual Threads. This one matters more than anything else in Java 25’s lineage.
The old Java concurrency model — platform threads — worked like this: each thread maps to an OS thread. OS threads are expensive. Each one consumes roughly 1MB of stack memory. Running 10,000 concurrent requests means 10,000 OS threads means roughly 10GB of memory just for thread stacks. This is why Java backend applications needed careful thread pool tuning, and why the default recommendation was “don’t create too many threads.”
Virtual Threads, standardized in Java 21 and further refined in Java 25, work differently:
// Java 25 — Virtual Threads
// Run 1 million concurrent tasks
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
IntStream.range(0, 1_000_000).forEach(i ->
executor.submit(() -> {
// This blocks on I/O — that's fine now
String result = callExternalApi(i);
saveToDatabase(result);
})
);
} // auto-closes, waits for all tasks
// Each virtual thread: ~few KB (not 1MB)
// 1 million concurrent tasks: manageable
// Code style: simple, blocking, readable
// No async/await. No callbacks. No coroutines.
A virtual thread is not an OS thread. It’s a Java-managed construct. When a virtual thread blocks on I/O — waiting for a database, waiting for an API call — the underlying OS thread is freed to run other virtual threads. When the I/O completes, the virtual thread is rescheduled.
The result: you can write millions of concurrent operations using simple, blocking, imperative code. No async keyword. No await. No callback chains. No Promise chains. Just code that looks synchronous and performs as if it were asynchronous.
Scoped Values are especially useful in the context of Virtual Threads, as they provide lower memory and performance overhead compared to traditional ThreadLocals. Virtual Threads are lightweight and short-lived, and applications can run millions of them.
Compare this to Python’s asyncio approach:
# Python asyncio — same problem, different model
import asyncio
async def process_request(i):
# async/await syntax required throughout call chain
result = await call_external_api(i)
await save_to_database(result)
return result
async def main():
tasks = [process_request(i) for i in range(100_000)]
await asyncio.gather(*tasks)
asyncio.run(main())
Python’s asyncio is genuinely good. But it requires async/await to propagate through your entire call stack — a single synchronous blocking call in the chain stalls everything. Java’s virtual threads don’t have this constraint. Blocking is fine. The runtime handles it.
This is the feature that made backend Java engineers who’d been quietly watching Python’s concurrency story suddenly feel better about their technology choices.

Java 25 in Detail — The Actual Features
Module Import Declarations (JEP 511 — New in Java 25)
Java 25 ships Module Import Declarations as a new permanent language feature.
// Before Java 25 — import everything individually:
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;
// Java 25 — import an entire module:
import module java.base;
// All java.util.*, java.io.*, java.lang.* available immediately
// For data science / ML work:
import module java.sql;
import module jdk.httpserver;
Small change. Large quality-of-life improvement. The boilerplate complaints were real. This addresses them.
Pattern Matching — Now Complete
Pattern Matching is enhanced by allowing primitive types in all pattern contexts. The instanceof operator and switch expressions and statements are extended to work with all primitive types.
// Java 25 — Pattern Matching for switch with primitives
Object value = getResponse();
String result = switch (value) {
case Integer i when i > 1000 -> "High value: " + i;
case Integer i -> "Normal int: " + i;
case Double d -> "Decimal: " + d;
case String s when s.isEmpty()-> "Empty string";
case String s -> "Text: " + s;
case null -> "Nothing";
default -> "Unknown type";
};
// Compare with Java 8:
// if (value instanceof Integer) {
// Integer i = (Integer) value;
// if (i > 1000) { ... }
// } else if (value instanceof Double) { ... }
// Nested ifs. Manual casts. Verbose. Error-prone.
Python’s equivalent arrived in 3.10 (2021) as structural pattern matching:
# Python 3.10+ match/case
match value:
case int(i) if i > 1000:
result = f"High value: {i}"
case int(i):
result = f"Normal int: {i}"
case float(d):
result = f"Decimal: {d}"
case str(s) if not s:
result = "Empty string"
case str(s):
result = f"Text: {s}"
case None:
result = "Nothing"
case _:
result = "Unknown type"
Both are genuinely good. Java’s is now complete, including primitive types. The four-year gap between Python 3.10 and Java 25’s full primitive support gave Python a head start — but the implementation is now comparable.
Scoped Values (JEP 506 — Final in Java 25)
// Before: ThreadLocal — memory leaks, mutable, complex
private static final ThreadLocal<User> currentUser = new ThreadLocal<>();
currentUser.set(user);
// Easy to forget to remove → memory leaks with thread pools
// Java 25: Scoped Values — immutable, automatically cleaned up
private static final ScopedValue<User> CURRENT_USER = ScopedValue.newInstance();
ScopedValue.where(CURRENT_USER, authenticatedUser).run(() -> {
processOrder(); // CURRENT_USER accessible anywhere in call chain
sendNotification(); // Without passing it as a parameter
updateAuditLog(); // Automatically gone when block exits
});
// No memory leaks. No mutable state. Works perfectly with virtual threads.
Scoped Values offer a lightweight, immutable, thread-safe alternative to ThreadLocal. They are designed to pass context across call chains in a safe, performant, and immutable way, especially with virtual threads. baeldung
Virtual Thread Pinning Fix (JEP 491)
Virtual Threads were the major innovation introduced in Java 21, and their integration into the Java ecosystem has been further optimized in Java 25. Java 25 makes it simpler for existing Java libraries to work with Virtual Threads, without requiring changes to avoid the use of synchronized methods or blocks.
The technical version: in Java 21, a virtual thread using a synchronized block would “pin” to its carrier OS thread — preventing other virtual threads from using that carrier while it was blocked. This was a significant limitation for codebases with legacy synchronized code.
Java 25 removes this limitation. Synchronized blocks work correctly with virtual threads. Existing libraries that use synchronized don’t need to be rewritten.
This is the feature that lets enterprises migrate to virtual threads without waiting for their entire dependency tree to be updated.
The Honest Comparison: Where Python Still Wins
This article is not an argument that Java beats Python. That framing is wrong.
Python wins — clearly, significantly, probably permanently — in several areas:
# Data science and ML: Python wins this completely
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
import tensorflow as tf
# The ecosystem for data work:
# NumPy, Pandas, Scikit-learn, TensorFlow, PyTorch,
# Matplotlib, Seaborn, Jupyter notebooks
# None of this has a Java equivalent that developers prefer
# Scripting and automation:
# Python's 10 lines vs Java's 50 lines for quick scripts
# Python wins on ergonomics for small, fast tasks
# Rapid prototyping:
# Dynamic typing + REPL + Jupyter = faster exploration
# Java's compile step is not what you want for exploration
Java wins — clearly — in:
// Enterprise backend services: Java wins
// Spring Boot ecosystem, JPA, mature tooling
// Performance under sustained load
// Static typing catches bugs at compile time
// IDE support is extraordinary
// Concurrent high-throughput services:
// Virtual threads now make this Java's clearest advantage
// Long-lived production systems:
// Static typing, strong backwards compatibility guarantees
// Java 8 code still runs on Java 25
// Python 2 → 3 migration was painful for everyone
The honest verdict: they’re for different things. The “Java vs Python” framing is usually wrong. The interesting question is “which is right for this specific problem?”
Records: Where Java Caught Up and Then Some
// Java Records — clean, immutable data classes
record Person(String name, int age) {}
record Point(double x, double y) {}
record ApiResponse(int status, String body, boolean success) {}
// Automatic: canonical constructor, accessors, equals,
// hashCode, toString — all generated from the declaration
Person p = new Person("Alice", 30);
System.out.println(p.name()); // Alice
System.out.println(p.age()); // 30
System.out.println(p); // Person[name=Alice, age=30]
// Immutable: fields are final, no setters
// With pattern matching:
if (p instanceof Person(var name, var age) when age >= 18) {
System.out.println(name + " is an adult");
}
# Python equivalent requires more setup
from dataclasses import dataclass
@dataclass(frozen=True) # frozen for immutability
class Person:
name: str
age: int
# Or use NamedTuple:
from typing import NamedTuple
class Person(NamedTuple):
name: str
age: int
# Both work. Java's record syntax is actually cleaner
# for this specific use case.
Records arrived in Java 16 (2021). Combined with pattern matching in Java 25, they enable data-oriented programming that would have been impossible in Java 8 without enormous boilerplate.
The GIL Conversation
Python’s Global Interpreter Lock has been a constraint for years. It prevents multiple Python threads from executing Python bytecode simultaneously — meaning Python threads don’t achieve true parallelism for CPU-bound work.
Python 3.13 began work on a no-GIL mode (experimental). The ecosystem is cautiously optimistic.
Java has never had a GIL. True parallelism, across all available cores, has always been available. Combined with virtual threads for I/O concurrency, Java 25 offers:
- Virtual Threads: handle millions of concurrent I/O-bound tasks
- Platform Threads + Fork/Join: handle CPU-bound parallel work
- Both models: in the same application, with the same standard library
// CPU-bound parallel work — true parallelism
List<Integer> numbers = List.of(1, 2, 3, 4, 5, 6, 7, 8);
int sum = numbers.parallelStream()
.mapToInt(this::heavyCalculation)
.sum();
// Uses all available CPU cores, no GIL equivalent
// I/O-bound concurrent work — virtual threads
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
numbers.forEach(n -> executor.submit(() -> callApi(n)));
}
The Performance Context
In Java 25, improvements have been made to the G1, ZGC, and Shenandoah garbage collectors.
The JVM has had decades of optimization. JIT compilation, garbage collection improvements, and bytecode optimization make Java consistently fast for sustained, high-throughput workloads.
Python — CPython specifically — is slower at runtime for compute-intensive work. The tooling around Python (PyPy, Cython, NumPy’s underlying C) compensates in specific domains. For general-purpose backend work under load, Java benchmarks favorably.
This isn’t new. What’s new is that Java’s performance advantage now comes with a developer experience that doesn’t require writing 200 lines of boilerplate to say hello.
The One-Sentence Insight
Java didn’t win the “Java vs Python” debate — that debate was always a false binary — but Java 25 makes it impossible to characterize Java as a language that stopped evolving, which means developers whose Java knowledge stopped at Java 8 are judging a language they haven’t met.
Conclusion
The 1,400-upvote Hacker News comment was written about a real version of Java. Java circa 2015 was verbose, its concurrency model was painful, and its evolution was slow. The criticism was earned.
The version of Java that shipped in September 2025 has virtual threads that run a million concurrent tasks on simple blocking code, pattern matching across all types including primitives, records for clean immutable data classes, scoped values for safe context propagation, and module imports that eliminate the boilerplate wall.
It is not a different language in name only. The programming model is genuinely different.
Python didn’t lose. Python is excellent. The data science ecosystem, the scripting ergonomics, the notebook culture — Python dominates these and will continue to.
But the “Java is dead” narrative is now operating on outdated information. Java 25 is not the language that earned that reputation. And if you’re choosing a technology for a high-throughput backend service in 2026 and you ruled out Java in 2018 — it might be worth a second look.
The developers who switched are not wrong for switching. The developers who stayed are not wrong for staying.
The developers judging Java 25 by Java 8 are wrong about what they’re judging.
Connect With Me 🙏
Thanks for reading!
Whether you’re Team Java, Team Python, or Team “whatever solves the problem” — I write weekly about languages, tools, and the developer decisions that matter.
👉 Follow on Medium: medium.com/@rajkanjariya2020
Portfolio: rajkanjariya.dev
LinkedIn: Raj Kanjariya
Comments
Loading comments…