EA-34240 - SIOOBE: CompileTimeConstantResolver.getCharValue
This commit is contained in:
+2
-2
@@ -182,11 +182,11 @@ public class CompileTimeConstantResolver {
|
||||
}
|
||||
|
||||
// Strip the quotes
|
||||
if (text.charAt(0) != '\'' || text.charAt(text.length() - 1) != '\'') {
|
||||
if (text.length() < 2 || text.charAt(0) != '\'' || text.charAt(text.length() - 1) != '\'') {
|
||||
return new ErrorValue("Incorrect character literal");
|
||||
}
|
||||
text = text.substring(1, text.length() - 1); // now there're no quotes
|
||||
|
||||
|
||||
if (text.length() == 0) {
|
||||
return new ErrorValue("Empty character literal");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
fun test(<!UNUSED_PARAMETER!>c<!> : Char) {
|
||||
test(<!ERROR_COMPILE_TIME_VALUE!>''<!>)
|
||||
test('a')
|
||||
test(<!ERROR_COMPILE_TIME_VALUE!>'aa'<!>)
|
||||
test(<!ERROR_COMPILE_TIME_VALUE!>'a)<!>
|
||||
<!UNRESOLVED_REFERENCE!>test<!>(<!ERROR_COMPILE_TIME_VALUE!>'<!>
|
||||
<!UNRESOLVED_REFERENCE!>test<!>(0<!SYNTAX!><!SYNTAX!><!>'<!>
|
||||
test('\n')
|
||||
test('\\')
|
||||
test(<!ERROR_COMPILE_TIME_VALUE!>''<!><!SYNTAX!>''<!><!SYNTAX!>)<!>
|
||||
test('\'')
|
||||
test('\"')
|
||||
}
|
||||
Reference in New Issue
Block a user