src/jdk/nashorn/api/scripting/ScriptObjectMirror.java
Print this page
*** 599,611 ****
*
* @param obj object to be wrapped/converted
* @param homeGlobal global to which this object belongs. Not used for ConsStrings.
* @return wrapped/converted object
*/
! public static Object wrap(final Object obj, final ScriptObject homeGlobal) {
if(obj instanceof ScriptObject) {
! return homeGlobal != null ? new ScriptObjectMirror((ScriptObject)obj, homeGlobal) : obj;
}
if(obj instanceof ConsString) {
return obj.toString();
}
return obj;
--- 599,611 ----
*
* @param obj object to be wrapped/converted
* @param homeGlobal global to which this object belongs. Not used for ConsStrings.
* @return wrapped/converted object
*/
! public static Object wrap(final Object obj, final Object homeGlobal) {
if(obj instanceof ScriptObject) {
! return homeGlobal instanceof ScriptObject ? new ScriptObjectMirror((ScriptObject)obj, (ScriptObject)homeGlobal) : obj;
}
if(obj instanceof ConsString) {
return obj.toString();
}
return obj;
*** 616,626 ****
*
* @param obj object to be unwrapped
* @param homeGlobal global to which this object belongs
* @return unwrapped object
*/
! public static Object unwrap(final Object obj, final ScriptObject homeGlobal) {
if (obj instanceof ScriptObjectMirror) {
final ScriptObjectMirror mirror = (ScriptObjectMirror)obj;
return (mirror.global == homeGlobal)? mirror.sobj : obj;
}
--- 616,626 ----
*
* @param obj object to be unwrapped
* @param homeGlobal global to which this object belongs
* @return unwrapped object
*/
! public static Object unwrap(final Object obj, final Object homeGlobal) {
if (obj instanceof ScriptObjectMirror) {
final ScriptObjectMirror mirror = (ScriptObjectMirror)obj;
return (mirror.global == homeGlobal)? mirror.sobj : obj;
}
*** 632,642 ****
*
* @param args array to be unwrapped
* @param homeGlobal global to which this object belongs
* @return wrapped array
*/
! public static Object[] wrapArray(final Object[] args, final ScriptObject homeGlobal) {
if (args == null || args.length == 0) {
return args;
}
final Object[] newArgs = new Object[args.length];
--- 632,642 ----
*
* @param args array to be unwrapped
* @param homeGlobal global to which this object belongs
* @return wrapped array
*/
! public static Object[] wrapArray(final Object[] args, final Object homeGlobal) {
if (args == null || args.length == 0) {
return args;
}
final Object[] newArgs = new Object[args.length];
*** 653,663 ****
*
* @param args array to be unwrapped
* @param homeGlobal global to which this object belongs
* @return unwrapped array
*/
! public static Object[] unwrapArray(final Object[] args, final ScriptObject homeGlobal) {
if (args == null || args.length == 0) {
return args;
}
final Object[] newArgs = new Object[args.length];
--- 653,663 ----
*
* @param args array to be unwrapped
* @param homeGlobal global to which this object belongs
* @return unwrapped array
*/
! public static Object[] unwrapArray(final Object[] args, final Object homeGlobal) {
if (args == null || args.length == 0) {
return args;
}
final Object[] newArgs = new Object[args.length];