Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
/ jdk19 Public archive

8067757: Incorrect HTML generation for copied javadoc with multiple @throws tags #95

Closed
wants to merge 10 commits into from

Conversation

pavelrappo
Copy link
Member

@pavelrappo pavelrappo commented Jun 30, 2022

Please review this PR for JDK 19.

This PR fixes JDK-8067757. To understand what JDK-8067757 is about, you first need to understand how javadoc documents the fact that such and such exceptions are thrown by a constructor or method.

If a constructor or method declaration indicates thrown exceptions, javadoc creates the "Throws:" section in that declaration documentation. Here's the algorithm which javadoc uses to fill in that section:

  1. For each @throws tag that is directly present on the declaration, add an entry to the section.
  2. If this is a method declaration, then for those exceptions from that declaration's throws clause for which there were no @throws tags found in step 1, try to inherit @throws tags from the overridden methods found as per Method Comments Algorithm1.
  3. For each of the remaining exceptions from the throws clause (i.e. the exceptions for which documentation could neither be found in step 1, nor inherited in step 2), add an entry that mentions the exception but has no description.

The problem that JDK-8067757 is concerned with is that if an exception is documented using multiple @throws tags, only one of these tags will be inherited in step 2.

While fixing this issue I discovered an unpleasant interference with JDK-49474552 and fixed it.

Looking ahead, JDK-65090453 is about a similar problem that happens in step 1 in the presence of {@inheritDoc}. I'm also planning to fix JDK-6509045 in JDK 19.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk19 pull/95/head:pull/95
$ git checkout pull/95

Update a local copy of the PR:
$ git checkout pull/95
$ git pull https://git.openjdk.org/jdk19 pull/95/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 95

View PR using the GUI difftool:
$ git pr show -t 95

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/95.diff

Footnotes

  1. https://docs.oracle.com/en/java/javase/18/docs/specs/javadoc/doc-comment-spec.html#method-comments-algorithm

  2. https://bugs.openjdk.org/browse/JDK-4947455

  3. https://bugs.openjdk.org/browse/JDK-6509045

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 30, 2022

👋 Welcome back prappo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title 8067757 8067757: Incorrect HTML generation for copied javadoc with multiple @throws tags Jun 30, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 30, 2022
@openjdk
Copy link

openjdk bot commented Jun 30, 2022

@pavelrappo The following label will be automatically applied to this pull request:

  • javadoc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the javadoc javadoc-dev@openjdk.org label Jun 30, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 30, 2022

Webrevs

@@ -504,7 +504,7 @@ public Content throwsTagOutput(Element element, ThrowsTree throwsTag, TypeMirror
excName = htmlWriter.getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.MEMBER,
substituteType));
} else if (exception == null) {
excName = new RawHtml(ch.getExceptionName(throwsTag).toString());
excName = new RawHtml(throwsTag.getExceptionName().toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not your code or edit here, but I'll mention it anyway ...

We should be on the lookout for unnecessary use of RawHtml. It looks like this is a candidate for a (later) cleanup to use just Text, not RawHtml.

Comment on lines -550 to -553
public ReferenceTree getExceptionName(ThrowsTree tt) {
return tt.getExceptionName();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this does seem a bit superfluous

Copy link
Contributor

@jonathan-gibbons jonathan-gibbons left a comment

Choose a reason for hiding this comment

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

Nice.

This time, the individual change sets helped.

Thanks for working on the doc comments, in the places you did; they do help.

@openjdk
Copy link

openjdk bot commented Jul 2, 2022

@pavelrappo This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8067757: Incorrect HTML generation for copied javadoc with multiple @throws tags

Reviewed-by: jjg

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 5 new commits pushed to the master branch:

  • 9925014: 8280320: C2: Loop opts are missing during OSR compilation
  • 8e01ffb: 8289570: SegmentAllocator:allocateUtf8String(String str) default behavior mismatch to spec
  • 20124ac: 8289585: ProblemList sun/tools/jhsdb/JStackStressTest.java on linux-aarch64
  • 604ea90: 8289549: ISO 4217 Amendment 172 Update
  • 9549777: 8284358: Unreachable loop is not removed from C2 IR, leading to a broken graph

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 2, 2022
@pavelrappo
Copy link
Member Author

pavelrappo commented Jul 4, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Jul 4, 2022

Going to push as commit f640fc5.
Since your change was applied there have been 13 commits pushed to the master branch:

  • 0dff327: 8289569: [test] java/lang/ProcessBuilder/Basic.java fails on Alpine/musl
  • 1a27164: 8287851: C2 crash: assert(t->meet(t0) == t) failed: Not monotonic
  • 5b5bc6c: 8287672: jtreg test com/sun/jndi/ldap/LdapPoolTimeoutTest.java fails intermittently in nightly run
  • dc4edd3: 8289183: jdk.jfr.consumer.RecordedThread.getId references Thread::getId, should be Thread::threadId
  • c4dcce4: 8289619: JVMTI SelfSuspendDisablerTest.java failed with RuntimeException: Test FAILED: Unexpected thread state
  • f5cdaba: 8245268: -Xcomp is missing from java launcher documentation
  • 9515560: 8288703: GetThreadState returns 0 for virtual thread that has terminated
  • cfc9a88: 8288854: getLocalGraphicsEnvironment() on for multi-screen setups throws exception NPE
  • 9925014: 8280320: C2: Loop opts are missing during OSR compilation
  • 8e01ffb: 8289570: SegmentAllocator:allocateUtf8String(String str) default behavior mismatch to spec
  • ... and 3 more: https://git.openjdk.org/jdk19/compare/c20b3aa9c5ada4c87b3421fbc3290f4d6a4706ac...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 4, 2022
@openjdk openjdk bot closed this Jul 4, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 4, 2022
@openjdk
Copy link

openjdk bot commented Jul 4, 2022

@pavelrappo Pushed as commit f640fc5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
integrated Pull request has been integrated javadoc javadoc-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants