Skip to content
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

Parse property values starting with the delimiter character #4065

Merged
merged 2 commits into from
Mar 2, 2024

Conversation

Bananeweizen
Copy link
Contributor

What's changed?

In the state machine of the properties parser do not accept further delimiters after the first non escaped delimiter was found.

What's your motivation?

Fixes #4026.

Anything in particular you'd like reviewers to focus on?

The actual bug fix is in the first commit, so you may want to review it separately. The second commit removes all arithmetic from the state variable and gives readable names to the states to make debugging more simple for the next one looking into this.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

Avoid arithmetic operations with the state variable and rather assign
the new value. Also convert to enum to make the states more easy to
understand for the next author.
Copy link
Contributor

@knutwannheden knutwannheden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I like what you did with the enum there. Also went through my mind last time I worked on this.

@knutwannheden knutwannheden merged commit ba636bb into openrewrite:main Mar 2, 2024
1 check passed
@Bananeweizen Bananeweizen deleted the properties branch March 2, 2024 08:02
@timtebeek timtebeek added the bug Something isn't working label Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

foo.properties is not print idempotent due to key==value
3 participants