Home » Java » Core Java » Restarting Java’s Raw String Literals Discussion

About Dustin Marx

Dustin Marx

Restarting Java’s Raw String Literals Discussion

It was announced in December 2018 that raw string literals would be dropped from JDK 12. Now, in the new year, discussion related to the design of raw string literals in Java has begun again.

In the post “Raw string literals — restarting the discussion” on the amber-spec-experts OpenJDK mailing list, Brian Goetz references the explanation for dropping raw string literals preview feature from JDK 12 and suggests “restart[ing] the design discussion.” Goetz summarizes the previous design discussions and decisions and lessons learned from the first take on raw string literals, discusses some design questions and trade-offs to be made, and then calls for input on three specific types of observation data:

  • “Data that supports or refutes the claim that our primary use cases are embedded JSON, HTML, XML, and SQL.”
  • “Use cases we’ve left out…”
  • “Data (either Java or non-Java) on the use of various flavors of strings (raw, multi-line, etc) in real codebases…”

Jim Laskey posted two messages with the title “Enhancing Java String Literals Round 2” to the same amber-spec-experts mailing list and references an HTML version and a PDF version of an “RTL2” document that aids in the discussion of “Take Two” of raw string literals. Laskey outlines a “series of critical decision points that should be given thought, if not answers, before we propose a new design.”

A few of the major decisions to be made as raw string literals for Java are reconsidered include these discussed in the aforementioned posts are listed here, but many more are contained in the posts:

  • Which is really more important to developers: “raw text” or “multi-line strings”?
  • Which character makes for the best delimiter for most Java developers and Java use cases?
  • How should incidental spacing be handled?

There has already been some feedback on the amber-dev OpenJDK mailing listStephen Colebourne provides “Extended string literals feedback” and Bruno Borges recommends “special assignment rather [than] special delimiters.”

I often see developers complaining about certain language and API decisions after the decisions have been implemented. For anyone with strong feelings about the subject of raw string literals and multi-line strings in Java, now is an opportunity to make one’s voice heard and to possibly influence the final design that will come to Java at some point in the future.

Published on Java Code Geeks with permission by Dustin Marx, partner at our JCG program. See the original article here: Restarting Java’s Raw String Literals Discussion

Opinions expressed by Java Code Geeks contributors are their own.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of