equal
deleted
inserted
replaced
45 import java.security.SecureClassLoader; |
45 import java.security.SecureClassLoader; |
46 import jdk.internal.org.objectweb.asm.ClassWriter; |
46 import jdk.internal.org.objectweb.asm.ClassWriter; |
47 import jdk.internal.org.objectweb.asm.Opcodes; |
47 import jdk.internal.org.objectweb.asm.Opcodes; |
48 import jdk.internal.org.objectweb.asm.Type; |
48 import jdk.internal.org.objectweb.asm.Type; |
49 import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; |
49 import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; |
|
50 import jdk.nashorn.api.scripting.ScriptUtils; |
|
51 import jdk.nashorn.api.scripting.ScriptObjectMirror; |
50 import jdk.nashorn.internal.runtime.Context; |
52 import jdk.nashorn.internal.runtime.Context; |
51 import jdk.nashorn.internal.runtime.ScriptFunction; |
53 import jdk.nashorn.internal.runtime.ScriptFunction; |
52 import jdk.nashorn.internal.runtime.ScriptObject; |
54 import jdk.nashorn.internal.runtime.ScriptObject; |
53 import jdk.nashorn.internal.runtime.ScriptRuntime; |
55 import jdk.nashorn.internal.runtime.ScriptRuntime; |
54 import jdk.nashorn.internal.runtime.Undefined; |
56 import jdk.nashorn.internal.runtime.Undefined; |
212 return Bootstrap.getLinkerServices().getTypeConverter(Object.class, returnType); |
214 return Bootstrap.getLinkerServices().getTypeConverter(Object.class, returnType); |
213 } |
215 } |
214 |
216 |
215 /** |
217 /** |
216 * Invoked when returning Object from an adapted method to filter out internal Nashorn objects that must not be seen |
218 * Invoked when returning Object from an adapted method to filter out internal Nashorn objects that must not be seen |
217 * by the callers. Currently only transforms {@code ConsString} into {@code String}. |
219 * by the callers. Currently only transforms {@code ConsString} into {@code String} and transforms {@code ScriptObject} into {@code ScriptObjectMirror}. |
218 * @param obj the return value |
220 * @param obj the return value |
219 * @return the filtered return value. |
221 * @return the filtered return value. |
220 */ |
222 */ |
221 public static Object exportReturnValue(final Object obj) { |
223 public static Object exportReturnValue(final Object obj) { |
222 return NashornBeansLinker.exportArgument(obj); |
224 return ScriptUtils.wrap(NashornBeansLinker.exportArgument(obj)); |
223 } |
225 } |
224 |
226 |
225 /** |
227 /** |
226 * Invoked to convert a return value of a delegate function to primitive char. There's no suitable conversion in |
228 * Invoked to convert a return value of a delegate function to primitive char. There's no suitable conversion in |
227 * {@code JSType}, so we provide our own to adapters. |
229 * {@code JSType}, so we provide our own to adapters. |