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

Add --const-as-var option

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b13
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        Many existing scripts, especially node modules, use 'const' and so fail on Nashorn. As far as I can tell, a simple string replace with 'var' works just fine, but obviously Nashorn can do this much more effectively.

        A new Options argument (even undocumented) would be perfect, e.g.

        nashorn.option.const.as.var = {
            name="--const-as-var",
            is_undocumented=true,
            desc="Replace 'const' with 'var'.",
            type=Boolean
        }

        FWIW, our use case would pass it via NashornScriptEngineFactory.getScriptEngine().

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sundar Sundararajan Athijegannathan
                Reporter:
                batsatt Bryan Atsatt
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: