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

Nashorn user guide, section 4.5: improve Object.bindProperties() specification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • 8u31
    • docs
    • x86
    • windows_8

      A DESCRIPTION OF THE PROBLEM :
      In the explanation of the Object.bindProperties() function, it should be noted that only properties of the second passed-in object "that do not exist in the first passed-in object yet" are bound.

      The following example shows that changing the value of the global x does not change the value of obj.x, even though Object.bindProperties(this,obj) was done:

      jjs> x = 2;
      2
      jjs> var obj = {x:3}
      jjs> Object.bindProperties(this,obj)
      [object global]
      jjs> x
      2
      jjs> x = 4
      4
      jjs> obj.x
      3


      URL OF FAULTY DOCUMENTATION :
      http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/shell.html#sthref28

            rgallard Raymond Gallardo
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: