[JEP 513] Add support for flexible constructor bodies#4919
Conversation
|
@jlerbsc I would like to discuss some things regarding the project with you (how we could best collaborate, etc.) and sent you a message on the JavaParser Gitter to that effect. Since that doesn't seem to be a platform either of us uses regularly, feel free to contact me via email (should be visible in my commit information) or suggest a suitable platform if you're interested :) |
2bea554 to
0e6f25b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4919 +/- ##
===============================================
+ Coverage 58.430% 58.445% +0.015%
Complexity 2560 2560
===============================================
Files 689 689
Lines 39543 39553 +10
Branches 7173 7176 +3
===============================================
+ Hits 23105 23117 +12
+ Misses 13498 13497 -1
+ Partials 2940 2939 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
Does this seem correct to me? Can I merge this PR? |
I have replied to your message on Gitter. I hope you find my answers helpful. |
Yes, this can be merged if you're satisfied with it |
|
Thank you for this contribution. |
Fixes #4849
Replaces #4903
This PR removes the restriction that explicit constructor invocations must appear as the first statement in a constructor body. See https://openjdk.org/jeps/513 for more details regarding the motivations behind this change.
The grammar change was inspired by #4903 opened by @rpx99, although I did add my own comment explaining why handling it this way should be fine, even if it isn't 100% correct according to the JLS (we handle compiling code correctly, but also parse some non-compiling code without reporting errors; if users choose to parse non-compiling code, then they will need to do their own validation according to their needs).
I've also included a simplified validator compared to #4903 with validator tests and AST tests.
Finally, I've also included pretty printer and LPP tests, but didn't need to update either of those to support this.