Skip to content

Refactor comment hierarchy in preparation for MarkdownComments#4885

Merged
jlerbsc merged 5 commits intojavaparser:masterfrom
johannescoetzee:johannes/comments-refactor
Nov 20, 2025
Merged

Refactor comment hierarchy in preparation for MarkdownComments#4885
jlerbsc merged 5 commits intojavaparser:masterfrom
johannescoetzee:johannes/comments-refactor

Conversation

@johannescoetzee
Copy link
Copy Markdown
Collaborator

This PR introduces the comment hierarchy refactor which I added in some of the later commits in #4875.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 67.30769% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.383%. Comparing base (998cbd4) to head (b12faaa).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...github/javaparser/ast/comments/JavadocComment.java 0.000% 5 Missing ⚠️
...parser/ast/comments/TraditionalJavadocComment.java 75.000% 5 Missing ⚠️
...va/com/github/javaparser/ast/comments/Comment.java 20.000% 4 Missing ⚠️
.../lexicalpreservation/LexicalPreservingPrinter.java 40.000% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##              master     #4885   +/-   ##
===========================================
  Coverage     58.383%   58.383%           
  Complexity      2534      2534           
===========================================
  Files            679       679           
  Lines          39066     39066           
  Branches        7085      7085           
===========================================
  Hits           22808     22808           
  Misses         13358     13358           
  Partials        2900      2900           
Flag Coverage Δ
AlsoSlowTests 58.383% <67.307%> (ø)
javaparser-core 58.383% <67.307%> (ø)
javaparser-symbol-solver 58.383% <67.307%> (ø)
jdk-10 57.945% <67.307%> (-0.003%) ⬇️
jdk-11 57.947% <67.307%> (ø)
jdk-12 57.944% <67.307%> (-0.003%) ⬇️
jdk-13 57.947% <67.307%> (ø)
jdk-14 58.185% <67.307%> (ø)
jdk-15 58.185% <67.307%> (ø)
jdk-16 58.159% <67.307%> (ø)
jdk-17 58.313% <67.307%> (ø)
jdk-18 58.313% <67.307%> (+0.002%) ⬆️
jdk-8 57.945% <67.307%> (-0.003%) ⬇️
jdk-9 57.942% <67.307%> (-0.003%) ⬇️
macos-latest 58.375% <67.307%> (ø)
ubuntu-latest 58.370% <67.307%> (ø)
windows-latest 58.365% <67.307%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ava/com/github/javaparser/ast/CompilationUnit.java 74.524% <ø> (ø)
...thub/javaparser/ast/nodeTypes/NodeWithJavadoc.java 80.000% <100.000%> (ø)
...om/github/javaparser/ast/visitor/CloneVisitor.java 42.434% <100.000%> (ø)
...m/github/javaparser/ast/visitor/EqualsVisitor.java 22.934% <100.000%> (ø)
...aparser/ast/visitor/GenericListVisitorAdapter.java 52.540% <ø> (ø)
.../javaparser/ast/visitor/GenericVisitorAdapter.java 52.036% <ø> (ø)
...parser/ast/visitor/GenericVisitorWithDefaults.java 97.142% <ø> (ø)
...github/javaparser/ast/visitor/HashCodeVisitor.java 61.475% <ø> (ø)
...github/javaparser/ast/visitor/ModifierVisitor.java 31.475% <ø> (ø)
...javaparser/ast/visitor/NoCommentEqualsVisitor.java 4.904% <ø> (ø)
... and 18 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96711a1...b12faaa. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jlerbsc
Copy link
Copy Markdown
Collaborator

jlerbsc commented Nov 5, 2025

Thank you for your understanding. Can this PR be merged immediately?

@jlerbsc
Copy link
Copy Markdown
Collaborator

jlerbsc commented Nov 5, 2025

Regardless of this PR, could you please take the time to document in the project wiki the steps required to add a node to the AST or modify a class hierarchy? Thank you in advance.

@johannescoetzee
Copy link
Copy Markdown
Collaborator Author

johannescoetzee commented Nov 5, 2025

This can be merged already, yes (edit: alternatively this can wait until the markdown changes are ready, in case I missed anything)

Regarding documentation, I added https://github.com/javaparser/javaparser/wiki/A-Detailed-Guide-to-Adding-New-Nodes-and-Fields when I implemented support for record pattern expressions. The steps for modifying the class hierarchy is mostly the same as adding new nodes with some extra care taken to update usage sites. The details of that depend on the particular change being made, however.

@jlerbsc
Copy link
Copy Markdown
Collaborator

jlerbsc commented Nov 5, 2025

This can be merged already, yes (edit: alternatively this can wait until the markdown changes are ready, in case I missed anything)

OK i'll wait.

@jlerbsc
Copy link
Copy Markdown
Collaborator

jlerbsc commented Nov 5, 2025

Regarding documentation, I added https://github.com/javaparser/javaparser/wiki/A-Detailed-Guide-to-Adding-New-Nodes-and-Fields when I implemented support for record pattern expressions. The steps for modifying the class hierarchy is mostly the same as adding new nodes with some extra care taken to update usage sites. The details of that depend on the particular change being made, however.

Could you add a section for this type of modification, specifying the sequence of actions and the differences compared to adding a field? Perhaps you could use the example of comments to briefly detail these actions.

@johannescoetzee
Copy link
Copy Markdown
Collaborator Author

I've opened johannescoetzee#3 on my fork to show the cleaned-up version of the MarkdownComment support PR. If that looks good, then this can be merged after which I'll open a PR for the same changes in this repo

@jlerbsc jlerbsc merged commit 63338cc into javaparser:master Nov 20, 2025
35 checks passed
@jlerbsc jlerbsc added this to the next release milestone Nov 20, 2025
@jlerbsc jlerbsc added the PR: Added A PR that introduces new behaviour (e.g. functionality, tests) label Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Added A PR that introduces new behaviour (e.g. functionality, tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants