mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8048805: Request to investigate and update lexer error recovery in javac
8046620: Further investigation needed for few error messages for negative unicode tests in langtools regression ws 8048803: javac should report complete character code in the error messages Improving error reporting and recovery in the lexer Co-authored-by: Sonali Goel <sonali.goel@oracle.com> Reviewed-by: jjg, mcimadamore
This commit is contained in:
parent
47692bbf7e
commit
eb1f1c05ed
15 changed files with 84 additions and 107 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4707960 6183529
|
||||
* @bug 4707960 6183529 8046620
|
||||
* @summary javac accepts unicode digits - sometimes crashing
|
||||
* @author gafter
|
||||
*
|
||||
|
@ -8,7 +8,16 @@
|
|||
*/
|
||||
public class NonasciiDigit {
|
||||
public static void main(String[] args) {
|
||||
// error: only ASCII allowed in constants
|
||||
int i1 = \uff11;
|
||||
int i2 = 1\uff11;
|
||||
int i3 = \ud835\udfff;
|
||||
// error: floating literals use ascii only
|
||||
float f = 0.\uff11;
|
||||
double d1 = \uff11.0;
|
||||
double d2 = 0.\uff11;
|
||||
double d3 = 0x0P\uff11;
|
||||
double d4 = 0E\uff11;
|
||||
double d5 = .\uff11;
|
||||
double d6 = \ud835\udfff.0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,10 @@
|
|||
NonasciiDigit.java:12:26: compiler.err.illegal.char: \uff11
|
||||
1 error
|
||||
NonasciiDigit.java:12:24: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:13:19: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:14:24: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:16:27: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:17:22: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:18:22: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:19:22: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:20:22: compiler.err.illegal.nonascii.digit
|
||||
NonasciiDigit.java:21:27: compiler.err.illegal.nonascii.digit
|
||||
9 errors
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4707960 6183529
|
||||
* @summary javac accepts unicode digits - sometimes crashing
|
||||
* @author gafter
|
||||
*
|
||||
* @compile/fail/ref=NonasciiDigit2.out -XDrawDiagnostics NonasciiDigit2.java
|
||||
*/
|
||||
public class NonasciiDigit2 {
|
||||
public static void main(String[] args) {
|
||||
// error: only ASCII allowed in constants
|
||||
int i = 1\uff11;
|
||||
}
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
NonasciiDigit2.java:12:18: compiler.err.illegal.nonascii.digit
|
||||
1 error
|
|
@ -1,3 +1,4 @@
|
|||
SupplementaryJavaID2.java:12:14: compiler.err.illegal.char: \ud801
|
||||
SupplementaryJavaID2.java:12:20: compiler.err.illegal.char: \ud801
|
||||
SupplementaryJavaID2.java:12:24: compiler.err.expected: token.identifier
|
||||
2 errors
|
||||
3 errors
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
SupplementaryJavaID3.java:12:17: compiler.err.illegal.char: \ud801
|
||||
SupplementaryJavaID3.java:12:23: compiler.err.illegal.char: \ud801
|
||||
1 error
|
||||
2 errors
|
||||
|
|
|
@ -1,35 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4914724
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4914724 8048803
|
||||
* @summary Ensure that a supplementary character that cannot be the start of a Java
|
||||
* identifier causes a compilation failure, if it is used as the start of an
|
||||
* identifier
|
||||
* @author Naoto Sato
|
||||
*
|
||||
* @compile/fail SupplementaryJavaID4.java
|
||||
* @compile/fail/ref=SupplementaryJavaID4.out -XDrawDiagnostics SupplementaryJavaID4.java
|
||||
*/
|
||||
|
||||
public class SupplementaryJavaID4 {
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
SupplementaryJavaID4.java:14:14: compiler.err.illegal.char: \ud834\udd7b
|
||||
1 error
|
|
@ -1,35 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4914724
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4914724 8048803
|
||||
* @summary Ensure that a supplementary character that cannot be the part of a Java
|
||||
* identifier causes a compilation failure, if it is used as the part of an
|
||||
* identifier
|
||||
* @author Naoto Sato
|
||||
*
|
||||
* @compile/fail SupplementaryJavaID5.java
|
||||
* @compile/fail/ref=SupplementaryJavaID5.out -XDrawDiagnostics SupplementaryJavaID5.java
|
||||
*/
|
||||
|
||||
public class SupplementaryJavaID5 {
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
SupplementaryJavaID5.java:14:17: compiler.err.illegal.char: \ud834\udd00
|
||||
1 error
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 1265387
|
||||
* @bug 1265387 8048805
|
||||
* @summary ''' and '\u0027' are not legal char literals.
|
||||
* @author turnidge
|
||||
*
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
TripleQuote.java:12:14: compiler.err.empty.char.lit
|
||||
TripleQuote.java:12:20: compiler.err.empty.char.lit
|
||||
TripleQuote.java:12:21: compiler.err.unclosed.char.lit
|
||||
TripleQuote.java:13:14: compiler.err.empty.char.lit
|
||||
TripleQuote.java:13:15: compiler.err.empty.char.lit
|
||||
TripleQuote.java:13:16: compiler.err.unclosed.char.lit
|
||||
6 errors
|
||||
4 errors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue