While adding syntax highlighting for underscores and binary literals introduced in Java 7 to DrJava, I discovered that a few other numbers aren’t syntax-highlighted correctly. Some of these problems go back to the beginning of Java, others go back to Java 5, when the obscure hexadecimal floating-point literal was introduced.
Here are the numbers that give DrJava’s syntax highlighter trouble:
[cc lang=”java”]float f = 6.022137e+23f;
f = 2.f;
f = .3f;
double d = 2.;
d = .3;
d = 1e-9d;
double x = 0x1.8p1;
x = 0x1.fffffffffffffp1023;
x = 0x1.0P-1074;
x = 0x0.0000000000001P-1022;[/cc]
Did you know about these hexadecimal floating-point literals? I didn’t.
I created a bug report for these Java 5 highlighting bugs.
References: