Bug 50989 - Non-externalized strings wrap lines incorrectly
Summary: Non-externalized strings wrap lines incorrectly
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 major with 1 vote (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 39465 44653 53513 54013 58999 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-30 14:40 EST by Douglas Pollock CLA
Modified: 2004-05-18 12:17 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Pollock CLA 2004-01-30 14:40:13 EST
final String happy = "string is a happy place" + "string is a happy place" +
"string is a happy place"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$

becomes

final String happy = "string is a happy place"
        + "string is a happy place" + "string is a happy place";
//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$


This breaks the externalized strings mechanism provided elsewhere in Eclipse. 
Non-externalized strings are both recognized as a quick fix and a compiler
setting.  They are requirement for all code written as part of Eclipse.

This makes the formatter unfit for developing Eclipse code.
Comment 1 Nick Edgar CLA 2004-01-30 14:58:43 EST
Wasn't this fixed in the old formatter by just refusing to wrap such lines?
This is a major regression.
Comment 2 Olivier Thomann CLA 2004-02-02 09:11:17 EST
You can always remove all wrappings.
Comment 3 Kim Horne CLA 2004-02-02 09:23:48 EST
Wrapping lines is one of the main reasons we want to use the formatter - so that
the code becomes readable at the default line width.  We want to use the default
Java formatter settings and right now they're broken because of this bug.
Comment 4 Olivier Thomann CLA 2004-02-02 09:40:17 EST
Let me clarify something. The usage of //$NON-NLS-<n>$ is clearly not a standard
way to NLS code in Java. To fix this, I need to introduce a hack in the code to
support the way Eclipse does it. What about a request to support another tag?
What will happen if the NLS tag is changing? There are bugs to chnage the format
of the tag.
Comment 5 Kim Horne CLA 2004-02-05 09:04:35 EST
Eclipse already has hacks to support it in the JDT compiler settings.  The
absence of such a tag can result in a warning or an error.  Supporting it in the
code formatter would be consistant behaviour and eclipse users (ie: us :)
already rely this behaviour from previous releases.
Comment 6 Douglas Pollock CLA 2004-02-13 12:07:31 EST
If this is your concern, then introduce a preference that defines such a string.
 By default, the NLS string format would be: "$NON-NLS-[:number]$".

But, this would be an additional feature.  As Nick points out, the current
functionality is a regression.

Any estimated time until this will be fixed?
Comment 7 Olivier Thomann CLA 2004-02-13 12:24:04 EST
No. I need to investigate how to do it without losing all the line wrapping
functionality.
Comment 8 Olivier Thomann CLA 2004-03-08 08:51:43 EST
*** Bug 54013 has been marked as a duplicate of this bug. ***
Comment 9 Philipe Mulet CLA 2004-03-08 11:49:23 EST
We want to refuse to wrap such lines. Workaround is to manually fix the code so 
that it wraps happily.

Time permitting for M9, as non prioritary.
Comment 10 Olivier Thomann CLA 2004-03-24 11:05:16 EST
*** Bug 53513 has been marked as a duplicate of this bug. ***
Comment 11 Olivier Thomann CLA 2004-03-26 12:25:21 EST
*** Bug 44653 has been marked as a duplicate of this bug. ***
Comment 12 Nick Edgar CLA 2004-04-13 22:00:50 EDT
Manually fixing up formatter errors is a non-starter.
The UI team cannot use the formatter until this bug is addressed.
Comment 13 Olivier Thomann CLA 2004-04-15 14:40:59 EDT
To answer to comment 6, this is not $NON-NLS-[:number]$, but it would be:
//$NON-NLS-[:number]$

I will add an option, but the NLS tag will be hardcoded for now. I should be
able to release a patch for next integration build.
Comment 14 Olivier Thomann CLA 2004-04-16 14:22:00 EDT
Fixed and released in HEAD.
Updated the formatter regression tests.
No options is provided. NON-NLS tags are left on the line that contains the
string literals. This takes precedence of other options. If users want other
options to be respected, they will have to fix the code manually. The code
formatter won't do comments refactoring to respect all options.
Comment 15 Philipe Mulet CLA 2004-04-19 06:26:57 EDT
*** Bug 58999 has been marked as a duplicate of this bug. ***
Comment 16 Olivier Thomann CLA 2004-04-30 16:04:01 EDT
*** Bug 39465 has been marked as a duplicate of this bug. ***
Comment 17 David Audel CLA 2004-05-18 12:17:05 EDT
Verified for 3.0M9