FULL PRODUCT VERSION : java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode) ADDITIONAL OS VERSION INFORMATION : Darwin c056.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64 A DESCRIPTION OF THE PROBLEM : The following code incorrectly produces `4` in Nashorn (it should produce `2`): (function(f){ return function(a1, a2, a3, a4){ return f.apply(this, arguments); } }) (function(){ return arguments.length; }) (1, 2); STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Observe that the code provided in the description produces an incorrect result when run through Nashorn. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - 2, the number of arguments with which the function is called. ACTUAL - 4, the number of formal parameters of the function. REPRODUCIBILITY : This bug can be reproduced always.
|