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

Add --const-as-var option

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 9
    • 9
    • core-libs
    • None
    • b13
    • generic
    • generic
    • Verified

        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().

              sundar Sundararajan Athijegannathan
              batsatt Bryan Atsatt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: