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

Invalid unicode escape in comments causes bogus compiler error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.0.2, 1.1.6, 6
    • tools
    • None
    • x86, sparc
    • solaris_2.5.1, windows_95, windows_xp

      From: Santhosh.Nair@Ebay (Santhosh Nair)
      Subject: Unicode chars inside comments
      To: ###@###.###
      Cc: Santhosh.Nair@Ebay
      Date: Sat, 19 Jul 1997 15:53:15 -0700
       
       
      This could be something silly (but interesting) ...
       
      If inside a comment (either /*..*/ or //.. comments) there is
      an invalid unicode character, I found that the compiler will
      flag an error saying "Invalid escape character" (but will make
      the .class file).
       
      As an example if I have a file named Foo.java which is something like
       
      /* \u02 */
      public class Foo {
       
              // for the sake of simplicity this is kept empty
      }
       
      When I say javac Foo.java ...
       
      Foo.java:1: Invalid escape character.
      /* \u02 */
         ^
      1 error
       
      Any way Foo.class file is made, so we are not stuck with this error.
       
      Looks like javac processes unicode chars even before stripping off the
      comments. But why does the compiler care for something inside a
      comment block ?
       
      Comments/Explanations ...
       
      SANTHOSH

            dstoutamsunw David Stoutamire (Inactive)
            apalanissunw Anand Palaniswamy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: