Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1258382

wrong parse of backslash and Unicode escape combination in string literals

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      generic

      Description



      Name: ###@###.### Date: 07/09/96

      Compilation of the test below is failed because of wrong parse
      of backslash and Unicode escape combination in string literals:

      Test:
      -----

      // Ident: @(#)lex002.java 1.1 96/07/09
      // Copyright 09 ÉÀÌ 1996 Sun Microsystems, Inc. All Rights Reserved

      package javasoft.sqe.tests.java_spec.lex002;
      import java.io.PrintStream;
       
      // \\ and Unicode escapes in string literals.

      class lex002 {
      public static void main (String args []) {
      System.exit(run(args,System.out));
      }

      public static int run(String args[],PrintStream out) {
        String str [] = {"\\\\u005c", "\\\\"
        };
        for (int i = 0; i <= 1; i++) out.println (str [i]);
        if (str[0].equals(str[1]))
          return 0;
        else
          return 2;
      }}

      The error is that Unicode escape \\u005c after backslash is
      not translated to the corresponding Unicode character \\.
      See the section 3.2 Lexical Translations in the Java Language
      Specification.

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            fyellinsunw Frank Yellin (Inactive)
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: