-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
11, 12, 13
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
The Unicode superscript 2 character (², U+00B2) is classified as a "Number" from what I can tell. As such should it not be possible to have it be part of a Java identifier? It would make it a bit nicer to write code like:
double cos²_a = Math.pow(Math.cos(a), 2);
For long, complex formulas it certainly improves readability. Sadly the latest Java compiler indicates this is an invalid character:
error: illegal character: '\u00b2'
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile source code with a local identifier including the U+00B2 character.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
As long as it is not the leading character it should be considered part of a Java identifier.
ACTUAL -
The compiler errors out.
CUSTOMER SUBMITTED WORKAROUND :
Use "2" in identifiers.
The Unicode superscript 2 character (², U+00B2) is classified as a "Number" from what I can tell. As such should it not be possible to have it be part of a Java identifier? It would make it a bit nicer to write code like:
double cos²_a = Math.pow(Math.cos(a), 2);
For long, complex formulas it certainly improves readability. Sadly the latest Java compiler indicates this is an invalid character:
error: illegal character: '\u00b2'
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile source code with a local identifier including the U+00B2 character.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
As long as it is not the leading character it should be considered part of a Java identifier.
ACTUAL -
The compiler errors out.
CUSTOMER SUBMITTED WORKAROUND :
Use "2" in identifiers.
- relates to
-
JDK-8229831 Upgrade Character.isUnicodeIdentifierStart/Part() methods to the latest standard
-
- Resolved
-