Community
Participate
Working Groups
In JLS decimal integer literals consist of only 0, 1, 2,... and 9. But JDT compiler also allows FULL WIDTH digits(U+FF10...U+FF19).
Please provide a testcase.
Created attachment 12962 [details] An example of integer literal which JLS does not allow This code, which Eclipse 3.0(Build 200406251208) compiles without complaining anything, should not be compiled, because decimal literals(10) are written in full width digits(U+FF10..U+FF19) while JLS(Java Language Specification) specifies decimal integer literals only consists of 0..9. [http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282] Full width digits appear in JIS(Japanese Industrial Standards) X 0208 and adopted into Unicode for compatibility use only. Character.isDigit returns true for these digits.
We use Character.isDigit(...) to find out if we have a digit. I will double-check the specs.
We should replace all calls to Character.isDigit with the following code: private boolean isDigit(char c) throws InvalidInputException { if (Character.isDigit(c)) { switch(c) { case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : return true; } throw new InvalidInputException(Scanner.INVALID_DIGIT); } else { return false; } }
Fixed and released in HEAD.
Regression test added.
Should address in 3.0.1 stream as well.
The fix is ready to be released in the 3_0_maintenance. In 3.0.1, the error will be an invalid input. In 3.1, it will be an invalid digit.
Fixed and released in 3_0_maintenance. Regression test added.
Verified for 3.0.1 RC1