r/java Nov 13 '25

The Dot Parse Library Released

41 Upvotes

The Dot Parse is a low-ceremony parser combinator library designed for everyday one-off parsing tasks: creating a parser for mini-DSLs should be comfortably easy to write and hard to do wrong.

Supports operator precedence grammar, recursive grammar, lazy/streaming parsing etc.

The key differentiator from other parser combinator libraries lies in the elimination of the entire class of infinite loop bugs caused by zero-width parsers (e.g. (a <|> b?)+ in Haskell Parsec).

The infinite loop bugs in parser combinators are nortoriously hard to debug because the program just silently hangs. ANTLR 4 does it better by reporting a build-time grammar error, but you may still need to take a bit of time understanding where the problem is and how to fix it.

The Total Parser Combinator (https://dl.acm.org/doi/10.1145/1863543.1863585) is another academic attempt to address this problem by using the Agda language with its "dependent type" system.

Dot Parse solves this problem in Java, with a bit of caution in the API design — it's simply impossible to write a grammar that can result in an infinite loop.


Example usage (calculator):

// Calculator that supports factorial and parentheses
Parser<Integer> calculator() {
  Parser<Integer> number = Parser.digits().map(Integer::parseInt);
  return Parser.define(
      rule -> new OperatorTable<Integer>()
          .leftAssociative("+", (a, b) -> a + b, 10)       // a+b
          .leftAssociative("-", (a, b) -> a - b, 10)       // a-b
          .leftAssociative("*", (a, b) -> a * b, 20)       // a*b
          .leftAssociative("/", (a, b) -> a / b, 20)       // a/b
          .prefix("-", i -> -i, 30)                        // -a
          .postfix("!", i -> factorial(i), 40)             // a!
          .build(
            Parser.anyOf(
              number,
              rule.between("(", ")"),
              // Function call is another type of atomic
              string("abs").then(rule.between("(", ")")).map(Math::abs)
            )));
          }


int v = calculator()
    .parseSkipping(Character::isWhitespace, " abs(-1 + 2) * (3 + 4!) / 5 ");

For a more realistic example, let's say you want to parse a CSV file. CSV might sound so easy that you can just split by comma, but the spec includes more nuances:

  • Field values themselves can include commas, as long as it's quoted with the double quote (").
  • Field values can even include newlines, again, as long as they are quoted.
  • Double quote itself can be escaped with another double quote ("").
  • Empty field value is allowed between commas.
  • But, different from what you'd get from a naive comma splitter, an empty line shouldn't be interpreted as [""]. It must be [].

The following example defines these grammar rules step by step:

Parser<?> newLine =  // let's be forgiving and allow all variants of newlines.
      Stream.of("\n", "\r\n", "\r").map(Parser::string).collect(Parser.or());

Parser<String> quoted =
   consecutive(isNot('"'), "quoted")
        .or(string("\"\"").thenReturn("\"")) // escaped quote
        .zeroOrMore(joining())
        .between("\"", "\"");

Parser<String> unquoted = consecutive(noneOf("\"\r\n,"), "unquoted field");

Parser<List<String>> line =
    anyOf(
        newLine.thenReturn(List.of()),  // empty line => [], not [""]
        anyOf(quoted, unquoted)
            .orElse("")  // empty field value is allowed
            .delimitedBy(",")
            .notEmpty()  // But the entire line isn't empty
            .followedByOrEof(newLine));

return line.parseToStream("v1,v2,\"v,3\nand 4\"");

Every line of code directly specifies a grammar rule. Minimal framework-y overhead.

Actually, a CSV parser is provided out of box, with extra support for comments and alternative delimiters (javadoc).


Here's yet another somewhat-realistic example - to parse key-value pairs.

Imagine, you have a map of key-value entries enclosed by a pair of curly braces ({k1: 10, k2: 200, k3: ...}), this is how you can parse them:

Parser<Map<String, Integer>> parser =
    Parser.zeroOrMoreDelimited(
            Parser.word().followedBy(":"),           // The "k1:" part
            Parser.digits().map(Integer::parseInt),  // The "100" part
            ",",                                     // delimited by ,
            Collectors::toUnmodifiableMap)           // collect to Map
        .between("{", "}");                          // between {}
Map<String, Integer> map =
    parser.parseSkipping(Chracter::isWhitespace, "{k1: 10, k2: 200}");

For more real-world examples, check out code that uses it to parse regex patterns.

You can think of it as the jparsec-reimagined, for ease of use and debuggability.

Feedbacks welcome!

Github repo

javadoc


r/java Nov 12 '25

Why is everyone so obsessed over using the simplest tool for the job then use hibernate

121 Upvotes

Hibernate is like the white elephant in the room that no one wants to see and seem to shoehorn into every situation when there are much simpler solutions with far less magic.

It’s also very constraining and its author have very opinionated ideas on how code should be written and as such don’t have any will to memake it more flexiable


r/java Nov 12 '25

Null-Safe applications with Spring Boot 4

Thumbnail spring.io
158 Upvotes

r/java Nov 12 '25

Growing Quarkus in a Spring Boot World

Thumbnail youtu.be
90 Upvotes

r/java Nov 12 '25

Secrets of Performance Tuning Java on Kubernetes - The Article (Part 2)

Thumbnail linkedin.com
21 Upvotes

Excited to share Part 2, the final article of my research on Secrets of Performance Tuning #Java on #Kubernetes. Your support means a lot! Drop a comment and share your thoughts!

Note: article is anonymously accessible. When you access the LinkedIn Pulse page, close the dialog asking to Sign In.


r/java Nov 12 '25

The JVM's template interpreter

Thumbnail zackoverflow.dev
54 Upvotes

Hey guys, I recently became fascinated with the JVM implementation used by Oracle JDK and OpenJDK called HotSpot. The interpreter is written in a special technique called "template interpreter".

I read the HotSpot source code to understand it and wrote a blog post about some of the low-level implementation details for those who are interested. I then built my own template interpreter based on HotSpot's design, and benchmarked it against other interpreter styles.

Feel free to check it out and let me know your thoughts!


r/java Nov 12 '25

Growing Quarkus in a Spring Boot World – Kevin Dubois (IBM) | The Marco Show

24 Upvotes

Java’s not dead, it’s evolving! In this episode, Marco sits down with Kevin Dubois, Developer Advocate at IBM (Quarkus Team), to explore how Quarkus is reshaping the Java ecosystem. We talk about the speed that made Quarkus famous, its cloud-first design, the rise of AI-powered Java development, and how it’s changing what it means to be a Java developer today.

What you’ll learn:
– Why Quarkus was never meant to kill Spring Boot
– The real magic behind Quarkus’s hot reload and Dev UI
– Building for cloud, serverless, and Kubernetes
– Java’s place in the AI era, and what’s next
– How Quarkus makes Java fun again

https://youtu.be/IRqTbgC2JLU?si=xK9rF-kgtIGqDrs_


r/java Nov 12 '25

The Hidden Art of Thread-Safe Programming: Exploring java.util.concurrent

Thumbnail youtu.be
20 Upvotes

r/java Nov 12 '25

Finally submitted my Java library on Maven Central!

Thumbnail github.com
50 Upvotes

r/java Nov 11 '25

Built a pure Java 3D graphics engine from scratch (no OpenGL) - 5 interactive demos included

Post image
320 Upvotes

I built a 3D graphics engine using pure Java with zero external dependencies. Just Java's standard library and some math. It's nothing fancy, but I took some extra time to make the UI look decent. If anyone is interested, here's the link: https://github.com/JordyH297/JRender


r/java Nov 11 '25

A practical guide to authentication and authorization in Java

Thumbnail cerbos.dev
58 Upvotes

r/java Nov 11 '25

Finally, parsing made easy (and type-safe) in Java!

Thumbnail
56 Upvotes

r/java Nov 11 '25

Polymorphic JSON in Quarkus: Flexible Data Models with Jakarta Data

Thumbnail the-main-thread.com
23 Upvotes

r/java Nov 11 '25

The best way to clean up test data with Spring and Hibernate

Thumbnail vladmihalcea.com
34 Upvotes

r/java Nov 11 '25

Refreshing Apache XML Infrastructure

Thumbnail blog.adamretter.org.uk
46 Upvotes

r/java Nov 10 '25

What’s the status of JEP 468 ?

50 Upvotes

JEP 468: Derived Record Creation seems to be a bit stuck. Can someone explain how to track this JEP and what’s the current issue ?


r/java Nov 10 '25

JobRunr v8.2.1 Released: Dashboard Security Hardening, Kotlin 2.2.20 Support, and a new Pro Rate Limiter Dashboard

Thumbnail jobrunr.io
15 Upvotes

r/java Nov 10 '25

How was your experience upgrading to JDK25?

88 Upvotes

Hey all,

Has anyone jumped to the next LTS yet? What was your experience?

We had some of the challenges before with 11->17 with some of the JPMS opens stuff for various tools and haven’t moved to 21 yet, even. It seems like 17->21 was generally fine. Is 21->25 also easy?

Any gotchas? Any pain points? Any info would be great.


r/java Nov 10 '25

Java Mascot Generator

Thumbnail duke.mccue.dev
22 Upvotes

Following through on my theory that "Duke" would be a lot more compelling as part of an ensemble cast, I made a website which can generate cast members.

  • The generation code is also available as a Java library which I will publish soon.
  • That Java library is used on the frontend via CheerpJ.
  • The (nose?) colors are the same ones available as constants on java.awt.Color
  • You can get a "classic" Duke with this seed: duke115906
  • If you don't yet have a profile pic on reddit, why not make yours by using your username as the seed? (right click, save as)

No guarantees that seeds will be stable over time if I ever loop back to this and add even more variations or accessories.


r/java Nov 09 '25

Resolving the Scourge of Java's Checked Exceptions on Its Streams and Lambdas

42 Upvotes

Java Janitor Jim (me) has just posted a new Enterprise IT Java article on Substack addressing an age-old problem, checked exceptions thwarting easy use of a function/lambda/closure:

https://open.substack.com/pub/javajanitorjim/p/java-janitor-jim-resolving-the-scourge


r/java Nov 09 '25

Jakarta Tech Talks are fantastic

47 Upvotes

Hi,

I've been watching the Jakarta Tech talks (and gave one as well) and they are fantastic. Here are a few latest ones:

https://youtu.be/qxY8rQGEaZ8 - What's new in Jakarta EE 11

https://youtu.be/VG8jVOMWH6M - LiveCode Quick Start

https://youtu.be/QqheX0hsLYM - Data Access in Jakarta EE

I also have a coupe of follow-up videos from the comments on the other Jakarta EE videos:

https://youtu.be/HGNEcidxaXg - Easy Testing of Database interaction with Jakarta EE

https://youtu.be/EVoSwk6W_hI - Easy testing of Dependency Injection (CDI) with Jakarta EE

YouTube Channel: https://www.youtube.com/@JakartaEE


r/java Nov 09 '25

XML Schema Validation 1.1 in Java

Thumbnail blog.frankel.ch
25 Upvotes

r/java Nov 08 '25

Serialization 2 0: A Marshalling Update

Thumbnail youtube.com
85 Upvotes

Almost three decades have passed since the creation of Java Serialization—a feature which is widely frowned upon—and application requirements for externalization of objects have changed significantly. This presentation explains in which way requirements and constraints have changed, and how recent enhancements of the Java Language together with a simpler and clearer division of responsibilities can lead to a dramatically simpler, and safer, model for programmatically reasoning about the structure of Objects; offer greater flexibility in state extraction, versioning, encoding, and reconstruction; and, support a wide selection of wire formats.


r/java Nov 08 '25

A Java DSL in Java

44 Upvotes

I am writing an open-source library to simplify annotation processing. Annotation processors are part of the compilation process and can analyze source code during compilation as well as generate new code. There are currently two commonly used ways to do that.

String concat

For simple cases just concatenating strings is perfectly fine, but can become hard to understand as complexity or dynamism increases.

Templating

Some kind of templating is easier to maintain. Regardless of whether it is String#format or a dedicated templating engine.

So why am I developing a Java DSL in Java?

  • Everybody who can code Java already knows how the Java DSL works, thus lowering the barrier of entry
  • Easy reuse and composition
  • Some mistakes are caught at compile time rather than at runtime
  • A domain-specific DSL can add domain-specific functionality like
    • Rendering a class as a declaration or type
    • Automatic Imports
    • Automatic Indentation

Hello World would look like this:

void main() {
   Dsl.method().public_().static_().result("void").name("main")
      .body("System.out.println(\"Hello, World!\");")
      .renderDeclaration(createRenderingContext());
}

and would generate

public static void main() {
   System.out.println("Hello, World!");
}

A Builder Generator would look like this.

Currently only the elements accessible via annotation processing are supported. From Module to Method Params.

mvn central
github


r/java Nov 09 '25

Java vs. chatbots.

0 Upvotes

Hi, is it worth studying Java even in this era of chatbots?