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

Fix string concat to MessageFormat and String.format quick-fixes to escape necessary characters #1366

Closed
jjohnstn opened this issue Apr 24, 2024 · 0 comments · Fixed by #1368
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jjohnstn
Copy link
Contributor

When converting a string concat to MessageFormat or String.format, certain characters must be escaped properly.

For MessageFormat, single quotes must be represented by ''. This is already done by the code. Open and close parentheses ({ and }) must be escaped by surrounding them in single quotes ('{' and '}'). The sequence {} must be represented as '{}' as '{''}' is actual {'}.

For String.format, the % character must be escaped by a double %%.

@jjohnstn jjohnstn self-assigned this Apr 24, 2024
@jjohnstn jjohnstn added the bug Something isn't working label Apr 24, 2024
@jjohnstn jjohnstn added this to the 4.32 M2 milestone Apr 24, 2024
jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Apr 24, 2024
- for MessageFormat, put parentheses in single quotes and look for
  open/closed parentheses one after another
- for String.format, escape % as %%
- modify tests in AssistQuickFixTest15
- fixes eclipse-jdt#1366
jjohnstn added a commit that referenced this issue Apr 24, 2024
…1368)

- for MessageFormat, put parentheses in single quotes and look for
  open/closed parentheses one after another
- for String.format, escape % as %%
- modify tests in AssistQuickFixTest15
- fixes #1366
jjohnstn added a commit to jjohnstn/www.eclipse.org-eclipse that referenced this issue Apr 25, 2024
vogella pushed a commit to eclipse-platform/www.eclipse.org-eclipse that referenced this issue Apr 26, 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
None yet
Development

Successfully merging a pull request may close this issue.

1 participant