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

Add --const-as-var option

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • 9
    • 9
    • core-libs
    • None
    • b13
    • generic
    • generic
    • 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

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

                Dates

                  Created:
                  Updated:
                  Resolved: