-
Bug
-
Resolution: Fixed
-
P4
-
11, 17, 21, 22
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8356670 | 21.0.8 | Satyen Subramaniam | P4 | Resolved | Fixed | master |
Currently, the following valid compiler directive file:
```
[{
match: "*::*",
c2: { Exclude: true } // c1 only for startup
}]
```
will be rejected by the parser:
```
Syntax error on line 4 byte 2: Expected value separator or object end (one of ',}').
At ']'.
}]
Parsing of compiler directives failed
```
This is because `JSON::skip_line_comment()`, in contradiction to its specification, does **not** "*return the first token after the line comment without consuming it*" but does consumes it.
The fix is trivial:
```
--- a/src/hotspot/share/utilities/json.cpp
+++ b/src/hotspot/share/utilities/json.cpp
@@ -580,7 +580,7 @@ u_char JSON::skip_line_comment() {
return 0;
}
next();
- return next();
+ return peek();
}
```
```
[{
match: "*::*",
c2: { Exclude: true } // c1 only for startup
}]
```
will be rejected by the parser:
```
Syntax error on line 4 byte 2: Expected value separator or object end (one of ',}').
At ']'.
}]
Parsing of compiler directives failed
```
This is because `JSON::skip_line_comment()`, in contradiction to its specification, does **not** "*return the first token after the line comment without consuming it*" but does consumes it.
The fix is trivial:
```
--- a/src/hotspot/share/utilities/json.cpp
+++ b/src/hotspot/share/utilities/json.cpp
@@ -580,7 +580,7 @@ u_char JSON::skip_line_comment() {
return 0;
}
next();
- return next();
+ return peek();
}
```
- backported by
-
JDK-8356670 Compiler directives parser swallows a character after line comments
-
- Resolved
-
- links to
-
Commit openjdk/jdk/141dae8b
-
Commit(master) openjdk/jdk21u-dev/301fd4d1
-
Review openjdk/jdk/16359
-
Review(master) openjdk/jdk21u-dev/1717