Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6304521

Request extension of Java language to support annotated strings

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • specification
    • x86
    • windows_xp

      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.

            abuckley Alex Buckley
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: