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

Not all callables are handled for toString and other function valued properties

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs
    • None
    • b102
    • generic
    • generic
    • Verified

      var a = {}
      var obj = new java.util.HashMap();
      Object.bindProperties(a, obj);
      // Java method toString is bound to "a" as a property
      try {
          print(a);
      } catch (e) {
          print(e);
      }

      var a = {}
      var global = loadWithNewGlobal({ name:"xx", script: "this" });
      var obj = global.eval("({ toString: function() { return 'hello'; } })");

      // ScriptObjectMirror's toString is bound as a property for "a"
      Object.bindProperties(a, obj);
      try {
          print(a);
      } catch (e) {
          print(e);
      }

      TypeError is thrown in such cases.
       
      TypeError: Cannot get default string value
      TypeError: Cannot get default string value


      All 'callables' - not just ScriptFunction instances - should be handled uniformly ( Java dynamic method, ScriptObjectMirror's function property etc.)

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: