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

Unintuitive here document behavior with nashorn

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      This is reported via nashorn-dev openjdk alias : http://mail.openjdk.java.net/pipermail/nashorn-dev/2015-February/004203.html

      Email content cut-pasted here for reference:


      Hi

      When using a here document, statements that are on the same line as the initial <<EOD are interpreted as JavaScript & executed after the "heredoc statement". Is this a bug or a feature?

      For example:

      var a = 2;
      print(<<EOD); a = 3; print("here")
      a++;
      ${a}
      EOD
      print(a);

      prints

      a++;
      2
      here
      3

      Kind regards, Anthony

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sundar Sundararajan Athijegannathan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: