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
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
- duplicates
-
JDK-7057717 can’t comment out the illegal statement; char char1 = '\u000';
-
- Closed
-