Skip to content

Commit

Permalink
fix(bridge): Avoid loops related to static instance fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed Aug 16, 2024
1 parent 0383205 commit f466d9e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit f466d9e

Please sign in to comment.