United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6304521 : Request extension of Java language to support annotated strings

Details
Type:
Enhancement
Submit Date:
2005-08-01
Status:
Closed
Updated Date:
2010-04-04
Project Name:
JDK
Resolved Date:
2006-11-17
Component:
specification
OS:
windows_xp
Sub-Component:
language
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
5.0
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

Description
A DESCRIPTION OF THE REQUEST :
Some other languages (e.g. Perl, C#) have support for annotated or verbatim strings. A double quoted string immediately prefixed with an at-sign, thus:

@""

does not escape any characters so allowing verbatim text blocks to be defined easily.

JUSTIFICATION :
Advantages:

(1) Very useful for handling large amounts of text
(2) Has been used successfully in other languages so well known
(3) Should be quite easy to implement
(4) Easy to learn, remember and use
(5) Should not break any existing syntactic elements

Disadvatntages:

(1) One extra syntax element to learn and remember
(2) Would require a language and VM change which affects backwards compatibility

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Can quote literal strings including CRs, \s and other common characters without escaping.
ACTUAL -
Not possible in current implementations without using escapes. Clumsy and error prone for large text blocks.

CUSTOMER SUBMITTED WORKAROUND :
Use escapes.

                                    

Comments
EVALUATION

One of numerous requests for improved handling of literals.
                                     
2006-11-17



Hardware and Software, Engineered to Work Together