diff --git a/src/me/topchetoeu/jscript/engine/values/Values.java b/src/me/topchetoeu/jscript/engine/values/Values.java index 4f4b967..f340f5d 100644 --- a/src/me/topchetoeu/jscript/engine/values/Values.java +++ b/src/me/topchetoeu/jscript/engine/values/Values.java @@ -449,7 +449,7 @@ public class Values { } if (clazz.isArray()) { var raw = array(obj).toArray(); - Object res = Array.newInstance(clazz.arrayType(), raw.length); + Object res = Array.newInstance(clazz.getComponentType(), raw.length); for (var i = 0; i < raw.length; i++) Array.set(res, i, convert(ctx, raw[i], Object.class)); return (T)res; } diff --git a/src/me/topchetoeu/jscript/interop/OverloadFunction.java b/src/me/topchetoeu/jscript/interop/OverloadFunction.java index 00c3e75..38a80ac 100644 --- a/src/me/topchetoeu/jscript/interop/OverloadFunction.java +++ b/src/me/topchetoeu/jscript/interop/OverloadFunction.java @@ -31,7 +31,7 @@ public class OverloadFunction extends FunctionValue { } if (overload.variadic) { - var type = overload.params[overload.params.length - 1].componentType(); + var type = overload.params[overload.params.length - 1].getComponentType(); var n = Math.max(args.length - end + start, 0); Object varArg = Array.newInstance(type, n); diff --git a/src/me/topchetoeu/jscript/polyfills/JSON.java b/src/me/topchetoeu/jscript/polyfills/JSON.java index 34fcdd1..b9aa27f 100644 --- a/src/me/topchetoeu/jscript/polyfills/JSON.java +++ b/src/me/topchetoeu/jscript/polyfills/JSON.java @@ -1,6 +1,7 @@ package me.topchetoeu.jscript.polyfills; import java.util.HashSet; +import java.util.stream.Collectors; import me.topchetoeu.jscript.engine.CallContext; import me.topchetoeu.jscript.engine.values.ArrayValue; @@ -18,7 +19,7 @@ public class JSON { if (val.isBoolean()) return val.bool(); if (val.isString()) return val.string(); if (val.isNumber()) return val.number(); - if (val.isList()) return ArrayValue.of(val.list().stream().map(JSON::toJS).toList()); + if (val.isList()) return ArrayValue.of(val.list().stream().map(JSON::toJS).collect(Collectors.toList())); if (val.isMap()) { var res = new ObjectValue(); for (var el : val.map().entrySet()) {