Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the number after //$NON-NLS- mean

This is a follow up question to: What does $NON-NLS-1$ mean?

I've noticed that the comment tag will be recognized as a NLS tag when you use any number. However, only the number 1 seems to correctly fixed the warning. (Silenced warning vs. unsilenced warning + unnecessary nls tag)

What is the purpose of this?

like image 842
Alex Gittemeier Avatar asked Aug 06 '13 18:08

Alex Gittemeier


People also ask

What does non NLS 1 mean?

Non-externalized strings (missing/unused $NON-NLS$ tag)

What is NonNls?

@Documented@Retention(value=CLASS)@Target(value={METHOD,FIELD,PARAMETER,LOCAL_VARIABLE,TYPE,PACKAGE})public @interface NonNls. Specifies that an element of the program is not a user-visible string which needs to be localized, or does not contain such strings.


1 Answers

The number after $NON-NLS- signifies which string on the tagged line the tag is for. The number 1 works for you, likely because there is only 1 string on the line you are trying to tag.

If you had 2 strings on the same line, you can, for example, tag only the second string using $NON-NLS-2$.

//Warning on "baz"
foo("bar","baz"); //$NON-NLS-1$

//Warning on "bar"
foo("bar","baz"); //$NON-NLS-2$

//No warnings
foo("bar","baz"); //$NON-NLS-1$  //$NON-NLS-2$

//Warning on "baz" (apparently the slashes are required even with multiple tags)
foo("bar","baz"); //$NON-NLS-1$  $NON-NLS-2$
like image 103
Alex Gittemeier Avatar answered Nov 13 '22 00:11

Alex Gittemeier