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

8345770: javadoc: API documentation builds are not always reproducible #22732

Closed
wants to merge 2 commits into from

Conversation

hns
Copy link
Member

@hns hns commented Dec 13, 2024

Please review a fix for a bug that could cause non-reproducible documentation builds and the wrong link label being used in summary pages.

We used to rely on field HtmlConfiguration.currentTypeElement to decide whether to include the type name in member links generated from {@link} or @see tags. However, that field was only set by the ClassWriter and ClassUseWriter classes, but never unset by any other writer class, so effectively it contained the last instead of the current type element. This resulted in summary pages using non-qualified member links, depending on the last previously executing class writer.

The fix is to use HtmlDocletWriter.getCurrentTypeElement() (previously called getCurrentPageElement()) instead. Note that this method returns null for ClassUseWriter, so it changes the generated documentation for class-use pages. The new behavior is preferable, because class-use pages are primarily about other classes using the class, so links to members of the used class should be qualified by the class name. A good example for this are the links to the FALSE and TRUE fields in the class use page for java.lang.Boolean which should include the class name.

As mentioned above I also renamed getCurrentPageElement() method to getCurrentTypeElement() and made the doc comments a bit more precise.


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-8345770: javadoc: API documentation builds are not always reproducible (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22732

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 13, 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
Copy link

openjdk bot commented Dec 13, 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:

8345770: javadoc: API documentation builds are not always reproducible

Reviewed-by: nbenalla, liach

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 23 new commits pushed to 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
Copy link

openjdk bot commented Dec 13, 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 Dec 13, 2024
@hns hns changed the title Jdk 8345770 8345770: javadoc: API documentation builds are not always reproducible Dec 13, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 13, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 13, 2024

Webrevs

Copy link
Member

@nizarbenalla nizarbenalla left a comment

Choose a reason for hiding this comment

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

Great change!

I compared the generated docs before/after the change and the changes are all in theclass-use pages, where the qualified name is now used instead.

List of changed files

java.base/java/nio/file/attribute/class-use/AclEntryPermission.html
java.base/java/math/class-use/BigDecimal.html
java.base/java/lang/class-use/Boolean.html
java.base/java/lang/class-use/Character.UnicodeBlock.html
java.desktop/java/awt/class-use/ComponentOrientation.html
java.base/java/util/concurrent/class-use/CountedCompleter.html
java.desktop/java/awt/class-use/Cursor.html
java.datatransfer/java/awt/datatransfer/class-use/DataFlavor.html
java.base/java/net/class-use/DatagramSocket.html
java.base/java/util/concurrent/class-use/ForkJoinTask.html
java.desktop/javax/swing/class-use/JLayer.html
java.base/java/lang/classfile/instruction/LabelTarget.html
jdk.dynalink/jdk/dynalink/linker/class-use/LinkerServices.html
java.base/java/util/concurrent/locks/class-use/Lock.html
java.base/java/lang/invoke/class-use/MethodHandle.html
java.base/java/lang/invoke/class-use/MethodHandles.Lookup.html
java.base/java/lang/class-use/Object.html
java.base/java/util/class-use/Optional.html
java.prefs/java/util/prefs/class-use/Preferences.html
java.base/java/util/concurrent/locks/class-use/ReadWriteLock.html
java.base/java/net/class-use/ServerSocket.html
java.base/java/net/class-use/Socket.html
java.base/java/lang/class-use/String.html
java.base/java/net/class-use/URL.html
java.base/java/util/class-use/UUID.html
java.xml/javax/xml/stream/class-use/XMLEventFactory.html
java.xml/javax/xml/stream/class-use/XMLInputFactory.html
java.xml/javax/xml/stream/class-use/XMLOutputFactory.html
java.xml/javax/xml/xpath/class-use/XPathFactory.html

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

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

Code change makes sense.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 15, 2024
@hns
Copy link
Member Author

hns commented Dec 16, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Dec 16, 2024

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

  • ee1c5ad: 8345975: Update SAP SE copyright year to 2024 where it was missed
  • 3518b4b: 8344171: Clone and initialize Assertion Predicates in order instead of in reverse-order
  • c88e081: 8346160: Fix -Wzero-as-null-pointer-constant warnings from explicit casts
  • ab1dbd4: 8346202: Correct typo in SQLPermission
  • 6b022bb: 8344453: Test jdk/jfr/event/oldobject/TestSanityDefault.java timed out
  • 3b9de11: 8319875: Add macOS implementation for jcmd System.map
  • ebb27c2: 8346139: test_memset_with_concurrent_readers.cpp should not use
  • c2f0ef5: 8346159: Disable CDS AOTClassLinking tests for JVMCI due to JDK-8345635
  • 4b21fb9: 8343467: Remove unnecessary @SuppressWarnings annotations (security)
  • e7fc0eb: 8345987: java.management has two Util.newObjectName methods (remove one)
  • ... and 16 more: https://git.openjdk.org/jdk/compare/f71d51502673bc95d66aa568e98e4801613497a5...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 16, 2024

@hns Pushed as commit 4fc43b0.

💡 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