r/java • • Jun 22 '26 Bravo

Ask: GitHub Setup Java Action

1 Upvotes

Hey all,

I'm going through issues and PRs on setup-java.

Besides what is already there, anything else you would like to see fixed, improved, or implemented?


r/java • • Jun 21 '26

Better Tools for Immutable Data

Thumbnail youtu.be
80 Upvotes

r/java • • Jun 20 '26

Populating a POJO with Reflection vs. with the ClassFile API - small benchmark

62 Upvotes

I wanted to learn about the ClassFile API, and as a small pet project, I created a benchmark to compare how faster a generated class is than a reflection-based approach when we want to populate a POJO from a Map.

TL;DR: it turned out, the generated bytecode was 5x faster than using reflection.

Details here, enjoy: https://github.com/erosb/learn-classfile-api

And please prove me wrong if you find any mistakes in the benchmark :)


r/java • • Jun 20 '26

GWT 2.13.1 released on 2026-06-19

Thumbnail github.com
17 Upvotes

r/java • • Jun 19 '26

How to Deadlock a Java ExecutorService

Thumbnail mlangc.github.io
63 Upvotes

r/java • • Jun 18 '26

Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

Thumbnail open.substack.com
197 Upvotes

r/java • • Jun 18 '26

My Fish breeding Sandbox Game - Made with Java

Thumbnail youtube.com
40 Upvotes

Retro Pond on Steam

Feel free to ask any technical questions about this project.


r/java • • Jun 18 '26

Java 27 Features: what to expect?

Thumbnail youtu.be
69 Upvotes

r/java • • Jun 18 '26

Local JDK Demo Project

Thumbnail github.com
16 Upvotes

r/java • • Jun 18 '26

Safer filtering with JPA & RSQL

15 Upvotes

Hi everyone,

I published a small library that came from a problem I kept running into while building Spring APIs.

I wanted to let users filter dynamically, but without exposing a completely open entry point where they could try arbitrary entity fields, operators, joins, or values.

I looked at a few approaches, including Shopify-style bracket operators, OData, and eventually landed on RSQL. I built this library on top of two existing projects: rsql-parser for parsing RSQL, and rsql-jpa-specification for translating RSQL into JPA Specifications.

Those libraries solve the parsing and query generation parts. What I wanted to add was a validation/contract layer on top: a way for each use case to explicitly define public field aliases, allowed operators, sortable fields, paging limits, value validation, and mandatory application predicates.

That became this library:

https://github.com/ggomarighetti/jpa-rsql-search

I’d really appreciate constructive feedback on the idea, the API, and the docs.

Edit: I wrote a full step-by-step guide on how to use it, with the reasoning behind each design choice: https://ggomarighetti.dev/en/articles/advanced-search-spring-boot-jpa-rsql/


r/java • • Jun 17 '26

Oracle's OpenJDK Bans Generative AI Contributions While Oracle's GraalVM Allows Them

Thumbnail infoq.com
92 Upvotes

r/java • • Jun 17 '26

Can Java Microservices Be As Fast As Go? A 2026 Benchmark Update

Thumbnail medium.com
44 Upvotes

r/java • • Jun 17 '26

Ratchet 0.1.1: open source CDI-native job scheduler for Jakarta EE (persistent jobs, retries, workflows, pluggable stores)

18 Upvotes

First public release of something that started as a module inside the application I've worked on for the better part of two decades: Ratchet, a background job scheduler built for Jakarta EE 10/11 rather than ported to it. Apache 2.0.

The pitch is one service and a method reference:

@Inject JobSchedulerService scheduler;
    
scheduler.enqueue(() -> validatePayment(orderId))
    .thenOnSuccess(() -> fulfillOrder(orderId))
    .thenOnFailure(() -> notifyPaymentFailure(orderId))
    .withMaxRetries(3)
    .withBackoff(BackoffPolicy.EXPONENTIAL, Duration.ofSeconds(2))
    .submit();

