Community
Participate
Working Groups
I've noticed that in situations where the code formatter splits lines, it tends to do so such that quoted strings are placed on a different line to the //$NON-NLS-x$ tags that would let software know that the strings were not for internationalisation. Whilst this is because the code formatter is correctly trying to observe line length settings, it does mean that the compiler then starts whining about there being non-externalized string literals in the code because the //$NON- NLS-x$ is no longer on the same line as the hard-coded strings. The downside of this, of course, is that every time the code gets formatted, this will recur and need to be manually corrected which, in the case of a ListResourceBundle, could be a massive undertaking. Any suggestions?
For example I have some code thus: Identity[] toolsItems = new Identity[] { new TextualIdentity( "toolsMenu" ), //$NON-NLS-1$ new TextualIdentity( "toolsToolbar" ) //$NON-NLS-1$ }; but when this gets formatted, I am left with Identity[] toolsItems = new Identity[] { new TextualIdentity( "toolsMenu" ), //$NON-NLS-1$ new TextualIdentity( "toolsToolbar" ) //$NON-NLS-1$ }; Conversely (and using exactly the same code formatter settings), if I arrange the code thus: Identity[] toolsItems = new Identity[] { new TextualIdentity( "toolsMenu" ), new TextualIdentity ( "toolsToolbar" ) //$NON-NLS-1$ //$NON-NLS-2$ }; and format it, I get: Identity[] toolsItems = new Identity[] { new TextualIdentity( "toolsMenu" ), new TextualIdentity ( "toolsToolbar" ) //$NON-NLS-1$ //$NON-NLS-2$ }; This was probably obvious from my original write-up, but I thought that while I had an example to hand, I'd paste one in :)
See also bug 59000 May not be related, but have a similarity in that they both deal with end-of- line comments and the code formatter Although I am looking, in 58999 for specialised //$NON-NLS-x$ handling, and in 59000 I am highlighting a potential flaw in the "line wrapping" code formatter stuff
which build?
*** This bug has been marked as a duplicate of 50989 ***
This is in M8, with no third-party plugins