Project: JDT
Bug 247012 [nls tooling] Find Broken Externalized Strings could handle constants for message keys
Reported: 2008-09-11 09:17:28 | Status: verified fixed

If I externalize strings using non-Eclipse-style, then change the literal key strings in the code to constants, the Find Broken Externalized Strings function reports such keys as undefined in the code, and unused in the properties file. For example, with this class, public class Main { private static final String MAIN_INDIRECT = "Main.indirect"; public static void main(String[] args) { System.out.println(Messages.getString("Main.direct")); //$NON-NLS-1$ System.out.println(Messages.getString(MAIN_INDIRECT)); //$NON-NLS-1$ } } the "Main.indirect" key is reported as undefined and unused. We have a lot of externalized strings, can't use Eclipse-style externalization, and like to have the keys defined as constants for improved readability and maintainability. It's unfortunate to lose the ability to check for broken string externalization.

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/search/NLSSearchResultRequestor.java