Summary: | Scanner#getNextToken() behavior doesn't seems consistent if there is an unicode inside a string. | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | David Audel <david_audel> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | philippe_mulet |
Version: | 3.2 | ||
Target Milestone: | 3.2 M3 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
David Audel
2005-10-11 11:06:20 EDT
I found a visible bug. With "a\u000Da" the end of the error is just before 'D' and if the string start with an unicode ("\u004Ca\u000Da") the end of the error is at '"'. In fact the problem is worth than that. public class X { public static void main(String[] args) { System.out.println("\u004Ca\u000D"); } } Return a string literal not properly closed by a double-quote where I would expect an error about an illegal character in a string literal. In fact we convert the INVALID_CHAR_IN_STRING in an unterminated string error. I would rather like to locate the invalid character in the string literal. We could then get rid of the lookahead and report the error only against the invalid character. When we hightlight the whole string literal, we don't help the user to locate the error. Philippe, any thought? I do have a fix for the problem reported in comment 1. Fixed and released in HEAD. Regression tests added in org.eclipse.jdt.core.tests.compiler.regression.ScannerTest.test042/43/44. Fixed in both PublicScanner and internal scanner. See bug 112246 for error reporting inside string literals. Verified for 3.2 M3 using build I20051102-1600. |