Community
Participate
Working Groups
RC1 We have a problem in the evaluation engine with octal escape sequences (bug 32894), the problem seems to be the result of an error in StringLiteral#getLiteralValue(). The implementation manages only octal escape sequences with 1 digit. I corrected it in my workspace (see the attachment).
Created attachment 3751 [details] StringLiteral.java a corrected version of StringLiteral
I prefer this code. It simplifies quite a bit the existing code. public String getLiteralValue() { String s = getEscapedValue(); int len = s.length(); if (len < 2 || s.charAt(0) != '\"' || s.charAt(len-1) != '\"' ) { throw new IllegalArgumentException(); } Scanner scanner = getAST().scanner; char[] source = s.toCharArray(); scanner.setSource(source); scanner.resetTo(0, source.length); try { int tokenType = scanner.getNextToken(); switch(tokenType) { case Scanner.TokenNameStringLiteral: return new String(scanner.getCurrentTokenSourceString()); default: throw new IllegalArgumentException(); } } catch(InvalidInputException e) { throw new IllegalArgumentException(); } } Could you please confirm it works in your workspace? I added regression tests on the ASTConverter tests and they are all green.
Works like a charm.
Ok for releasing
Fixed and released in 2.1 stream. Regression test added.
Verified by Luc.