Skip to content

8318811: Compiler directives parser swallows a character after line comments #1717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/share/utilities/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ u_char JSON::skip_line_comment() {
return 0;
}
next();
return next();
return peek();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

package compiler.compilercontrol.parser;

import java.io.FileNotFoundException;
import java.io.PrintStream;

import compiler.compilercontrol.share.JSONFile;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
Expand All @@ -52,6 +55,7 @@ public static void main(String[] args) {
emptyFile();
noFile();
directory();
lineCommentTest();
}

private static void simpleTest() {
Expand Down Expand Up @@ -145,4 +149,20 @@ private static void directory() {
Asserts.assertNE(output.getExitValue(), 0, ERROR_MSG + "directory as "
+ "a name");
}

private static void lineCommentTest() {
String fileName = "lineComment.json";
try {
PrintStream out = new PrintStream(fileName);
out.println("[{");
out.println(" match: \"*::*\",");
out.println(" c2: { Exclude: true } // c1 only for startup");
out.println("}]");
out.close();
} catch (FileNotFoundException e) {
throw new Error("TESTBUG: can't open/create file " + fileName, e);
}
OutputAnalyzer output = HugeDirectiveUtil.execute(fileName);
output.shouldHaveExitValue(0);
}
}