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-8285939: javadoc java.lang.Record should not have "Direct Known Subclasses:" section #8523
JDK-8285939: javadoc java.lang.Record should not have "Direct Known Subclasses:" section #8523
Conversation
…ubclasses:" section
👋 Welcome back jjg! A progress list of the required criteria for merging this PR into |
@jonathan-gibbons The following label will be automatically applied to this pull request:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I haven't looked into code in detail, I can confirm that the following JDK API pages have been updated and look good:
- java.base/java/lang/Record.html
- java.base/java/lang/class-use/Object.html
- java.base/java/lang/class-use/Record.html
- java.base/java/lang/package-use.html
- jdk.jshell/jdk/jshell/package-tree.html
- jdk.net/jdk/net/package-tree.html
- overview-tree.html
WRT documentation, a hierarchy of records now behave similarly to that of enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge this branch with the master (they are now in conflict) and I will review the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice cleanup! My only objection is that some refactored/moved methods have lost their doc comment.
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java
Show resolved
Hide resolved
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
Show resolved
Hide resolved
@jonathan-gibbons 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:
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 60 new commits pushed to the
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
Outdated
Show resolved
Hide resolved
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
Outdated
Show resolved
Hide resolved
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
Outdated
Show resolved
Hide resolved
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
Outdated
Show resolved
Hide resolved
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
Show resolved
Hide resolved
/integrate |
Going to push as commit 8fc201e.
Your commit was automatically rebased without conflicts. |
@jonathan-gibbons Pushed as commit 8fc201e. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
As described in the JBS issue, the observed problem is a side-effect of a related but different issue, which is that record classes are not treated the same was as enum classes when it comes to generating the class hierarchy in
ClassTree
. Because record classes are not treated specially/differently, they are treated as ordinary/plain classes, with the side-effect that the page forjava.lang.Record
showsDirect Known Subclasses
.The underlying fix is therefore to clone the enum support in
ClassTree
and related classes, to provide support for record classes. It is possible to do an extreme minimal clone, but that just clones some of the messy evolution already there. Instead, the code inClassTree
and its clients is refactored and modernized.Previously there were four explicit pairs of member fields, containing data for different groups (hierarchies) of classes, namely: plain classes, enum classes, interfaces and annotation interfaces. These fields are most of the code to support them are moved into some new abstractions to encapsulate related functionality.
ClassTree
isHierarchy
which provides the support for the different hierarchies displayed in the generated pages.HierarchyKind
identifies the four existing hierarchies (listed above) and now a new one, for record classes. The hierarchies correspond to the different kinds of declared type.SubtypeMap
which is a multi-map for mapping a type element to its subtypes. This is used inHierarchy
and to record the classes that implement an interfaces.Generally, the naming should be clearer and more obvious. The most confusing name in the old code was
enumSubtypes
which was weird because enum classes don't have subtypes. It meant "subtypes of supertypes of enum classes". This was a prime motivator to switch to thehierarchy
terminology. The variant spellings ofintfacs
have all been replaced byinterfaces
, andclasstree
becomesclassTree
.Testing: a new test case has been added to the
TestRecordTypes.java
test, which verifies the new record hierarchy is displayed on a a package tree page. It is not simple to directly test the observed/reported behavior, because it is specific to the JDK API documentation, and because it is about the content of thejava.lang.Record
API page. However, manual inspection and diff comparison between JDK API documentation generated before and after this change reveals only expected differences. These differences are on thejava.lang.R4cord
page (where the offending section is no longer displayed) and on the pages related to the two existing records in JDK ... which are now listed inRecord Class Hierarchy
sections in the appropriatepackage-tree.html
files.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8523/head:pull/8523
$ git checkout pull/8523
Update a local copy of the PR:
$ git checkout pull/8523
$ git pull https://git.openjdk.java.net/jdk pull/8523/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8523
View PR using the GUI difftool:
$ git pr show -t 8523
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8523.diff