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
Reviewed-by: hannesw
  • Loading branch information
jonathan-gibbons committed Oct 17, 2023
1 parent 0ba48ef commit 2f4d601
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

3 comments on commit 2f4d601

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 2f4d601 Apr 5, 2024

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 2f4d601 Apr 5, 2024

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-2f4d601a in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 2f4d601a from the openjdk/jdk repository.

The commit being backported was authored by Jonathan Gibbons on 17 Oct 2023 and was reviewed by Hannes Wallnöfer.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-2f4d601a:backport-GoeLin-2f4d601a
$ git checkout backport-GoeLin-2f4d601a
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-2f4d601a

Please sign in to comment.