changeset 55918:2a9278e24bc3 string-tapas

Remove references to \<WhiteSpace>
author jlaskey
date Wed, 08 May 2019 14:05:54 -0300
parents 67f14114d955
children 36fa96af83f7
files src/java.base/share/classes/java/lang/String.java src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java test/jdk/java/lang/String/TranslateEscapes.java test/langtools/tools/javac/MultilineStringLiteralLang.java
diffstat 4 files changed, 1 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/String.java	Wed May 08 12:16:40 2019 -0300
+++ b/src/java.base/share/classes/java/lang/String.java	Wed May 08 14:05:54 2019 -0300
@@ -3056,16 +3056,6 @@
      *     <td>octal escape</td>
      *     <td>code point equivalents</td>
      *   </tr>
-     *   <tr>
-     *     <td>{@code \u005C<space>}</td>
-     *     <td>continue after here</td>
-     *     <td>consumes prior white space</td>
-     *   </tr>
-     *   <tr>
-     *     <td>{@code \u005C<lineterminator>}</td>
-     *     <td>continue on next line</td>
-     *     <td>consumes line terminator</td>
-     *   </tr>
      * </table>
      * <p>
      * Octal escapes \u005C0 - \u005C377 are translated to their code
@@ -3089,7 +3079,6 @@
         int length = chars.length;
         int from = 0;
         int to = 0;
-        int whitespaceStart = 0;
         while (from < length) {
             char ch = chars[from++];
             if (ch == '\\') {
@@ -3137,27 +3126,11 @@
                     }
                     ch = (char)code;
                     break;
-                case ' ':
-                    to = whitespaceStart;
-                    continue;
-                case '\n':
-                    whitespaceStart = to;
-                    continue;
-                case '\r':
-                    if (from < length && chars[from] == '\n') {
-                        from++;
-                    }
-                    whitespaceStart = to;
-                    continue;
                 default:
                     throw new MalformedEscapeException(from);
                 }
             }
 
-            if (ch == '\n' || ch == '\r' || !Character.isWhitespace(ch)) {
-                whitespaceStart = to + 1;
-            }
-
             chars[to++] = ch;
         }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed May 08 12:16:40 2019 -0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed May 08 14:05:54 2019 -0300
@@ -240,9 +240,6 @@
                 case '\'':
                 case '\"':
                 case '\\':
-                case ' ':
-                case '\n':
-                case '\r':
                     reader.putChar(true); break;
                 default:
                     lexError(reader.bp, Errors.IllegalEscChar);
--- a/test/jdk/java/lang/String/TranslateEscapes.java	Wed May 08 12:16:40 2019 -0300
+++ b/test/jdk/java/lang/String/TranslateEscapes.java	Wed May 08 14:05:54 2019 -0300
@@ -30,7 +30,6 @@
 public class TranslateEscapes {
     public static void main(String... arg) {
         test1();
-        test2();
     }
 
     /*
@@ -47,15 +46,6 @@
         verifyEscape("\\", '\\');
     }
 
-    /*
-     * Continuation escapes.
-     */
-    static void test2() {
-        verifyContinue("   abc\\\n   def", "   abc   def");
-        verifyContinue("   abc\\n   \\ def", "   abc\ndef");
-        verifyContinue("   abc\\\n   \\ def", "   abcdef");
-    }
-
     static void verifyEscape(String string, char ch) {
         String escapes = "\\" + string;
         if (escapes.translateEscapes().charAt(0) != ch) {
@@ -63,11 +53,4 @@
             throw new RuntimeException();
         }
     }
-
-    static void verifyContinue(String a, String b) {
-        if (!a.translateEscapes().equals(b)) {
-            System.err.format("\"%s\" not equal \"%s\"%n", a, b);
-            throw new RuntimeException();
-        }
-    }
 }
--- a/test/langtools/tools/javac/MultilineStringLiteralLang.java	Wed May 08 12:16:40 2019 -0300
+++ b/test/langtools/tools/javac/MultilineStringLiteralLang.java	Wed May 08 14:05:54 2019 -0300
@@ -42,13 +42,7 @@
      * Test basic string functionality.
      */
     static void test1() {
-        EQ("""
-            abc\
-            """, "abc");
-        EQ("""
-            \
-            """, "");
-        EQ("""
+         EQ("""
             abc
             """, "abc\n");
         EQ("""