Skip to content

Commit 8fda5b8

Browse files
author
Jim Laskey
committedOct 1, 2020
8253904: Revert Tokenizer improvements JDK-8224225
Reviewed-by: mcimadamore
1 parent 60ec2a5 commit 8fda5b8

18 files changed

+1234
-1750
lines changed
 

‎src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java

+668-784
Large diffs are not rendered by default.

‎src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java

+340-317
Large diffs are not rendered by default.

‎src/jdk.compiler/share/classes/com/sun/tools/javac/parser/TextBlockSupport.java

-101
This file was deleted.

‎src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java

+181-481
Large diffs are not rendered by default.

‎src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties

+3
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,9 @@ compiler.err.unreported.exception.implicit.close=\
13831383
unreported exception {0}; must be caught or declared to be thrown\n\
13841384
exception thrown from implicit call to close() on resource variable ''{1}''
13851385

1386+
compiler.err.unsupported.cross.fp.lit=\
1387+
hexadecimal floating-point literals are not supported on this VM
1388+
13861389
compiler.err.void.not.allowed.here=\
13871390
''void'' type not allowed here
13881391

‎src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties

+2
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,8 @@ compiler.err.unreported.exception.default.constructor=\u30C7\u30D5\u30A9\u30EB\u
984984
# 0: type, 1: name
985985
compiler.err.unreported.exception.implicit.close=\u5831\u544A\u3055\u308C\u306A\u3044\u4F8B\u5916{0}\u306F\u3001\u30B9\u30ED\u30FC\u3059\u308B\u306B\u306F\u6355\u6349\u307E\u305F\u306F\u5BA3\u8A00\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\n\u30EA\u30BD\u30FC\u30B9\u5909\u6570''{1}''\u3067\u306Eclose()\u306E\u6697\u9ED9\u7684\u306A\u30B3\u30FC\u30EB\u304B\u3089\u4F8B\u5916\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F
986986

987+
compiler.err.unsupported.cross.fp.lit=16\u9032\u6D6E\u52D5\u5C0F\u6570\u70B9\u30EA\u30C6\u30E9\u30EB\u306F\u3053\u306EVM\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
988+
987989
compiler.err.void.not.allowed.here=\u3053\u3053\u3067''void''\u578B\u3092\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
988990

989991
# 0: string

‎src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties

+2
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,8 @@ compiler.err.unreported.exception.default.constructor=\u9ED8\u8BA4\u6784\u9020\u
984984
# 0: type, 1: name
985985
compiler.err.unreported.exception.implicit.close=\u672A\u62A5\u544A\u7684\u5F02\u5E38\u9519\u8BEF{0}; \u5FC5\u987B\u5BF9\u5176\u8FDB\u884C\u6355\u83B7\u6216\u58F0\u660E\u4EE5\u4FBF\u629B\u51FA\n\u5BF9\u8D44\u6E90\u53D8\u91CF ''{1}'' \u9690\u5F0F\u8C03\u7528 close() \u65F6\u629B\u51FA\u4E86\u5F02\u5E38\u9519\u8BEF
986986

987+
compiler.err.unsupported.cross.fp.lit=\u8BE5 VM \u4E0D\u652F\u6301\u5341\u516D\u8FDB\u5236\u6D6E\u70B9\u6587\u5B57
988+
987989
compiler.err.void.not.allowed.here=\u6B64\u5904\u4E0D\u5141\u8BB8\u4F7F\u7528 ''\u7A7A'' \u7C7B\u578B
988990

989991
# 0: string

‎src/jdk.compiler/share/classes/com/sun/tools/javac/util/DiagnosticSource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@ public int getColumnNumber(int pos, boolean expandTabs) {
9696
return 0;
9797
}
9898
if (buf[bp] == '\t' && expandTabs) {
99-
column = tabulate(column);
99+
column = (column / TabInc * TabInc) + TabInc;
100100
} else {
101101
column++;
102102
}

‎src/jdk.compiler/share/classes/com/sun/tools/javac/util/LayoutCharacters.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -68,10 +68,4 @@ public interface LayoutCharacters {
6868
* source file.
6969
*/
7070
final static byte EOI = 0x1A;
71-
72-
/** Bump column to the next tab.
73-
*/
74-
static int tabulate(int column) {
75-
return (column / TabInc * TabInc) + TabInc;
76-
}
7771
}

