Repository navigation
2026.0.0 (2026.09.16)
Java access is a library too, and --no-java is gone. Java, JavaImporter, Packages and the package roots java/javax/javafx/com/org/edu are org.monflabs.nashorn.libs.JavaLibrary. An engine that was not given it has no way for a script to name a Java class.
--no-java, its-njalias,ScriptEnvironment._no_javaand the builder'sjava(boolean)are removed. The option deleted those properties again after nasgen had written them into every global's map, which is the wrong way round: not installing them is the answer, and saying nothing is now the safe outcome rather than the dangerous one.ClassFilteris unaffected and still decides class by class whatJava.typemay resolve. The two compose: the library decides whether a script can name Java classes at all, the filter decides which. Leaving the library out is not a sandbox on its own - a Java object the embedder puts in the bindings is still a Java object, with its methods reachable.- The repair for an engine that relied on the default is
.library(new JavaLibrary()). The repair for a--no-javaengine is to delete the option.
Nashorn's own globals are a library now. print, load, loadWithNewGlobal, readLine, readFully, JSAdapter and __FILE__/__DIR__/__LINE__ are no longer installed on every realm. They are org.monflabs.nashorn.libs.NashornLibrary, contributed to the builder like fetch and the timers, and a bare engine has none of them. This breaks a script that calls print on an engine built as before; the repair is one line, .library(new NashornLibrary()).
- An embedder hands a script engine to code it does not control, and every global is surface. Every realm used to carry
load, which reads files and URLs, whether or not the embedder had a use for it, and taking it away meant deleting properties after the fact. An engine now starts with what ECMAScript defines, and the rest is a decision. exitandquitare not in the library. They callSystem.exit, which is no business of a script embedded in an application, soGlobal.addExitBuiltinsholds them and only the shell installs them - on any run, a script file as much as the prompt, since choosing an exit code is what a command line does.input/evalinputstay the prompt's alone.- Java access is unchanged.
Java,Packages,JavaImporterand the package roots are still installed by default and still removed by--no-java, a switch that predates this and that embedders already use. Putting them behind the library as well would have given one job two answers. - The shell and the playground install the library themselves - a command line without
printis not a command line - and so do the script-test harness and the test262 runner, which needsprintbecause the suite's owndoneprintHandle.jsreports through it.
fetch has a response timeout. A request in flight is a pending operation on the realm's event loop, so eval returns only when it finishes - and nothing could make it finish. There is no AbortSignal, and racing the promise against a timer settles the promise while leaving the request, and the loop, exactly where they were. A server that accepted a connection and then said nothing kept an embedder waiting indefinitely.
FetchLibrarynow bounds every request atDEFAULT_RESPONSE_TIMEOUT, 30 seconds, matching the client's existing connect timeout. On expiry the promise rejects with aTypeErrorlike any other network failure, and the pending operation ends.new FetchLibrary(Duration)sets a ceiling of your own;new FetchLibrary(null)removes it, which is what the WHATWG specification describes and is reasonable for a host that supervises its own requests. The value is bound into the installed builtin, so two engines configured differently do not share one.FetchLibraryTest.aStalledServerDoesNotPinTheEventLooppins it against a local server that accepts and never answers - without the ceiling that test does not fail an assertion, it never returns.
Scripting mode and jjs are gone. The -scripting option and every syntax and global that hung off it are removed. The backquote exec syntax had already gone to template literals in 2026.0.0, and ECMAScript covers the rest: a template literal is a heredoc with interpolation, String.raw is one without, and // is a comment everywhere.
- Removed syntax: heredocs (
<<EOF,<<<EOF),#line comments, and${expr}interpolation inside double-quoted strings. - Removed globals:
$EXECwith its$OUT/$ERR/$EXITresult globals and theCommandExecutorbehind them,$ENV,$OPTIONS,$ARG, andecho. - Removed API:
NashornScriptEngineBuilder.scripting(boolean)and the parser API's"-scripting"option. readLineandreadFullywere the two genuinely useful pieces and survive as unconditional globals on every realm (IOFunctions, installed byGlobal.initIOFunctions), so a shell script need not reach for Java to read a file or a line.samples/exec.jsshows how to run a process overProcessBuilder.- The
shellmodule - thejjsREPL, never published, and the one piece that reached into JDK-internaljdk.internal.le/jdk.internal.edand so constrained which JDKs could build the reactor - is deleted.org.monflabs.nashorn.tools.Shellinnashorn-coreruns scripts, reads standard input and has a prompt of its own, and carries the--std-librariesswitch jjs used to own. The reactor is six modules.
Optimistic types are on by default. --optimistic-types shipped off through 2026.0.0, inherited from upstream 15.x, where the ES2026 engine runs Octane's crypto and navier-stokes about five times and richards about three times slower than it does with them on. With the conformance suite passing in that mode - every execution, the eight Annex B indirect-eval cases the pessimistic run still lists included - the default is flipped. An embedder gets the deoptimising, narrow-typed code without asking, and a run-once script that never gets hot can pass --optimistic-types=false (optimisticTypes(false) on the builder) to skip the recompiles.
Two things follow the flip:
- Eager compilation needs pessimistic code, so
--lazy-compilation=falsealone now turns optimistic types off rather than failing. Named together with an explicit--optimistic-types=trueit is still the error it was (Options.isSettells a named option from a defaulted one). Test262Runnerruns the default mode by default, againsttest262-expectations.txt, which lists nothing.-Dnashorn.test262.optimistic=falseruns the pessimistic slice againsttest262-expectations-pessimistic.txt, where the eight live. CI runs both.
The flip also showed that the core suite's test-optimistic execution had only ever run the engine default - TestFinder adds an explicit --optimistic-types=false for the pessimistic execution and nothing for the other - so it had been a second pessimistic run. It is a real optimistic run now, and its first real run found three more optimistic-only defects, fixed here:
- A
constbound anew in each turn of a for-of's per-iteration scope could not widen its storage type (a const is neither writable nor configurable, which is what the dual-field type change asked), so a closure over the second turn read0for"x". ++/--on aletread in its temporal dead zone typed the operationundefined, which no local can hold (an assertion), where ToNumber makes it a number.- A value of a hidden class - a Java lambda - answering an optimistic call site was given a
Typewhose name is not a descriptor the JVM accepts.
Performance. A profile of Octane on the ES2026 engine put a quarter of all samples in the generic arithmetic path - the ES2020 BigInt-aware ScriptRuntime operators coerced each Object-typed operand through the whole ToPrimitive chain and boxed a Double twice - and most allocated bytes in the char[] the Joni regexp backend copied from the subject string on every exec. Both are fixed: the operators and relationals take a number-box fast path, and a compiled regexp reuses one char[] per subject.
Alongside them:
- A lock-free regexp cache keyed by a structured key; the old weak-keyed one mostly missed.
- Geometric spill growth for wide objects, and
useDualFieldsresolved once per class. - String- and symbol-keyed
getwithout a doubleToPrimitive, and no string key built for an array miss. - One copy fewer per
sort, and a for-of loop that steps a built-in array iterator directly. Promise.prototype.thenreading the intrinsic%Promise%rather than the global property.- Shared (copy-on-write) block symbol tables across the compilation phases, substring-and-intern identifiers in the lexer, and lock-free named-operation interning in the linker.
Eight perf-gate scripts were added so the gate sees these paths at all. The measured gains, against the previous revision and against OpenJDK Nashorn 15.7, are in doc/nashorn/internals/performance.md.
Optimistic types: two fixes, and test262 in that mode. A deoptimising recompilation that threw left every thread that then called the function waiting forever on CompiledFunction's monitor: the switch point it had invalidated was never replaced, and notifyAll was only reached on success. A failed recompile now installs a fresh switch point, always notifies, and the waiters use a bounded wait that honours interruption.
What was throwing: the rest-of method of a function with a block-scoped for…of variable was rejected by the JVM ("Invalid index N in LocalVariableTable"). A continuation enters through a jump to its continuation point, so the body before it is dead code that the classfile library patches out, computing max_locals from what remains, while local variable entries had been recorded for the whole body (ASM used to grow max_locals to fit them). A rest-of method records no local variable table now.
Test262Runner takes -Dnashorn.test262.optimistic=true to run the ES2026 slice with --optimistic-types=true, which it never had. The first such run showed 2038 failing executions against the 8 settled; the families behind them are fixed in this release too:
- A deoptimised module function is re-parsed through the module goal rather than as a script.
- A private member read, a
superproperty read, asupercall, a call with a spread argument andnew.target- static runtime calls answering an Object - are no longer typed narrower by the optimistic type calculator; they came out as0. - A
BigInt64Arrayno longer reportsBigIntegeras an optimistic element type, the type evaluator no longer calls a built-in accessor with the prototype as its receiver, and a BigInt-capable operator beside an optimistic guess takes the object path (whose result isObject, whatever the operands). - A self-modifying store through an index keeps the same stack shape whatever the index's optimistic type, so the rest-of continuation restores it correctly.
A third pass fixed the 198 that were left, so the optimistic run passes every execution - the 8 Annex B indirect-eval cases the pessimistic run still lists included, since a program compiled on demand declares its vars on the global directly. It is compared against its own, empty, test262-expectations-optimistic.txt. What that pass fixed:
- A re-parsed program gets back the eager parse's nested-eval flag; a class method's direct
evalfound noeval, since the class binding it reached through sat in a bytecode local. - A lazily skipped class field initialiser keeps an empty body; a class expression in it left private-name bindings behind, tripping
AssignSymbols. - A typed array's optimistic element getters never consult the prototype for a canonical numeric index, and a double-typed read of a missing key deoptimises instead of answering
NaN. - A bitwise operator on two optimistic int guesses, and
~on one, keep their guards so a BigInt deoptimises to the BigInt path; the local-variable type pass sees the same guesses the code generator does (Expression.isOptimisticGuess()); and**evaluates both operands before converting either. ??is typedObjectwhenever an operand is a guess (undefined ?? undefinedwas0) and lands on its own type, sox = a ?? bandx += a ?? binto an int local compile.- The specialised
pushandconcatdecline a frozen array and@@isConcatSpreadable. - A Proxy's apply result reaches an optimistic call site through the return filter.
- The compile-time type evaluator leaves a
withscope alone; a Proxy'shastrap observed it. - The member access inside
(a?.b)()is not typed optimistically, and an int remainder that would be-0deoptimises.
basic/es6/optimistic-guess-operands.js pins them. Each is recorded in doc/nashorn/internals/performance.md; flipping the default is now only a warmup-cost decision.
The language target moves to ECMAScript 2026 (ECMA-262, 17th edition). Everything the 2025 release implemented is unchanged; the seven finished ES2026 additions are layered on top, and the tc39/test262 slice is retargeted to the 17th edition. RegExp.escape, which the finished-proposals list files under 2026, was already shipped in 2025.
Error.isError. Error.isError(v) is true exactly for an object with an [[ErrorData]] slot - matched here by a trap-free look for the own nashornException marker - so it sees a cross-realm error, and is not fooled by a Proxy for one, by Error.prototype, or by Object.create(Error.prototype).
Math.sumPrecise. Math.sumPrecise(iterable) returns the correctly-rounded sum of a sequence of Numbers (a TypeError for a non-Number element), computed exactly with BigDecimal so a magnitude mix like [1e20, 1, -1e20] sums to 1; -0, NaN and ±Infinity follow the spec's start value and short-circuits.
Upsert. Map.prototype.getOrInsert/getOrInsertComputed and their WeakMap forms return the value already stored under the key, or - on a miss - insert and return value (or the callback's result, the callback run only on a miss).
Iterator.concat. Iterator.concat(...items) validates each argument up front (an object with a callable @@iterator) then returns a lazy iterator helper that yields every value of each iterable in turn, opening each only when reached and closing the current one before advancing.
Uint8Array to/from base64 and hex. Uint8Array.fromBase64/fromHex and the toBase64/toHex/setFromBase64/setFromHex prototype methods, over java.util.Base64 and java.util.HexFormat, honouring the {alphabet, lastChunkHandling} and {omitPadding} options and returning {read, written} from the set* forms.
JSON source access and JSON.rawJSON. JSON.parse's reviver is handed a third context argument whose source property is the exact source text of a primitive still holding the value it was parsed from; JSON.rawJSON(text) returns a frozen, null-prototype marker that JSON.stringify emits verbatim, and JSON.isRawJSON tests it.
Array.fromAsync. Array.fromAsync(items, mapfn?, thisArg?) returns a promise for an array built from an async-iterable, a sync-iterable (each value awaited) or an array-like, awaiting each element and each mapfn result and closing the async iterator on an abrupt completion. It is event-loop-gated, like the other asynchronous entry points.
Conformance. Test262Selector moves the boundary from ES2025 to ES2026 by naming the seven new features: tags; Temporal, explicit resource management, Atomics.pause and import defer are ES2027 and stay out of scope. The settled failures return to the eight carried-over Annex B indirect-eval cases, with no performance regression. A general fix along the way, recorded with the rest in doc/CONFORMANCE.md: a Symbol this-value is now boxed for a sloppy function, as ToObject requires.
Documentation and playground. The guide, the conformance document and the change-from-upstream summary are updated for the 17th edition, and the playground gains an ES2026 sample category - one runnable sample per feature - run headlessly by the build.