Skip to content

Commit 7291f1e

Browse files
authored
fix: scala support and usercode loading refactor were breaking reloading (#890)
1 parent 3ac5f50 commit 7291f1e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/gd_kotlin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ void GDKotlin::unload_user_code() {
336336
bootstrap_class_loader->set_as_context_loader(env);
337337

338338
bootstrap->finish(env);
339-
TypeManager::get_instance().clear();
340339
jar.unref();
341340
}
342341

@@ -400,7 +399,8 @@ void GDKotlin::initialize_up_to(State target_state) {
400399
}
401400

402401
void GDKotlin::finalize_down_to(State target_state) {
403-
UNSET_LOADING_STATE(unload_user_code(), CORE_LIBRARY_INITIALIZED, target_state)
402+
UNSET_LOADING_STATE(unload_user_code(), ENGINE_TYPES_INITIALIZED, target_state)
403+
UNSET_LOADING_STATE(TypeManager::get_instance().clear(), CORE_LIBRARY_INITIALIZED, target_state)
404404
UNSET_LOADING_STATE(finalize_core_library(), BOOTSTRAP_LOADED, target_state)
405405
UNSET_LOADING_STATE(unload_boostrap(), JVM_STARTED, target_state)
406406
#ifdef DYNAMIC_JVM
@@ -414,7 +414,7 @@ void GDKotlin::finalize_down_to(State target_state) {
414414
#ifdef TOOLS_ENABLED
415415
void GDKotlin::reload_user_code() {
416416
if (user_configuration.vm_type == jni::JvmType::JVM) {
417-
finalize_down_to(BOOTSTRAP_LOADED);
417+
finalize_down_to(ENGINE_TYPES_INITIALIZED);
418418
initialize_up_to(JVM_SCRIPTS_INITIALIZED);
419419
}
420420
}

src/script/jvm_script_manager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void JvmScriptManager::create_and_update_scripts(Vector<KtClass*>& classes) {
102102

103103
for (KtClass* kotlin_class : classes) {
104104
fqdn_to_kt_class_ref[kotlin_class->fqdn] = kotlin_class;
105+
fqdn_to_name_map[kotlin_class->fqdn] = kotlin_class->registered_class_name;
105106

106107
#ifdef TOOLS_ENABLED
107108

0 commit comments

Comments
 (0)