From f466d9ebe165adb1ccf948c6b23bfe6742d48d54 Mon Sep 17 00:00:00 2001 From: e3ndr <33337309+e3ndr@users.noreply.github.com> Date: Fri, 16 Aug 2024 00:46:12 -0500 Subject: [PATCH] fix(bridge): Avoid loops related to static instance fields. --- .../java/co/casterlabs/saucer/_impl/ImplSaucerBridge.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/src/main/java/co/casterlabs/saucer/_impl/ImplSaucerBridge.java b/api/src/main/java/co/casterlabs/saucer/_impl/ImplSaucerBridge.java index 2430810..ba218be 100644 --- a/api/src/main/java/co/casterlabs/saucer/_impl/ImplSaucerBridge.java +++ b/api/src/main/java/co/casterlabs/saucer/_impl/ImplSaucerBridge.java @@ -3,6 +3,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Field; +import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -171,6 +172,10 @@ public synchronized void defineObject(@NonNull String name, @NonNull Object obj) // Look for sub-objects and register them. // Note that this recurses until there are no more sub-objects. for (Field f : obj.getClass().getFields()) { + if (Modifier.isStatic(f.getModifiers())) { + continue; + } + if (f.getType().isAnnotationPresent(JavascriptObject.class)) { this.defineObject(name + "." + f.getName(), f.get(obj)); }