You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this brilliant project.
I found that some Nodejs Api which act as a builder pattern cause a cricular reference in this project which makes it crash.
NodeJS setImmediate returns Immediate, which returns self when calling ref and unref.
which make stacktrace like below
Exception in thread "main" com.caoccao.javet.exceptions.JavetConverterException: Circular structure is detected with max depth 20 reached
at com.caoccao.javet.exceptions.JavetConverterException.circularStructure(JavetConverterException.java:60)
at com.caoccao.javet.interop.converters.BaseJavetConverter.validateDepth(BaseJavetConverter.java:111)
at com.caoccao.javet.interop.converters.JavetPrimitiveConverter.toObject(JavetPrimitiveConverter.java:51)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:203)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$0(JavetObjectConverter.java:210)
at com.caoccao.javet.values.reference.V8ValueArray.forEach(V8ValueArray.java:88)
at com.caoccao.javet.values.reference.V8ValueArray.forEach(V8ValueArray.java:68)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:210)
at com.caoccao.javet.interop.converters.JavetObjectConverter.lambda$toObject$4(JavetObjectConverter.java:306)
at com.caoccao.javet.values.reference.V8ValueObject.forEach(V8ValueObject.java:310)
at com.caoccao.javet.values.reference.IV8ValueObject.forEach(IV8ValueObject.java:302)
at com.caoccao.javet.interop.converters.JavetObjectConverter.toObject(JavetObjectConverter.java:297)
at com.caoccao.javet.interop.converters.BaseJavetConverter.toObject(BaseJavetConverter.java:66)
at com.caoccao.javet.interop.V8Runtime.toObject(V8Runtime.java:3666)
at com.caoccao.javet.interop.IV8Convertible.toObject(IV8Convertible.java:58)
at com.caoccao.javet.values.reference.IV8ValueObject.invokeObject(IV8ValueObject.java:1142)
WorkAround
Just not using builder pattern or using it only in nodejs world resolve for this kind of case.
Circular reference is very annoying because how to handle it varies from case to case. That's why Javet doesn't provide any built-in support to it but throws an exception.
In this case, I suggest you call invoke() to get a V8ValueObject. That V8ValueObject allows you to do almost anything. You don't have to convert it to a Java object.
If you really want to get a Java object from it, I suggest you write your own converter to handle it. As the converter knows the JS objects well, it can better resolve the circular reference. Please review this doc for details.
By the way, it seems you want to build something big on Node.js, you may ping me at discord for real-time discussion.
Thanks for this brilliant project.
I found that some Nodejs Api which act as a builder pattern cause a cricular reference in this project which makes it crash.
and then
or
NodeJS
setImmediate
returns Immediate, which returns self when callingref
andunref
.which make stacktrace like below
WorkAround
Just not using builder pattern or using it only in nodejs world resolve for this kind of case.
or
it.getExecutor("foo.ref().unref().ref().unref()").executeVoid()
The text was updated successfully, but these errors were encountered: