Skip to content
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

JDK-8326332: Unclosed inline tags cause misalignment in summary tables #18154

Closed
wants to merge 2 commits into from

Conversation

hns
Copy link
Member

@hns hns commented Mar 7, 2024

Please review a simple fix to make sure inline tags are always closed in summary tables, even when the tags are closed after the first sentence in the original doc comment.

I decided to colocate the functionality to track open inline tags with the existing ignoreNonInlineTag method that filters out non-inline elements because there is a lot of common functionality, such as retrieving the name and kind of an HTML tag. I considered giving the method a name that describes the additional functionality, but couldn't find one that wasn't comically long. Suggestions are welcome of course.


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

  • JDK-8326332: Unclosed inline tags cause misalignment in summary tables (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18154

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18154.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 7, 2024

👋 Welcome back hannesw! 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 added the rfr Pull request is ready for review label Mar 7, 2024
@openjdk
Copy link

openjdk bot commented Mar 7, 2024

@hns 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 Mar 7, 2024
@mlbridge
Copy link

mlbridge bot commented Mar 7, 2024

Webrevs

Comment on lines +79 to +83

checkOutput("pkg/BreakIteratorTest.html", true,
"""
<div class="block">Inline tags <i><a href="../index-all.html">extending
beyond the first sentence.</a></i></div>""");
Copy link
Member

Choose a reason for hiding this comment

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

I have a question:
Why doesn't it include Tags are closed here? Is it intentional or a bug?

Copy link
Member Author

Choose a reason for hiding this comment

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

This piece of HTML is from the method summary table which only displays the first sentence of the doc comment (which is the root of the problem fixed by this PR).

Copy link
Member

Choose a reason for hiding this comment

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

Got it. Thanks for your answer.

Copy link
Member

@lgxbslgx lgxbslgx left a comment

Choose a reason for hiding this comment

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

LGTM.

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.

I like that you managed this without needing to build anything resembling an HTML conformance checker or even to extend existing support for HTML tags.

return true;
}
// Keep track of open inline tags that need to be closed, see 8326332
if (kind == START_ELEMENT && htmlTag.endKind == HtmlTag.EndKind.REQUIRED) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Clever use of endKind -- I would not have thought of that.

@openjdk
Copy link

openjdk bot commented Mar 8, 2024

@hns 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:

8326332: Unclosed inline tags cause misalignment in summary tables

Reviewed-by: gli, 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 20 new commits pushed to the master branch:

  • 33aa4b2: 8256314: JVM TI GetCurrentContendedMonitor is implemented incorrectly
  • 87b40c6: 8327167: Clarify the handling of Leap year by Calendar
  • 6efdaf8: 8326908: DecimalFormat::toPattern throws OutOfMemoryError when pattern is empty string
  • c4845f0: 8317431: Implement simpler Comparator when building certification paths
  • 585a958: 8327675: jspawnhelper should be built on all unix platforms
  • 06f7bb5: 8327677: Parallel: Remove unused ParallelCompactData::clear
  • 1877a48: 8308745: ObjArrayKlass::allocate_objArray_klass may call into java while holding a lock
  • 997e615: 8322943: runtime/CompressedOops/CompressedClassPointers.java fails on AIX
  • 27a03e0: 8327218: Add an ability to specify modules which should have native access enabled
  • d0d4912: 8326096: Deprecate getTotalIn, getTotalOut methods of java.util.zip.Inflater, java.util.zip.Deflater
  • ... and 10 more: https://git.openjdk.org/jdk/compare/d7273ac8b1ad8bc5d0a17fff5dc941c735fdae24...master

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 Mar 8, 2024
if (kind == Kind.START_ELEMENT) {
name = ((StartElementTree)dtree).getName();
} else if (kind == Kind.END_ELEMENT) {
name = ((EndElementTree)dtree).getName();
}

if (name != null) {
HtmlTag htmlTag = HtmlTag.get(name);
Copy link
Contributor

Choose a reason for hiding this comment

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

minor P5 suggestion to consider in future:
maybe add convenience forms for HtmlTag.of that accept a DocTree.

HtmlTree htmlTag = HtmlTree.of(tree);
HtmlTree of(DocTree dtree) {
    return switch (tree.getKind()) {
        case START_ELEMENT -> of(((StartElementTree)dtree).getName());
        case END_ELEMENT -> of(((StartElementTree)dtree).getName());
        default -> throw new IllegalArgumentException(tree.getKind().toString());
    }
}

@hns
Copy link
Member Author

hns commented Mar 8, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Mar 8, 2024

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

  • 33aa4b2: 8256314: JVM TI GetCurrentContendedMonitor is implemented incorrectly
  • 87b40c6: 8327167: Clarify the handling of Leap year by Calendar
  • 6efdaf8: 8326908: DecimalFormat::toPattern throws OutOfMemoryError when pattern is empty string
  • c4845f0: 8317431: Implement simpler Comparator when building certification paths
  • 585a958: 8327675: jspawnhelper should be built on all unix platforms
  • 06f7bb5: 8327677: Parallel: Remove unused ParallelCompactData::clear
  • 1877a48: 8308745: ObjArrayKlass::allocate_objArray_klass may call into java while holding a lock
  • 997e615: 8322943: runtime/CompressedOops/CompressedClassPointers.java fails on AIX
  • 27a03e0: 8327218: Add an ability to specify modules which should have native access enabled
  • d0d4912: 8326096: Deprecate getTotalIn, getTotalOut methods of java.util.zip.Inflater, java.util.zip.Deflater
  • ... and 10 more: https://git.openjdk.org/jdk/compare/d7273ac8b1ad8bc5d0a17fff5dc941c735fdae24...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 8, 2024

@hns Pushed as commit a6dc4bc.

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

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

Successfully merging this pull request may close these issues.

3 participants