Skip to content

Commit 2a694fb

Browse files
committed
fix: revert to synchronized maps for loadedJavaScriptExtends to resolve InvocationTargetException
1 parent d6e2afe commit 2a694fb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test-app/runtime/src/main/java/com/tns/Runtime.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,13 @@ public Runtime(StaticConfiguration config, DynamicConfiguration dynamicConfigura
220220
if (config.appConfig.getEnableMultithreadedJavascript()) {
221221
this.strongInstances = new ConcurrentHashMap<>();
222222
this.weakInstances = new ConcurrentHashMap<>();
223-
this.loadedJavaScriptExtends = new ConcurrentHashMap<Class<?>, JavaScriptImplementation>();
224-
this.strongJavaObjectToID = Collections.synchronizedMap(new NativeScriptHashMap<Object, Integer>());
225-
this.weakJavaObjectToID = Collections.synchronizedMap(new NativeScriptWeakHashMap<Object, Integer>());
223+
// TODO: figure out why using a concurrent map for loadedJavaScriptExtends
224+
// results in a fail of TestCanFindImplementationObjectWhenCreateExtendedObjectFromJava
225+
// with java.lang.reflect.InvocationTargetException
226+
// but works with synchronizeMap
227+
this.loadedJavaScriptExtends = Collections.synchronizedMap(new HashMap<>());
228+
this.strongJavaObjectToID = Collections.synchronizedMap(new NativeScriptHashMap<>());
229+
this.weakJavaObjectToID = Collections.synchronizedMap(new NativeScriptWeakHashMap<>());
226230
}
227231

228232
classResolver = new ClassResolver(classStorageService);

0 commit comments

Comments
 (0)