-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.2.0
-
x86, sparc
-
solaris_2.5.1, windows_nt
Name: laC46010 Date: 08/06/98
All javac versions (jdk1.0.2-jdk1.2fcsD) incorrectly report an error
on \u000D\u000A sequence in source file. However JLS p.13-14 explicitely
allows to use CR LF sequence as a line terminator:
"3.4 Line Terminators
Java implementations next divide the sequence of Unicode input
characters into lines by recognizing line terminators. This definition
of lines determines the line numbers produced by a Java compiler or
other Java system component. It also specifies the termination of the
// form of a comment (3.7).
LineTerminator:
the ASCII LF character, also known as "newline"
the ASCII CR character, also known as "return"
the ASCII CR character followed by the ASCII LF character
InputCharacter:
UnicodeInputCharacter but not CR or LF
Lines are terminated by the ASCII characters CR, or LF, or CR LF. The
two characters CR immediately followed by LF are counted as one line
terminator, not two. The result is a sequence of line terminators and
input characters, which are the terminal symbols for the third step in
the tokenization process."
As result of this bug, JDK fails the following JCK12beta4 test case:
lang/LEX/lex005/lex00591m4/lex00591m4.html
Note that fix of #4112770 has allowed to use single \u000D and \u000A as line separators
but the third case (\u000D\u000A) is not implemented yet.
See source and logs below.
------------------lex00591m4.java---------------------
/* Ident: @(#)lex00591m4.java generated from: @(#)lex00591m.jmpp 1.5 98/04/28 */
/* Copyright 8/3/98 Sun Microsystems, Inc. All Rights Reserved */
package javasoft.sqe.tests.lang.lex005.lex00591m4;
import java.io.PrintStream;
public class lex00591m4 {
public static void main(String argv[]) {
System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String argv[],PrintStream out) {
/*--- Line terminator `the ASCII CR character followed by the ASCII LF character` as Unicode-escape. ---*/
int a; \u000D\u000A
return 0/*STATUS_PASSED*/;
}
}
------------------------------------------------------
> /export/ld14/java/dest/jdk1.2fcsD/solaris/bin/javac -d /tmp lex00591m4.java
lex00591m4.java:16: Invalid expression statement.
int a; \u000D\u000A
^
lex00591m4.java:16: ';' expected.
int a; \u000D\u000A
^
2 errors
> /export/ld14/java/dest/jdk1.1.7A/solaris/bin/javac -d /tmp lex00591m4.java
lex00591m4.java:15: Invalid character in input.
int a; \u000D\u000A
^
1 error
> /export/ld14/java/dest/jdk1.1/solaris/bin/javac -d /tmp lex00591m4.java
lex00591m4.java:15: Invalid character in input.
int a; \u000D\u000A
^
1 error
> /export/ld14/java/dest/jdk1.0.2/solaris/bin/javac -d /tmp lex00591m4.java
lex00591m4.java:15: Invalid character in input.
int a; \u000D\u000A
^
1 error
======================================================================