Skip to content

Commit

Permalink
8318811: Compiler directives parser swallows a character after line c…
Browse files Browse the repository at this point in the history
…omments

Reviewed-by: shade, phh
  • Loading branch information
simonis committed Oct 27, 2023
1 parent 667cca9 commit 141dae8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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);
}
}

1 comment on commit 141dae8

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.