-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
The uncurryThis
helper introduced in fcbc2c8 is incompatible with Nashorn. When loading the endsWith
polyfill, I receive this error:
TypeError: [jdk.dynalink.beans.SimpleDynamicMethod boolean java.lang.String.endsWith(String)] is not a function
Minimal repro in jRuby:
require 'java'
java_import 'javax.script.ScriptEngineManager'
engine = ScriptEngineManager.new.get_engine_by_name('nashorn')
bindings = engine.create_bindings
engine.eval("var uncurryThis = Function.prototype.call.bind(Function.prototype.call); var nativeEndsWith = uncurryThis(''.endsWith);", bindings)
Note that
> engine.eval("'foo'.endsWith('o')", bindings)
=> true
> engine.eval("''.endsWith", bindings)
=> #<Java::JdkDynalinkBeans::SimpleDynamicMethod:0x33f349ae>
> engine.eval("String.prototype.endsWith", bindings)
=> nil
Prior 3.19, a different error is produced:
Java::JavaLang::AssertionError: unknown call type GET:METHOD|PROPERTY|ELEMENT:call(Object)[email protected]$Recompilation$6803$\^eval\_