Multiline string literals

Peter Reilly peter.kitt.reilly at gmail.com
Sat Aug 6 03:41:05 PDT 2011


Now that jdk7 is released and there will shortly be a process for
asking for new small features in jdk8, I would like to ask that
support for multiline string literals be considered.

This is a long standing request and a specific proposal is contained in:

http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000087.html

An example of the current mess is in:

http://blog.voidsearch.com/bigdata/apache-avro-in-practice/

 String schemaDescription =
            " {    \n" +
                    " \"name\": \"FacebookUser\", \n" +
                    " \"type\": \"record\",\n" +
                    " \"fields\": [\n" +
                    "   {\"name\": \"name\", \"type\": \"string\"},\n" +
                    "   {\"name\": \"num_likes\", \"type\": \"int\"},\n" +
                    "   {\"name\": \"num_photos\", \"type\": \"int\"},\n" +
                    "   {\"name\": \"num_groups\", \"type\": \"int\"} ]\n" +
                    "}";

it would be *much* nicer to say:
 String schemaDescription = """{
                    "name": "FacebookUser",
                    "type": "record",
                    "fields": [
                    {"name": "name", "type": "string"},
                    {"name": "num_likes", "type": "int\"},
                    {"name": "num_photos", "type": "int"},
                    {"name": "num_groups", "type": "int"} ]
                    }""";

Peter



More information about the coin-dev mailing list