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

Minor API convenience functions on "Java" object

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b23
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Please consider adding the isScriptObject(), isJavaObject() and isJavaFunction() functions as API (NativeJava? ScriptUtils?). There does not appear to be an efficient way to implement them in JS without using internal types, e.g.:

        var ScriptObject = Java.type('jdk.nashorn.internal.runtime.ScriptObject');

        var isScriptObject = function(obj) {
            return obj instanceof ScriptObject;
        };

        var isJavaObject = function(obj) {
            return Java.isType(obj.class) || !isScriptObject(obj);
        };

        var isJavaFunction = function(fn) {
            return typeof fn === 'function' && isJavaObject(fn);
        };

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sundar Sundararajan Athijegannathan
                  Reporter:
                  batsatt Bryan Atsatt
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: