Skip to content

Commit

Permalink
Consider all supertypes for serialization constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
loicottet committed Sep 30, 2024
1 parent 9cadc84 commit 03860a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected void parseSerializationDescriptorObject(EconomicMap<String, Object> da

Object optionalCustomCtorValue = data.get(CUSTOM_TARGET_CONSTRUCTOR_CLASS_KEY);
if (optionalCustomCtorValue != null) {
RuntimeReflectionSupport.increaseCount(false);
RuntimeReflectionSupport.increaseCount(true);
}
registerType(targetSerializationClass.get(), condition.get(), optionalCustomCtorValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,11 @@ public void registerWithTargetConstructorClass(ConfigurationCondition condition,
return;
}
}
Optional.ofNullable(addConstructorAccessor(cnd, serializationTargetClass, customTargetConstructorClass))
.map(ReflectionUtil::lookupConstructor)
.ifPresent(methods -> ImageSingletons.lookup(RuntimeReflectionSupport.class).register(ConfigurationCondition.alwaysTrue(), false, methods));
for (Class<?> superclass = serializationTargetClass.getSuperclass(); superclass != null; superclass = superclass.getSuperclass()) {
Optional.ofNullable(addConstructorAccessor(cnd, serializationTargetClass, superclass))
.map(ReflectionUtil::lookupConstructor)
.ifPresent(methods -> ImageSingletons.lookup(RuntimeReflectionSupport.class).register(ConfigurationCondition.alwaysTrue(), false, methods));
}

Class<?> superclass = serializationTargetClass.getSuperclass();
if (superclass != null) {
Expand Down

0 comments on commit 03860a4

Please sign in to comment.