Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Generalize DefaultPrettyPrinterVisitor #4717

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

Conversation

johanneskloos
Copy link
Contributor

Make the code in DefaultPrettyPrinterVisitor a bit easier to extend.

  • Add Javadoc to the various helper methods.
  • Make most of the helper methods protected so that they can be used from overriding classes.
  • Add preVisit/postVisit callbacks that can be used to gather information when nodes are about to be printed, or have just been printed.

Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.303%. Comparing base (a0cab53) to head (42052ce).
Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##              master     #4717   +/-   ##
===========================================
  Coverage     58.303%   58.303%           
  Complexity      2512      2512           
===========================================
  Files            671       671           
  Lines          38761     38761           
  Branches        7031      7031           
===========================================
  Hits           22599     22599           
  Misses         13270     13270           
  Partials        2892      2892           
Flag Coverage Δ
AlsoSlowTests 58.303% <ø> (ø)
javaparser-core 58.303% <ø> (ø)
javaparser-symbol-solver 58.303% <ø> (ø)
jdk-10 57.854% <ø> (ø)
jdk-11 57.853% <ø> (ø)
jdk-12 57.853% <ø> (+0.002%) ⬆️
jdk-13 57.853% <ø> (ø)
jdk-14 58.101% <ø> (+0.002%) ⬆️
jdk-15 58.101% <ø> (ø)
jdk-16 58.075% <ø> (ø)
jdk-17 58.230% <ø> (ø)
jdk-18 58.230% <ø> (ø)
jdk-8 57.855% <ø> (ø)
jdk-9 57.851% <ø> (ø)
macos-latest 58.295% <ø> (ø)
ubuntu-latest 58.290% <ø> (ø)
windows-latest 58.285% <ø> (ø)

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

Files with missing lines Coverage Δ
...avaparser/printer/DefaultPrettyPrinterVisitor.java 92.967% <ø> (ø)

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 8209777...42052ce. 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
Collaborator

jlerbsc commented Apr 9, 2025

Thank you for this PR. It would be easier to merge the changes if you avoided mixing several subjects in a single PR.

In fact, the preVisit/postVisit callbacks features has never been requested by the user community. So why should we include this type of evolution in the default implementation. You can integrate this using the composition pattern in your own visitor.

@johanneskloos
Copy link
Contributor Author

Thank you for this PR. It would be easier to merge the changes if you avoided mixing several subjects in a single PR.

Will do, creating two PRs for the first two commits then.

In fact, the preVisit/postVisit callbacks features has never been requested by the user community. So why should we include this type of evolution in the default implementation. You can integrate this using the composition pattern in your own visitor.

Hm, I'll try and see if I can easily implement this in my own code.

This makes it much easier to override visitor methods
@johanneskloos johanneskloos force-pushed the johanneskloos/generalize-default-pretty-printer-visitor branch from ab8fde2 to cf32717 Compare April 9, 2025 14:55
@johanneskloos johanneskloos marked this pull request as ready for review April 9, 2025 14:55
@johanneskloos
Copy link
Contributor Author

Dropped the first commit (now in PR #4718) and the third commit.

@jlerbsc
Copy link
Collaborator

jlerbsc commented Apr 11, 2025

Please create a new PR to integrate new modifications. This PR cannot be integrated in this state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.