Persistent jobs on PostgreSQL, MySQL, or MongoDB (more planned, happy to hear what your priorities are). Claiming is pull-based (FOR UPDATE SKIP LOCKED on the SQL stores, atomic findOneAndUpdate on Mongo), so the database is the queue. No broker, no Redis. Plus cron via @Recurring, conditional workflow branching, batch processing, a built-in circuit breaker, a DLQ, CDI events for every lifecycle transition, and Micrometer metrics.

The EE-native part, which is the actual point: jobs run on Jakarta Concurrency managed executors (no rogue thread pools), enqueue participates in JTA transactions, and job classes resolve through CDI so @Inject works inside job targets.

A few notes on the design:

  1. Quartz works, but the API predates lambdas and I got tired of writing a class plus two builders just to run a method.
  2. If you're on Spring, use JobRunr, genuinely. Ratchet is for the CDI side of the fence. It's Apache 2.0 throughout, with no paid tier.
  3. Every default is a bean you can replace with a CDI @Alternative — store, retry policy, serializer, cluster coordinator, key provider. No Flyway or Liquibase dependency (DDL is plain SQL). No Resilience4j (breaker is built in, ~275 lines). No Jackson (serialization is an SPI, JSON-B default).
  4. Deserialization allowlist is mandatory. Deployment fails until you provide a ClassPolicy for your payload classes. I build for regulated industries; you get my paranoia for free. Test story, since that's half of why I'm posting: 2300+ test methods, a TCK with 50+ contract classes across three named tiers (custom stores can prove conformance), and 15 verified combinations in CI — five EE server configs times three databases, all real container deployments.

Honest limitations: it's 0.1.1, @Incubating SPIs may change, Jakarta only, no web dashboard (by design), and it hasn't run in production yet — it went public before it shipped inside the app it started in, so the test rigor is the trust story for now.

Repo: https://github.com/ratchet-run/ratchet

Docs: https://ratchet.run

Criticism from people running EE in production is exactly what I'm here for. The weirder your deployment, the more useful the bug report.

Some things on the roadmap:

  • ratchet-blocks: an extension that allows for low-code/no-code creation of Ratchet job workflows
  • New stores: Oracle, SQL Server, Redis

r/java • • Jun 17 '26

Mill 1.2.0-RC1: Fine-grained concurrency (no more global lock!), bazel-compatible remote caching, and many more goodies. Please help try it out!

13 Upvotes

r/java • • Jun 16 '26

Maven Central publishing usage notices

93 Upvotes

heads up for folks publishing to Maven Central: we're continuing sustainability work around Central and are now showing publishing usage notices.

the goal is that normal OSS publishers are not impacted. this is aimed at the very high-volume / commercial-scale publishing patterns that put a pretty different load on the service.

more details here if you want them:
https://central.sonatype.org/publish/maven-central-publishing-limits/

feel free to reach out with any questions.

EDIT: thanks for the feedback here, it has really helped us. first, we want to reiterate that these are usage notices only right now and do not currently restrict publishing in any way. quick updates: 

if the initial threshold seemed low to you: you’re right, we made a mistake and have increased limits. 

our goal is to keep Maven Central free and open for legitimate OSS users, so continuous feedback is helpful as we adjust. limits could change as we get more feedback, so keep an eye on the usage center for the latest.

we’ll continue keeping an eye here and update docs to reflect these changes. If you need to request an exemption, here’s how: https://central.sonatype.org/publish/maven-central-publishing-limits/#exemptions-for-community-open-source-projects

we've also been collecting your questions here and other streams into this FAQ here: https://central.sonatype.org/publish/maven-central-publishing-limits/#frequently-asked-questions


r/java • • Jun 16 '26

Apache Fory Serialization 1.2.0 released: JDK 25/26 support without sun.misc.Unsafe

Thumbnail github.com
51 Upvotes

r/java • • Jun 16 '26

Jet: a simple, lightweight, modern, turnkey, Java web client and server library

Thumbnail github.com
17 Upvotes

Jet offers five modules: Common, Server, OpenAPI Annotations, OpenAPI Annotations Plugin, and Client.

Jet is a wrapper around the excellent Jetty web client and server library. Jetty provides the battle-tested low-level protocol handling, while Jet focuses on providing a modern and consistent interface with superb documentation and an amazing developer experience.

---

I built this Java library to fill a hole in the Java web server library ecosystem. Javalin got me 90% of the way there, but requires the Kotlin dependency and lacks header models and exhaustive KDocs. The Client module is a still a WIP, but the Server, OpenAPI Annotations, and OpenAPI Annotations Plugin modules are production-ready!

Check it out and lmk what you think! And what do you think about my controversial opinion on AI coding at the bottom of the README 👀


r/java • • Jun 15 '26

Announcement: New release of the JDBC/Swing-based database tool has been published

Thumbnail wisser.github.io
12 Upvotes

Jailer 17.1.2 now includes an SQL Advisor - explain, optimize, and rewrite your queries

Ask it to explain, optimize, or rewrite the query - a split view shows the revised SQL alongside a plain-English explanation, and a diff highlights what changed. It connects seamlessly to the "Generate SQL" tab from 17.1.1, so you can go straight from generating a query to refining it.

If you missed 17.1.1: that release added SQL generation directly into the SQL console - describe what you want in plain English, get schema-aware SQL back.

Questions and comments are welcome!


r/java • • Jun 15 '26

What is the use case for a non-value (identity) record with Valhalla?

14 Upvotes

With Java classes, non-value (identity) classes are fully mutable, the new Valhalla value classes are (shallow) immutable, that's a big difference; often immutability is impractical, so then identity classes make sense. With records, all records are (shallow) immutable, so this is a non-issue. Secondly, some code uses the legacy synchronization/monitor functionality built-in to identity classes; but that's been strongly discouraged for records, so this seems not much of an issue.

Here is ChatGPT on the difference between a Java value-record and a Java non-value, identity record: https://chatgpt.com/share/6a2b8329-0a0c-83ea-b8b3-fe4e40956616

Is there any use case for Java non-value (identity) records? It seems silly to ask devs to write value in front of every record if that is what devs want almost every time they use records.


r/java • • Jun 15 '26

For anyone who used Undertow with Spring Boot 3.x and upgraded to Spring Boot 4.x, what did you replace Undertow with?

Thumbnail reddit.com
8 Upvotes

r/java • • Jun 15 '26

Unpacking Parquet: Explicit SIMD, Scalar Baselines, and What HotSpot Makes of Them

Thumbnail cdelmonte.dev
38 Upvotes

r/java • • Jun 14 '26

Making invokedynamic usable from normal Java

Post image
62 Upvotes

I made SimpleIndy, a small Gradle plugin that rewrites selected Java static method calls into JVM invokedynamic after compilation.

The goal is to make invokedynamic easier to experiment with from normal Java/Kotlin projects, without writing ASM manually or building a compiler plugin.

You write ordinary source code, mark a static method as an indy stub, and the compiled bytecode gets transformed.

Repo: https://github.com/bezsahara/SimpleIndy

Would appreciate feedback on the API/design.


r/java • • Jun 14 '26

double, BigDecimal, or Fixed-Point?

Thumbnail blog.frankel.ch
32 Upvotes

r/java • • Jun 14 '26

New test helper, ExploratoryTestRunner, to test all states of your class

11 Upvotes

I like writing good exhaustive tests in JUnit, making use of @Nested to test all possible states, but I've found that for test subjects with a lot of state transitions, it can lead to huge unwieldy tests especially when it can take many steps to get to a specific state, and at each level you should probably try every allowed transition. This makes it hard to see if all paths are truly tested, and due to the size of the test it becomes difficult to modify or extend.

