Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does $NON-NLS-1$ mean?

In Eclipse source code, I've found some '$NON-NLS-1$' in comments used like that :

private String toolTip = ""; //$NON-NLS-1$ 

What does that mean ?

like image 634
paulgreg Avatar asked Mar 17 '09 12:03

paulgreg


1 Answers

They silence a warning that Eclipse emits when it encounters string literals (and has been configured to complain).

The idea is that UI messages should not be embedded as string literals, but rather sourced from a resource file (so that they can be translated, proofed, etc). Consequently, Eclipse can be configured to detect string literals, so that you don't accidentally have leave unexternalized UI strings in the code; however, there are strings which should not be externalized (such as regexps) and so, //$NON-NLS-1$ gives you a way to communicate that fact to the compiler.

like image 97
Aaron Maenpaa Avatar answered Sep 29 '22 11:09

Aaron Maenpaa