Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 499794

Summary: Breaking up a long string constant causes editor anomaly
Product: [Eclipse Project] JDT Reporter: Rob Lewis <groblewis>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana
Version: 4.6   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Rob Lewis CLA 2016-08-17 00:09:44 EDT
I have a String variable set to equal a very long String literal, enclosed in quotes (and containing many backslash-escaped quote characters). 

String myString = "lots and lots of text including many backslash-escaped quote characters"; 

I am breaking it up into smaller pieces in my source code, which are concatenated to create the whole string. In the editor, I find a place to break the string, type " then + then <return> then ". 

String myString = "First part of text "+
    "next part of text"+ // etc. 

Sometimes this works fine to restart the string on the next line. Often, however, the newly-created line begins with TWO quote marks in a row, generating an error condition. If I delete the second, spurious quote mark, everything is OK. 


-- Configuration Details --
Product: Eclipse 4.6.0.20160613-1800 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.platform 4.6.0.v20160606-1342
 
 P.S. May I say that your bug report form is very hostile to users who aren't intimately familiar with the Eclipse project? How on earth am I supposed to know what to enter for the "Product" and "Component" fields?
Comment 1 Jay Arthanareeswaran CLA 2016-08-17 00:44:07 EDT
Rob, have you tried just pressing a return? That should take care of breaking the string into a separate line. This works for me every single time. And I believe this is the right way to do it.
Comment 2 Rob Lewis CLA 2016-08-17 03:13:17 EDT
Wow, who knew?! 

Seems to work great. Thanks! 

But doing it the way I described shouldn't cause problems, should it?
Comment 3 Eclipse Genie CLA 2020-02-17 17:16:49 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.