So over the past year I've been using a different way of testing. Instead of writing many nested levels with all possible steps, I've been writing tests that only define what possible actions can be applied to a subject under test. These actions are then automatically combined to explore all paths, where each path terminates until it reaches a state that has been seen before (or a selectable maximum depth has been reached).

For example, let's say I wrote a custom Queue implementation based on a LinkedHashSet that disallowed duplicates. I'd define actions to perform on the queue like:

() -> queue.poll();
() -> queue.offer(value);
() -> queue.remove(value);

To verify the queue works correctly, one can compare it with say an ArrayList. Each action is then defined by first updating your expectation, and returning the action to apply to the subject under test:

@Action
@ValueSource(strings = {"A", "B", "C"})
public Runnable enqueue(String value) {
    // update expectation (disallowing duplicates):
    if (!expectedQueue.contains(value)) {
        expectedQueue.add(value);
    }

    // the action on the subject:
    return () -> queue.offer(value);   
}

To verify the queue matches the expected queue one can define one or more assertion methods:

@Assertion
public void assertQueueContents() {
    assertThat(List.copyOf(queue))  // turn queue under test into a List
        .describedAs("Queue contents")
        .isEqualTo(expectedQueue);  // ensure it matches our expectation
}

In order for the ExploratoryTestRunner to prune paths with states that have already been reached before, the test code must implement the Explorable interface which requires the implementation of a snapshot method. This method should simply take the expected state (copying it if needed) and return an Object that can be compared with equals. Usually using a record here is optimal. For example:

public record State(List<String> queue) {}

@Override
public Object snapshot() {
    return new State(List.copyOf(expectedQueue));
}

The whole class then looks roughly like this:

class LinkedHashSetAsDeduplicatingQueueExploratoryTest {

  @Test
  void exploreQueueSemantics() {
    ExploratoryTestRunner.explore(QueueExplorable.class, QueueExplorable::new);
  }

  public static class QueueExplorable implements Explorable {

    private final Queue<String> queue = new MyQueue<>();
    private final List<String> expectedQueue = new ArrayList<>();

    public record State(List<String> queue) {}

    // snapshot, action and assertion methods omitted here

  }
}

When run, this ExploratoryTestRunner will explore all paths defined by the test class, creating new instances of QueueExplorable as needed. It will then report how many states it tested and what the deepest path was:

ExploratoryTestRunner: class 
examples.LinkedHashSetAsDeduplicatingQueueExploratoryTest$QueueExplorable -- Explored 660 paths, longest path: 5

If a failure occurs, this is reported by showing the path that leads to the failure, and which assertions failed (including a helpful trace line), for example:

org.opentest4j.AssertionFailedError: Path 61 failed: 
 - enqueue(A) -> State[queue=[A]]
 - enqueue(B) -> State[queue=[A, B]]
 - dequeue -> State[queue=[B]]
[Queue contents] 
expected: ["B"]
 but was: ["A"]
	at org.int4.common.test/examples.LinkedHashSetAsDeduplicatingQueueExploratoryTest$QueueExplorable.assertQueueContents(LinkedHashSetAsDeduplicatingQueueExploratoryTest.java:42)
[Peeked element] 
expected: "B"
 but was: "A"
	at org.int4.common.test/examples.LinkedHashSetAsDeduplicatingQueueExploratoryTest$QueueExplorable.assertPeekedElement(LinkedHashSetAsDeduplicatingQueueExploratoryTest.java:49)

The above example shows quite clearly that dequeue seems to have removed the wrong element (in this case because getLast was called instead of getFirst in the subject under test).

The ExploratoryTestRunner can be found here: https://github.com/int4-org/Common/tree/master/common-test

The full example test case is here: https://github.com/int4-org/Common/blob/master/common-test/examples/LinkedHashSetAsDeduplicatingQueueExploratoryTest.java

Another much more elaborate example (for a UI control): https://github.com/int4-org/FX/blob/master/fx-builders/src/test/java/org/int4/fx/builders/control/TextFieldControlExploratoryTest.java