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

Inline method operation drops NLS tags #1856

Closed
srikanth-sankaran opened this issue Dec 16, 2024 · 0 comments · Fixed by #1928
Closed

Inline method operation drops NLS tags #1856

srikanth-sankaran opened this issue Dec 16, 2024 · 0 comments · Fixed by #1928
Assignees
Labels
bug Something isn't working

Comments

@srikanth-sankaran
Copy link

I have a method like this:

			private char[] typeSwitchSignature(TypeBinding exprType) {
				return CharOperation.concat("(".toCharArray(), exprType.erasure().signature(), "I)I".toCharArray()); //$NON-NLS-1$ //$NON-NLS-2$
			}

and the sole call site looks like this: char[] signature = typeSwitchSignature(selectorType);

If I perform the inline method refactoring, I end up with:

char[] signature = CharOperation.concat("(".toCharArray(), selectorType.erasure().signature(), "I)I".toCharArray());

and two warnings: `Non-externalized string literal; it should be followed by //$NON-NLS

@jukzi jukzi added the bug Something isn't working label Dec 16, 2024
@jjohnstn jjohnstn self-assigned this Jan 6, 2025
jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Jan 10, 2025
- change SourceProvider.getExpressionRanges() to add in comments
  of return statement when NLS comments are present
- change CallInliner.replaceCall() to try and split the last block
  at a semi-colon in case it was created by a return statement
  that had NLS comments
- if the split results in 2 segments, try and form a new statement
  that adds the new expression and NLS comments
- add new test to InlineMethodTests
- does not handle modifying existing NLS markers at target
- fixes eclipse-jdt#1856
jjohnstn added a commit that referenced this issue Jan 11, 2025
…te (#1928)

- change SourceProvider.getExpressionRanges() to add in comments
  of return statement when NLS comments are present
- change CallInliner.replaceCall() to try and split the last block
  at a semi-colon in case it was created by a return statement
  that had NLS comments
- if the split results in 2 segments, try and form a new statement
  that adds the new expression and NLS comments
- add new test to InlineMethodTests
- does not handle modifying existing NLS markers at target
- fixes #1856
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.

3 participants