Note that {@code HostAccess.Export} entries are not detected by the Native Image Agent {@code
+ * -agentlib:native-image-agent} and should be manually listed in the reflect-config.json.
*/
public final class URL {
diff --git a/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/Util.java b/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/Util.java
index 6cd771f474..dc8685116a 100644
--- a/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/Util.java
+++ b/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/Util.java
@@ -3,8 +3,10 @@ package org.enso.ydoc.polyfill.web;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
+import org.enso.ydoc.Polyfill;
import org.enso.ydoc.polyfill.Arguments;
-import org.enso.ydoc.polyfill.PolyfillBase;
+import org.graalvm.polyglot.Context;
+import org.graalvm.polyglot.Source;
import org.graalvm.polyglot.Value;
import org.graalvm.polyglot.io.ByteSequence;
import org.graalvm.polyglot.proxy.ProxyExecutable;
@@ -12,7 +14,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** Implements the Util Node.js API. */
-final class Util extends PolyfillBase implements ProxyExecutable {
+final class Util implements Polyfill, ProxyExecutable {
private static final Logger log = LoggerFactory.getLogger(Util.class);
@@ -21,8 +23,11 @@ final class Util extends PolyfillBase implements ProxyExecutable {
private static final String UTIL_JS = "util.js";
- Util() {
- super(UTIL_JS);
+ @Override
+ public void initialize(Context ctx) {
+ Source jsSource = Source.newBuilder("js", getClass().getResource(UTIL_JS)).buildLiteral();
+
+ ctx.eval(jsSource).execute(this);
}
@Override
diff --git a/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/WebSocket.java b/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/WebSocket.java
index ad423c31f9..f2eb4ef5e4 100644
--- a/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/WebSocket.java
+++ b/lib/java/ydoc-server/src/main/java/org/enso/ydoc/polyfill/web/WebSocket.java
@@ -15,8 +15,10 @@ import java.util.Arrays;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
+import org.enso.ydoc.Polyfill;
import org.enso.ydoc.polyfill.Arguments;
-import org.enso.ydoc.polyfill.PolyfillBase;
+import org.graalvm.polyglot.Context;
+import org.graalvm.polyglot.Source;
import org.graalvm.polyglot.Value;
import org.graalvm.polyglot.io.ByteSequence;
import org.graalvm.polyglot.proxy.ProxyExecutable;
@@ -27,7 +29,7 @@ import org.slf4j.LoggerFactory;
* Implements the WebSocket and WebSocketServer interfaces of the ws NPM package.
*/
-final class WebSocket extends PolyfillBase implements ProxyExecutable {
+final class WebSocket implements Polyfill, ProxyExecutable {
private static final Logger log = LoggerFactory.getLogger(WebSocket.class);
@@ -47,10 +49,16 @@ final class WebSocket extends PolyfillBase implements ProxyExecutable {
private final ExecutorService executor;
WebSocket(ExecutorService executor) {
- super(WEBSOCKET_JS);
this.executor = executor;
}
+ @Override
+ public void initialize(Context ctx) {
+ Source jsSource = Source.newBuilder("js", getClass().getResource(WEBSOCKET_JS)).buildLiteral();
+
+ ctx.eval(jsSource).execute(this);
+ }
+
@Override
public Object execute(Value... arguments) {
var command = arguments[0].asString();
diff --git a/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/jni-config.json b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/jni-config.json
new file mode 100644
index 0000000000..966d955849
--- /dev/null
+++ b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/jni-config.json
@@ -0,0 +1,21 @@
+[
+{
+ "name":"java.lang.Boolean",
+ "methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }]
+},
+{
+ "name":"java.lang.Class",
+ "methods":[{"name":"getClassLoader","parameterTypes":[] }]
+},
+{
+ "name":"java.lang.ClassLoader",
+ "methods":[{"name":"loadClass","parameterTypes":["java.lang.String"] }]
+},
+{
+ "name":"jdk.internal.loader.ClassLoaders$AppClassLoader"
+},
+{
+ "name":"sun.management.VMManagementImpl",
+ "fields":[{"name":"compTimeMonitoringSupport"}, {"name":"currentThreadCpuTimeSupport"}, {"name":"objectMonitorUsageSupport"}, {"name":"otherThreadCpuTimeSupport"}, {"name":"remoteDiagnosticCommandsSupport"}, {"name":"synchronizerUsageSupport"}, {"name":"threadAllocatedMemorySupport"}, {"name":"threadContentionMonitoringSupport"}]
+}
+]
diff --git a/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/predefined-classes-config.json b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/predefined-classes-config.json
new file mode 100644
index 0000000000..0e79b2c5d8
--- /dev/null
+++ b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/predefined-classes-config.json
@@ -0,0 +1,8 @@
+[
+ {
+ "type":"agent-extracted",
+ "classes":[
+ ]
+ }
+]
+
diff --git a/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/proxy-config.json b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/proxy-config.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/proxy-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/reflect-config.json b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/reflect-config.json
new file mode 100644
index 0000000000..2bd3ef7845
--- /dev/null
+++ b/lib/java/ydoc-server/src/main/resources/META-INF/native-image/org/enso/ydoc/reflect-config.json
@@ -0,0 +1,261 @@
+[
+{
+ "name":"ch.qos.logback.classic.encoder.PatternLayoutEncoder",
+ "queryAllPublicMethods":true,
+ "methods":[{"name":"