‎src/jdk.compiler/share/classes/com/sun/tools/javac/util/Position.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -265,7 +265,7 @@ public int getColumnNumber(int pos) {
265265
int column = 0;
266266
for (int bp = lineStart; bp < pos; bp++) {
267267
if (tabMap.get(bp))
268-
column = tabulate(column);
268+
column = (column / TabInc * TabInc) + TabInc;
269269
else
270270
column++;
271271
}
@@ -279,7 +279,7 @@ public int getPosition(int line, int column) {
279279
while (col < column) {
280280
pos++;
281281
if (tabMap.get(pos))
282-
col = tabulate(col);
282+
col = (col / TabInc * TabInc) + TabInc;
283283
else
284284
col++;
285285
}

‎test/langtools/tools/javac/Digits.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Digits.java:11:43: compiler.err.illegal.nonascii.digit
1+
Digits.java:11:41: compiler.err.illegal.nonascii.digit
22
1 error

‎test/langtools/tools/javac/diags/examples.not-yet.txt

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ compiler.err.stack.sim.error
4444
compiler.err.type.var.more.than.once # UNUSED
4545
compiler.err.type.var.more.than.once.in.result # UNUSED
4646
compiler.err.unexpected.type
47+
compiler.err.unsupported.cross.fp.lit # Scanner: host system dependent
4748
compiler.misc.bad.class.signature # bad class file
4849
compiler.misc.bad.const.pool.tag # bad class file
4950
compiler.misc.bad.const.pool.tag.at # bad class file
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
NonasciiDigit.java:12:18: compiler.err.illegal.nonascii.digit
1+
NonasciiDigit.java:12:24: compiler.err.illegal.nonascii.digit
22
NonasciiDigit.java:13:19: compiler.err.illegal.nonascii.digit
3-
NonasciiDigit.java:14:18: compiler.err.illegal.nonascii.digit
4-
NonasciiDigit.java:16:21: compiler.err.illegal.nonascii.digit
5-
NonasciiDigit.java:17:23: compiler.err.illegal.nonascii.digit
6-
NonasciiDigit.java:18:25: compiler.err.illegal.nonascii.digit
7-
NonasciiDigit.java:19:23: compiler.err.illegal.nonascii.digit
3+
NonasciiDigit.java:14:24: compiler.err.illegal.nonascii.digit
4+
NonasciiDigit.java:16:27: compiler.err.illegal.nonascii.digit
5+
NonasciiDigit.java:17:22: compiler.err.illegal.nonascii.digit
6+
NonasciiDigit.java:18:22: compiler.err.illegal.nonascii.digit
7+
NonasciiDigit.java:19:22: compiler.err.illegal.nonascii.digit
88
NonasciiDigit.java:20:22: compiler.err.illegal.nonascii.digit
9-
NonasciiDigit.java:21:21: compiler.err.illegal.nonascii.digit
9+
NonasciiDigit.java:21:27: compiler.err.illegal.nonascii.digit
1010
9 errors
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,48 +25,24 @@
2525
* @test
2626
* @bug 4330479
2727
* @summary ASCII SUB character is rejected in multi-line comments
28-
* @library /tools/lib
29-
* @modules jdk.compiler/com.sun.tools.javac.api
30-
* jdk.compiler/com.sun.tools.javac.main
31-
* @build toolbox.ToolBox toolbox.JavacTask
32-
* @run main SubChar
28+
* @author gafter
29+
*
30+
* @compile SubChar.java
3331
*/
3432

35-
import toolbox.JavacTask;
36-
import toolbox.JavaTask;
37-
import toolbox.Task;
38-
import toolbox.ToolBox;
39-
40-
41-
public class SubChar {
42-
private static final ToolBox TOOLBOX = new ToolBox();
4333

44-
private static final String SOURCE = """
45-
/*
46-
Note: this source file has been crafted very carefully to end with the
47-
unicode escape sequence for the control-Z character without a
48-
following newline. The scanner is specified to allow control-Z there.
49-
If you edit this source file, please make sure that your editor does
50-
not insert a newline after that trailing line.
51-
*/
52-
53-
/** \\u001A */
54-
class ControlZTest {
55-
public static void main(String args[]) {
56-
return;
57-
}
58-
}
59-
/* \\u001A */\
60-
""";
34+
/*
35+
Note: this source file has been crafted very carefully to end with the
36+
unicode escape sequence for the control-Z character without a
37+
following newline. The scanner is specified to allow control-Z there.
38+
If you edit this source file, please make sure that your editor does
39+
not insert a newline after that trailing line.
40+
*/
6141

62-
public static void main(String... args) {
63-
String output = new JavacTask(TOOLBOX)
64-
.sources(SOURCE)
65-
.classpath(".")
66-
.options("-encoding", "utf8")
67-
.run()
68-
.writeAll()
69-
.getOutput(Task.OutputKind.DIRECT);
70-
System.out.println(output);
71-
}
42+
/** \u001A */
43+
class SubChar {
44+
public static void main(String args[]) {
45+
return;
46+
}
7247
}
48+
/* \u001A */
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SupplementaryJavaID2.java:12:9: compiler.err.illegal.char: \ud801
2-
SupplementaryJavaID2.java:12:15: compiler.err.illegal.char: \ud801
1+
SupplementaryJavaID2.java:12:14: compiler.err.illegal.char: \ud801
2+
SupplementaryJavaID2.java:12:20: compiler.err.illegal.char: \ud801
33
SupplementaryJavaID2.java:12:24: compiler.err.expected: token.identifier
44
3 errors
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
SupplementaryJavaID3.java:12:12: compiler.err.illegal.char: \ud801
2-
SupplementaryJavaID3.java:12:18: compiler.err.illegal.char: \ud801
1+
SupplementaryJavaID3.java:12:17: compiler.err.illegal.char: \ud801
2+
SupplementaryJavaID3.java:12:23: compiler.err.illegal.char: \ud801
33
2 errors
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
SupplementaryJavaID4.java:14:9: compiler.err.illegal.char: \ud834\udd7b
1+
SupplementaryJavaID4.java:14:14: compiler.err.illegal.char: \ud834\udd7b
22
1 error
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
SupplementaryJavaID5.java:14:12: compiler.err.illegal.char: \ud834\udd00
1+
SupplementaryJavaID5.java:14:17: compiler.err.illegal.char: \ud834\udd00
22
1 error

0 commit comments

Comments
 (0)
Please sign in to comment.