-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
WIP -- Generators and Lexical Preserving Printer #2704
Open
MysterAitch
wants to merge
116
commits into
javaparser:master
Choose a base branch
from
MysterAitch:generators_refactoring_latest
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
WIP -- Generators and Lexical Preserving Printer #2704
MysterAitch
wants to merge
116
commits into
javaparser:master
from
MysterAitch:generators_refactoring_latest
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…that those are the ones which are run directly
… and ensure that relevant imports have been added
…t then replace the removed ones
…o generators_refactoring_latest
…a csm difference calculation
…make it explicit WHICH 'parse()' method is being used within tests (many cases of per-test-specific private methods etc)
…dd a "StaleGenerated" annotation and remove that...
… currently pass due to deliberately "bad" expected string)
…s when also handling raw CSM elements (e.g. `original.elements`)
…ACE`/`RBRACE` and `indent()`/`unindent()`
…ts... just enums to go!
…. indent followed by newline, as opposed to newline followed by indent)
…ctoring_latest # Conflicts: # javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalPreservingPrinterTest.java # javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/Difference.java # javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/DifferenceElementCalculator.java
Currently has expected / known test failures per the issues described in the comment above -- there are issues with indentation when adding/removing nodes with lexical preservation enabled. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a bit muddled given that I ended up doing a bunch of printer fixes in addition to the generator stuff...
Let's see how much I can recall! 👍 👍 👍
Fixed:
Difference.MatchClassification
now has an additional option -- newline. This is used when trying to rank which differences applies (e.g. since JP now respects the line endings in the file, they're not necessarily always going to be equal, thus\r
is treated differently to\n
etc and causes problems in the "same before" and "same after" logic).ConcreteSyntaxModel
have been fixed/tweaked/reformatted.methodBody.addStatement()
) newlines aren't automatically present, thus the lexical preserving printer retains this code style and doesn't automatically insert them. For this reason, I've added aprettyPrint
method to theAbstractGenerator
that is used a few times to rectify this (i.e. where we want the generated nodes to be pretty printed, but the "other" nodes to be preserved).@Generated
now have it@Override
now have it@SuppressWarnings
(n.b.: side effect of reversing the annotation now that adding that annotation happens prior to adding the@Generated
annotation)Outstanding:
For some reason, the space between the imports and the class/enum header is removed.JavaToken.java
andObservableProperty.java
valueOf
method withinJavaToken.java
increases on every run of the generator.There is probably some tidying that is needed to be done also (offhand: probably leftover commented code, and test code that I'm not sure is in the correct test class).
Closes #1301
Replaces: #2554
Replaces: #2557