fix: parsing and merging of literals in InstantPatternDynamicFormatter
#3932
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 PR fixes edge cases involving the apostrophe (
'
) in pattern literals. Previously, certain inputs produced unintended escaped apostrophes (''
) at fragment boundaries or misinterpreted doubled quotes inside quoted blocks.What’s changed
''
as a literal apostrophe inside quoted sections.'
and the right starts with'
, we now drop the left closing quote and the right opening quote to keep a single continuous quoted block, avoiding an unintended literal''
.Rationale
DateTimeFormatter
uses'...'
to denote literals and''
to escape a literal apostrophe. When two quoted literal blocks are concatenated naïvely, a...''...
boundary can be produced, whichDateTimeFormatter
reads as a literal apostrophe, not close+open delimiters.Closes #3930.
Checklist
Before we can review and merge your changes, please go through the checklist below. If you're still working on some items, feel free to submit your pull request as a draft—our CI will help guide you through the remaining steps.
✅ Required checks
License: I confirm that my changes are submitted under the Apache License, Version 2.0.
Commit signatures: All commits are signed and verifiable. (See GitHub Docs on Commit Signature Verification).
Code formatting: The code is formatted according to the project’s style guide.
How to check and fix formatting
./mvnw spotless:check
./mvnw spotless:apply
See the build instructions for details.
Build & Test: I verified that the project builds and all unit tests pass.
How to build the project
Run:
./mvnw verify
See the build instructions for details.
🧪 Tests (select one)
📝 Changelog (select one)
src/changelog/.2.x.x
. (See Changelog Entry File Guide).