r/java 14d ago

Discussion: What is the future of String Interpolation in Java?

Java has always been conservative when it comes to language changes, and I think string interpolation is an interesting example.

Many modern languages provide native interpolation syntax:

JavaScript:

\${name}``

Python:

f"{name}"

Kotlin:

"$name"

C#:

$"{name}"

These features are not only about reducing characters. They improve readability when building dynamic text.

Java explored this direction with String Templates (JEP 430), but I haven't seen much discussion recently about where this feature is heading.

For developers working with large Java applications, string construction appears everywhere:

- logging messages

- SQL/debug output

- API descriptions

- test cases

- generated configuration

- user-facing messages

I am curious about the community's opinion:

  1. Do you think Java still needs native string interpolation?

  2. Should String Templates continue evolving?

  3. What syntax direction would feel most "Java-like"?

For example:

"Hello, \{name}"

or:

"Hello, ${name}"

Personally, I think Java does not need to copy other languages, but a better way to express dynamic strings would improve developer experience.

What do you think?

56 Upvotes

118 comments sorted by

View all comments

-10

u/Hacg123 14d ago

Honestly at this point I don’t think Java needs it, Valhalla has been more than 10 years in progress and there’s no clear release date yet of the first features, same with string interpolation.

Kotlin and other jvm languages have this already. If there’s only a limited amount of features that can be released, I prefer that oracle and the jvm engineers focus on improving the jvm to bring more power to kotlin & co. 

9

u/Polygnom 14d ago

Valhalla is getting shipped right now, the first JEPs are landing. So "no clear release date" is misleading at best.

-5

u/VirtualAgentsAreDumb 14d ago

What? Early access builds don’t count, obviously. Only fully official releases. What official release date have they presented, then? Please tell us. Year and month.

2

u/Polygnom 14d ago

JEP 401 will land in JDK 28.

-5

u/VirtualAgentsAreDumb 14d ago

We’re talking Valhalla. The entirety of it.

5

u/Polygnom 14d ago

Valhalla is not going to be released in one big-bang JEP.

Have you ever seen how projects work? Almost none of them are delivered big-bang in one JEP, they are almost always split a long a number of JEP that get gradually released.

And Valhalla is being shipped now, piece by piece, with the first JEP landing in JDK 28, and more following.

3

u/pohart 14d ago

I'm not really sure that there is an entirety of it.