Skip to content

Conversation

@codylerum
Copy link
Contributor

Here is an initial pass at an implementation for java 15 and up String.formatted

What I'm doing here is detecting early that this is a formatted call on a string instance and just grabbing the value and all of the arguments and sending them directly to a new validate method.

The old validate method is renamed prepareAndValidate and does the work of extracting the pattern and arguments from the argument this for your traditional String#format calls

fixes #2726

Copy link
Collaborator

@cushon cushon left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@codylerum
Copy link
Contributor Author

@cushon That worked well and is a much better way of getting the pattern. I'm just not familiar enough with all the tools available when parsing the source code.

I squashed everything into one commit and updated the formatting and import order.

@codylerum codylerum requested a review from cushon January 7, 2022 19:13
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.

Support String.formatted with FormatString Bug Pattern

2 participants