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

Character constant allows unquoted single quotes.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 1.1.8
    • 1.1.8
    • tools
    • x86
    • linux

      The following code will compile with javac and run:

      public class Foo {
      char c1 = '''; # Works, although it should not.
      char c2 = '\'';

      public static void main(String args[]) {
      Foo f = new Foo();
      System.out.println("The first char is (" + f.c1 +
      ") and the second is (" + f.c2 + ").");
      }
      }

      Obviously, it's a coding mistake for the developer to do this at all.
      But this version of the the javac parser does not catch it.
      ###@###.### 10/19/04 19:24 GMT

            Unassigned Unassigned
            mmma Marvin Ma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: