Skip to content

Commit

Permalink
8314975: JavadocTester should set source path if not specified
Browse files Browse the repository at this point in the history
Backport-of: 2f4d601a56bf02db2766d1f8a2ddfff906b78678
  • Loading branch information
GoeLin committed Apr 8, 2024
1 parent e5c1031 commit 3b3ec13
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,14 @@ public void javadoc(String... args) {
String charsetArg = null;
String docencodingArg = null;
String encodingArg = null;
boolean haveSourcePath = false;
for (int i = 0; i < args.length - 2; i++) {
switch (args[i]) {
case "-d" -> outputDir = Path.of(args[++i]);
case "-charset" -> charsetArg = args[++i];
case "-docencoding" -> docencodingArg = args[++i];
case "-encoding" -> encodingArg = args[++i];
case "-sourcepath", "--source-path", "--module-source-path" -> haveSourcePath = true;
}
}

Expand All @@ -451,6 +453,16 @@ public void javadoc(String... args) {
charset = Charset.defaultCharset();
}

// explicitly set the source path if none specified
// to override the javadoc tool default to use the classpath
if (!haveSourcePath) {
var newArgs = new String[args.length + 2];
newArgs[0] = "-sourcepath";
newArgs[1] = testSrc;
System.arraycopy(args, 0, newArgs, 2, args.length);
args = newArgs;
}

out.println("args: " + Arrays.toString(args));
// log.setOutDir(outputDir);

Expand Down

1 comment on commit 3b3ec13

@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.