jdk
jdk copied to clipboard
JDK-8298405: Implement JEP 467: Markdown Documentation Comments
Please review a patch to add support for Markdown syntax in documentation comments, as described in the associated JEP.
Notable features:
- support for
///
documentation comments inJavaTokenizer
- new module
jdk.internal.md
-- a private copy of thecommonmark-java
library - updates to
DocCommentParser
to treat///
comments as Markdown - updates to the standard doclet to render Markdown comments in HTML
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
- [ ] Change requires CSR request JDK-8298687 to be approved
Issues
- JDK-8298405: Implement JEP 467: Markdown Documentation Comments (Enhancement - P3)
- JDK-8298687: Support Markdown in the standard doclet (CSR)
Contributors
- Jim Laskey
<[email protected]>
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16388/head:pull/16388
$ git checkout pull/16388
Update a local copy of the PR:
$ git checkout pull/16388
$ git pull https://git.openjdk.org/jdk.git pull/16388/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16388
View PR using the GUI difftool:
$ git pr show -t 16388
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16388.diff
Webrev
:wave: Welcome back jjg! 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.
@jonathan-gibbons The following labels will be automatically applied to this pull request:
-
build
-
compiler
-
javadoc
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.
Webrevs
- 69: Full - Incremental (a0df7a4b)
- 68: Full - Incremental (bfa35bd4)
- 67: Full (43546101)
- 66: Full (cc12140a)
- 65: Full - Incremental (e48ebb53)
- 64: Full - Incremental (9ad5c398)
- 63: Full (e42632a9)
- 62: Full - Incremental (fe94ab8e)
- 61: Full - Incremental (6576d024)
- 60: Full (20a384b6)
- 59: Full - Incremental (74c86f51)
- 58: Full - Incremental (fadc130b)
- 57: Full - Incremental (a884ae36)
- 56: Full (c4709cf5)
- 55: Full - Incremental (d4c2c73b)
- 54: Full - Incremental (21f5b004)
- 53: Full - Incremental (37646287)
- 52: Full (a8ea1c72)
- 51: Full - Incremental (477fb155)
- 50: Full (03652d2f)
- 49: Full (635af77d)
- 48: Full (76eccbf4)
- 47: Full - Incremental (81279a74)
- 46: Full - Incremental (8dfd9e08)
- 45: Full - Incremental (fc76e8c7)
- 44: Full (292ff0f1)
- 43: Full - Incremental (0b4d9b3c)
- 42: Full - Incremental (398f93fc)
- 41: Full - Incremental (d460ee33)
- 40: Full - Incremental (40616865)
- 39: Full - Incremental (27bc0b9d)
- 38: Full - Incremental (72420419)
- 37: Full - Incremental (5fc9c84a)
- 36: Full - Incremental (25921fd0)
- 35: Full - Incremental (53afd804)
- 34: Full - Incremental (da8752c8)
- 33: Full - Incremental (393d3a9c)
- 32: Full - Incremental (f6d08db9)
- 31: Full (2801c2e1)
- 30: Full (1c64a6e0)
- 29: Full - Incremental (3f8aa6b5)
- 28: Full - Incremental (d22668da)
- 27: Full - Incremental (91588bc3)
- 26: Full - Incremental (3b1350b2)
- 25: Full - Incremental (cb070451)
- 24: Full - Incremental (c891fe9a)
- 23: Full - Incremental (5fc415b6)
- 22: Full - Incremental (92b5e7a5)
- 21: Full (63dd8bf4)
- 20: Full - Incremental (5710c285)
- 19: Full - Incremental (7c631688)
- 18: Full - Incremental (2a20c74b)
- 17: Full - Incremental (203532b2)
- 16: Full - Incremental (f086aaab)
- 15: Full - Incremental (b02d4675)
- 14: Full - Incremental (54d40b20)
- 13: Full - Incremental (586daddf)
- 12: Full - Incremental (71ce4b16)
- 11: Full (0da7ba5c)
- 10: Full - Incremental (50c3a40b)
- 09: Full - Incremental (5e3f03c8)
- 08: Full (4d22a100)
- 07: Full (30eb1d15)
- 06: Full (a192f101)
- 05: Full - Incremental (50bb105d)
- 04: Full - Incremental (39cdd2bb)
- 03: Full - Incremental (843cc278)
- 02: Full - Incremental (ec7445d2)
- 01: Full - Incremental (ea9c1614)
- 00: Full (128363bf)
@jonathan-gibbons This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
@jonathan-gibbons, please sync this PR with mainline. As for Skara bots, this comment will hopefully deter them for another 4 weeks.
Jon, please sync this PR with mainline to resolve conflicts.
/contributor add @JimLaskey
@jonathan-gibbons
Contributor Jim Laskey <[email protected]>
successfully added.
On CommonMark.
jdk.internal.md
contains 133 files, the vast majority of which are from commonmark-java 0.21.0. According to https://github.com/commonmark/commonmark-java/releases 0.21.0 is the latest/current release; good. Questions:
- Did we take the tagged commit or mainline at some point after the tagged commit? If it's the latter, we need to take the tagged version.
- What's the difference between those commonmark-java files in this PR and official commonmark-java? In other words, how do we adapt them? It would be nice to have a description of the procedure or a script to update those files.
jdk.internal.md
exports packages tojdk.jshell
. A question for @lahodaj, who maintainsjdk.jshell
: when do we need to create a new PR similar to that withdrawn 8299902: Support for MarkDown javadoc in JShell #11936?
Added comment to jdk.internal.md
module-info.java
Re: https://github.com/openjdk/jdk/pull/16388#discussion_r1483182361 See https://github.com/openjdk/jdk/pull/17782
I have a test case to report. The following results in no @param
information being rendered, which I think is a bug:
/// Hello, _Markdown_ world!
///
/// <p>
/// @param <T> hello
/// </p>
///
public class C<T> { }
I have a test case to report. The following results in no
@param
information being rendered, which I think is a bug:/// Hello, _Markdown_ world! /// /// <p> /// @param <T> hello /// </p> /// public class C<T> { }
Scratch that. After experimenting a bit more with traditional javadoc comments, I realised that it might be expected that @param
would be lost in that <p>...</p>
block; okay.
Still, I find it surprising that the description of the @param
tag in the above comment, hosted in ///
or /**...*/
, is a single node of type RawText
with the following content:
hello
</p>
(Note, the content includes </p>
.)
I have a test case to report. The following results in no
@param
information being rendered, which I think is a bug:/// Hello, _Markdown_ world! /// /// <p> /// @param <T> hello /// </p> /// public class C<T> { }
Scratch that. After experimenting a bit more with traditional javadoc comments, I realised that it might be expected that
@param
would be lost in that<p>...</p>
block; okay.Still, I find it surprising that the description of the
@param
tag in the above comment, hosted in///
or/**...*/
, is a single node of typeRawText
with the following content:hello </p>
(Note, the content includes
</p>
.)
The Markdown aspect of this is behaving about as well as can be expected. But the generated form is certainly confusing and can be considered a less-than-optimal presentation of a paragraph within a definition list. You can see the same behavior in a traditional comment with @param <T> <p>hello</p>
. Ideally, we could/should tweak the CSS for this situation, in a separate changeset.
@jonathan-gibbons this pull request can not be integrated into master
due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:
git checkout 8298405.doclet-markdown-v3
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push
@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:
8298405: Implement JEP 467: Markdown Documentation Comments
8329296: Update Elements for '///' documentation comments
Co-authored-by: Jim Laskey <[email protected]>
Reviewed-by: prappo, darcy, hannesw
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 31 new commits pushed to the master
branch:
- 0b0445be2833286b4eace698b91a658de3e7608b: 8331724: Refactor j.l.constant implementation to internal package
- d84a8fd8762fe9448e73d75ec9dc8c4876b1a709: 8332327: Return _methods_jmethod_ids field back in VMStructs
- f1ce9b0ecce9b506f5bf7a66fcf03c93b9ae8fed: 8331557: Serial: Refactor SerialHeap::do_collection
- 14198f502f0a721e479adc754a2c7d94b665fbe6: 8329653: JLILaunchTest fails on AIX after JDK-8329131
- ae999eae7e61072ad964a43f622fa930ce1179f7: 8129418: JShell: better highlighting of errors in imports on demand
- 6422efa3c7917525a879e80657ca4dcfb6d67514: 8332394: Add friendly output when @IR rule missing value
- 9160ef8b9d9f2c87ca6df08d85dad4271085f0ac: 8332237: [nmt] Remove the need for ThreadStackTracker::track_as_vm()
- 7c750fd95b83d0a93b0cce681dcfbbae1f220fdd: 8331746: Create a test to verify that the cmm id is not ignored
- de57d4b2e0fe3add0ef09945b34ddd0b67bbfa2b: 8332257: Shenandoah: Move evacuation methods to implementation file
- da9c23ace9bdf398d811a88ed137217dd3167231: 8325384: sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java failing intermittently when main thread is a virtual thread
- ... and 21 more: https://git.openjdk.org/jdk/compare/61aff6db15d5bdda77427af5ce34d0fe43373197...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.
⚠️ @jonathan-gibbons This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch>
where <project>
is the name of another project in the OpenJDK organization (for example Merge jdk:master
).
/issue add jdk-8303766
@jonathan-gibbons
Adding additional issue to issue list: 8303766: Support /// for documentation comments
.
/issue remove jdk-8303766
@jonathan-gibbons
Removing additional issue from issue list: 8303766
.
/issue add JDK-8329296
@jonathan-gibbons
Adding additional issue to issue list: 8329296: Update Elements for '///' documentation comments
.
There should be some quick testing of the new default method on Elements using the VacuousElements implementation; see
test/langtools/tools/javac/processing/model/util/elements
for some examples.
There should be some quick testing of the new default method on Elements using the VacuousElements implementation; see
test/langtools/tools/javac/processing/model/util/elements
for some examples.
@jddarcy I've reorganized the tests in this area a bit, and moved the testing for DocCommentKind
to a new test, which includes testing the default method, using VacuousElements
(nice trick, that, by the way.). Although now renamed, the older TestGetDocComments
is now closer to the original form, with the testing for getDocCommentKind
being moved to a new test class.
There should be some quick testing of the new default method on Elements using the VacuousElements implementation; see
test/langtools/tools/javac/processing/model/util/elements
for some examples.@jddarcy I've reorganized the tests in this area a bit, and moved the testing for
DocCommentKind
to a new test, which includes testing the default method, usingVacuousElements
(nice trick, that, by the way.). Although now renamed, the olderTestGetDocComments
is now closer to the original form, with the testing forgetDocCommentKind
being moved to a new test class.
Creating one VacuousElements was preferable to creating one each time a new default method was added :-)
/reviewers 2 reviewer
@jddarcy The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 2 Reviewers).
I think we should add a test to verify that if --disable-line-doc-comments
is specified, no ///
dangling comments are reported.
I think we should add a test to verify that if
--disable-line-doc-comments
is specified, no///
dangling comments are reported.
Added more tests for dangling doc comments.
Note we cannot currently use -Xlint:dangling-doc-comments
in javadoc itself, so the new tests are part of the javac set of tests.
A meta question about the JEP: Why don't Javadoc features (like snippets and markdown comments) don't go through preview, while Compiler features mostly do? Is there any bar for previews?