java-25-excellence
Skill0 starsChanged 6 months agoMITView on GitHub
Use when unsure whether a Java 25 feature is final, preview, or removed (string templates, structured concurrency, scoped values, stable values), when designing virtual-thread fan-out against finite downstreams (connection pools, rate-limited APIs, "Pending acquire queue" errors), when migrating ThreadLocal/InheritableThreadLocal context propagation, or when evaluating virtual-thread pinning claims about synchronized.
In this repository4 other files it gives its agents.
The file
Files
Java 25 — Non-Obvious Deltas
Baseline Java fluency is assumed. This skill holds only facts commonly stated wrong because of stale (2023-era) advice.
Feature status on Java 25 (LTS)
| Feature | Status | Note |
| Scoped Values (JEP 506) | Final | Replaces (Inheritable)ThreadLocal for context propagation. Auto-inherited only by StructuredTaskScope forks — NOT across executor.submit(): capture the value, rebind with ScopedValue.where(...) inside the task |
| Structured Concurrency (JEP 505) | Preview (5th) | --enable-preview pins the classfile to JDK 25. API changed in 25: StructuredTaskScope.open(Joiner...); the 21–24 ShutdownOnFailure API is gone |
String Templates (STR."...") | REMOVED | Previewed in 21/22, withdrawn in JDK 23, never returned. Use "...".formatted() / text blocks |
| Flexible constructor bodies (513), module import declarations (511), compact source files (512), KDF API (510) | Final | |
| Compact Object Headers (JEP 519) | Final, opt-in | -XX:+UseCompactObjectHeaders — footprint win, no code change |
| Stable Values (502), primitive types in patterns (507) | Preview | |
synchronized + virtual threads | Fixed in JDK 24 (JEP 491) | synchronized no longer pins carriers — don't rewrite to ReentrantLock "because pinning". Remaining pinning: native (JNI/FFM) frames, class initializers. -Djdk.tracePinnedThreads was removed; use JFR jdk.VirtualThreadPinned |
Virtual-thread fan-out has NO cap
newVirtualThreadPerTaskExecutor() spawns one VT per submit, unbounded. For large batches against a finite downstream (HTTP connection pool, rate-limited upstream, DB pool), bound the resource — not the threads — or the pool fails with e.g. reactor-netty Pending acquire queue has reached its maximum size:
Semaphore gate = new Semaphore(props.concurrency());
var futures = items.stream()
.map(i -> CompletableFuture.supplyAsync(() -> {
gate.acquireUninterruptibly();
try { return fetchOne(i); } finally { gate.release(); }
}, virtualThreadExecutor))
.toList();- A
*-concurrencyconfig property bounds nothing by itself — before adding one, grep for its getter to confirm a realSemaphoreconsumer exists. - Cap ≤ the client's
ConnectionProvider.maxConnections; validate empirically with a representative batch. - Small fan-outs (a handful of parallel calls) need no gate — don't add one.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

