Java – is there any way to set a “/ / $non-nls” comment for all strings in one line?
•
Java
Does anyone know if you can set a / / $non-nls annotation tag for all strings in a line in Java... It might be like this:
String[][] info = new String[][]{ {"a1","a2"},{"b1","b2"},{"c1","c2"},{"d1","d2"} //$NON-NLS-ALL$ };
I want to stop this long code:
String[][] info = new String[][]{ {"a1","d2"} //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$ };
thank you
Solution
I don't think you can use the / / $non-nls annotation to make this work, but you can suppress the NLS warning of the entire variable declaration:
@SuppressWarnings("nls") String[][] info = new String[][] { {"a1","d2"} };
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码