FULL PRODUCT VERSION :
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
(Same bug produced on J2SE 1.4.1 also)
ADDITIONAL OS VERSION INFORMATION :
OS Name Microsoft Windows XP Professional
Version 5.1.2600 Service Pack 2 Build 2600
(Processor: x86 Family 15 Model 2 Stepping 4 GenuineIntel ~2200 Mhz)
A DESCRIPTION OF THE PROBLEM :
char char1 = '\u000'; is an illegal statement and it produces four compiler errors when compiles.
It is illegal because missing one hexadecimal literal in the unicode notation. So far OK.
But if try to comment out the above statement as any of the following ways;
(1)
// char char1 = '\u000';
(2)
/*
* char char1 = '\u000';
*/
(3)
/**
* char char1 = '\u000';
*/
All of them produces compiler error.
Why can't I comment out the statement as above without any problem?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. javac Test1.java
2. java Test1
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
While compiling Test1.java with comment statements (1) or (2) or (3) shouldn't produce any comiler error.
ACTUAL -
(1)
// char char1 = '\u000';
ON COMPILING Test1.java PRODUCES;
C:\Documents and Settings\Owner\Desktop\j2se bugs\bug1>javac Test1.java
Test1.java:10: illegal unicode escape
// char char1 = '\u000';
^
1 error
C:\Documents and Settings\Owner\Desktop\j2se bugs\bug1>
(2)
/*
* char char1 = '\u000';
*/
ON COMPILING Test1.java PRODUCES;
C:\JavaStudyHP_LT\j2se_bugs\bug2>javac Test1.java
Test1.java:8: illegal unicode escape
* char char1 = '\u000';
^
1 error
C:\JavaStudyHP_LT\j2se_bugs\bug2>
(3)
/**
* char char1 = '\u000';
*/
ON COMPILING Test1.java PRODUCES;
C:\JavaStudyHP_LT\j2se_bugs\bug2>javac Test1.java
Test1.java:8: illegal unicode escape
* char char1 = '\u000';
^
1 error
C:\JavaStudyHP_LT\j2se_bugs\bug2>
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//Test1.java
public class Test1 {
public static void main(String[] args) {
//add comment statement/s (1) or (2) or (3) mentioned below here
}
}
(1)
// char char1 = '\u000';
(2)
/*
* char char1 = '\u000';
*/
(3)
/**
* char char1 = '\u000';
*/
---------- END SOURCE ----------
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
(Same bug produced on J2SE 1.4.1 also)
ADDITIONAL OS VERSION INFORMATION :
OS Name Microsoft Windows XP Professional
Version 5.1.2600 Service Pack 2 Build 2600
(Processor: x86 Family 15 Model 2 Stepping 4 GenuineIntel ~2200 Mhz)
A DESCRIPTION OF THE PROBLEM :
char char1 = '\u000'; is an illegal statement and it produces four compiler errors when compiles.
It is illegal because missing one hexadecimal literal in the unicode notation. So far OK.
But if try to comment out the above statement as any of the following ways;
(1)
// char char1 = '\u000';
(2)
/*
* char char1 = '\u000';
*/
(3)
/**
* char char1 = '\u000';
*/
All of them produces compiler error.
Why can't I comment out the statement as above without any problem?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. javac Test1.java
2. java Test1
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
While compiling Test1.java with comment statements (1) or (2) or (3) shouldn't produce any comiler error.
ACTUAL -
(1)
// char char1 = '\u000';
ON COMPILING Test1.java PRODUCES;
C:\Documents and Settings\Owner\Desktop\j2se bugs\bug1>javac Test1.java
Test1.java:10: illegal unicode escape
// char char1 = '\u000';
^
1 error
C:\Documents and Settings\Owner\Desktop\j2se bugs\bug1>
(2)
/*
* char char1 = '\u000';
*/
ON COMPILING Test1.java PRODUCES;
C:\JavaStudyHP_LT\j2se_bugs\bug2>javac Test1.java
Test1.java:8: illegal unicode escape
* char char1 = '\u000';
^
1 error
C:\JavaStudyHP_LT\j2se_bugs\bug2>
(3)
/**
* char char1 = '\u000';
*/
ON COMPILING Test1.java PRODUCES;
C:\JavaStudyHP_LT\j2se_bugs\bug2>javac Test1.java
Test1.java:8: illegal unicode escape
* char char1 = '\u000';
^
1 error
C:\JavaStudyHP_LT\j2se_bugs\bug2>
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//Test1.java
public class Test1 {
public static void main(String[] args) {
//add comment statement/s (1) or (2) or (3) mentioned below here
}
}
(1)
// char char1 = '\u000';
(2)
/*
* char char1 = '\u000';
*/
(3)
/**
* char char1 = '\u000';
*/
---------- END SOURCE ----------
- duplicates
-
JDK-4065903 Invalid unicode escape in comments causes bogus compiler error
-
- Closed
-