Name: yyT116575 Date: 11/08/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
In the documentation for Character.isIdentifierIgnorable, it lists various
characters that "should be regarded as an ignorable character in a
Java identifier." The JLS mentions nothing about this - does this mean that the
two identifiers "foo" and "foo\ufeff" are identical, since the \ufeff is
ignorable? The JDK 1.3 javac compiler does not seem to believe so, and treats
them as different identifiers.
More importantly, the javac compiler rejects the null character as part of an
identifier name, which is wrong according to this method, since
Character.isIdentifierIgnorable('\u0000'); returns true.
Try to compile the following:
class NullBug {
public static void main(String[] args) {
int i\u0000 = 1;
System.out.print(i\u0000);
}
}
NullBug.java:3: illegal character: \0
int i\u0000 = 1;
^
NullBug.java:4: illegal character: \0
System.out.print(i\u0000);
^
(Review ID: 111807)
======================================================================
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
In the documentation for Character.isIdentifierIgnorable, it lists various
characters that "should be regarded as an ignorable character in a
Java identifier." The JLS mentions nothing about this - does this mean that the
two identifiers "foo" and "foo\ufeff" are identical, since the \ufeff is
ignorable? The JDK 1.3 javac compiler does not seem to believe so, and treats
them as different identifiers.
More importantly, the javac compiler rejects the null character as part of an
identifier name, which is wrong according to this method, since
Character.isIdentifierIgnorable('\u0000'); returns true.
Try to compile the following:
class NullBug {
public static void main(String[] args) {
int i\u0000 = 1;
System.out.print(i\u0000);
}
}
NullBug.java:3: illegal character: \0
int i\u0000 = 1;
^
NullBug.java:4: illegal character: \0
System.out.print(i\u0000);
^
(Review ID: 111807)
======================================================================