-
Notifications
You must be signed in to change notification settings - Fork 49
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
NON-NLS more difficult example #46
base: develop
Are you sure you want to change the base?
Conversation
Ah dang :/ |
@@ -17,4 +17,6 @@ class MultilineStringConstant { | |||
"field_3," + | |||
"field_4"; | |||
|
|||
private static final String SINGLE_LINE_NON_NLS = "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for real??
I'd like to have a look at a comprehensive set of rules showing all the ways that these comments work.
- do we need an extra
//
for each$NON-NLS
instance? - does each comment map to a string literal, or could they be mapped to string constants / variables as well?
- do we only need to handle string concatenations or other AST shapes too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Yep, that's correct
- Each comment is associated with a string literal, these are string constants in source
- This applies beyond concatenation, for example
return getFoo("a", "b") //$NON-NLS-1$ //$NON-NLS-2$
could be rewritten to
return getFoo(
"a", //$NON-NLS-1$
// note that the index is updated from 2 to 1 after a line split
"b") //$NON-NLS-1$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I think for the sake of simplicity, we're going to have to force the comments to come right after each string literal + random other language tokens that are attached to it unbreakably (like ,;)
), and always give them a $NON-NLS-1$
tag as a result. Otherwise we can't be sure, at the level where we process this, that the lines won't be broken later.
How does that sound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable to me :-)
==COMMIT_MSG==
NON-NLS more difficult example
==COMMIT_MSG==