What does $NON-NLS-1$ mean?
2013-07-12 17:26
260 查看
private static final String
BUNDLE_NAME = "net.tourbook.statistics.messages";
//$NON-NLS-1$
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.
The warning in Eclipse can be turned on/off at
BUNDLE_NAME = "net.tourbook.statistics.messages";
//$NON-NLS-1$
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.
The warning in Eclipse can be turned on/off at
Window -> preferences -> java -> Compiler -> code style -> "Non-externalized Strings (missing/unused $NON-NLS$ tag).
相关文章推荐
- Discussion1: What does mandatory/required variable in a query mean?
- What does floating point error -1.#J mean?
- What does it mean by Single-Leg & Multiple Leg in Stock Trading?
- What does it mean for an algorithm to be fair
- what does mean "Units" in apple app sales report?
- What does it mean to “delegate to a sister class” via virtual inheritance?
- So, what does the asterisk(*) mean in AssemblyVersion("1.0.*")?
- Build a Simple Program Using Boost in(std::cin) : What does it mean?
- WHAT DOES “NEURONS THAT FIRE TOGETHER WIRE TOGETHER” MEAN?
- What Does SERIALIZABLE Really Mean?
- What does OpenSSL's EVP mean? OpenSSL中的EVP是什么意思?
- What does the 11 mean in INT(11)?
- What does backend type static mean in Magento?
- What does the [Flags] Enum Attribute mean in C#?
- what-does-scalable-database-mean
- what does “static int function(…) __acquires(..) __releases(…){” mean?
- What does 'grep' mean?
- What does "Vanilla" mean ?
- What does AspCompat="true" mean and when should I use it?
- What does operator “dot” (.) mean?