From 44647481e1fbf30cc067d2dc113e99a290bcaa1d Mon Sep 17 00:00:00 2001 From: Donghyeon Kim Date: Fri, 4 Aug 2023 01:53:00 +0900 Subject: [PATCH] Use box-impl function as factory for kotlin value class --- .../introspect/AnnotatedCreatorCollector.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java index b5c3f39d47..4007759fce 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java @@ -277,10 +277,18 @@ private List _findPotentialFactories(TypeFactory typeFactory, private static boolean _isIncludableFactoryMethod(Method m) { - return Modifier.isStatic(m.getModifiers()) - // 09-Nov-2020, ckozak: Avoid considering synthetic methods such as - // lambdas used within methods because they're not relevant. - && !m.isSynthetic(); + if (!Modifier.isStatic(m.getModifiers())) { + return false; + } + + boolean isKotlinValueClassFactory = m.isSynthetic() && m.getName().equals("box-impl"); + if (isKotlinValueClassFactory) { + return true; + } + + // 09-Nov-2020, ckozak: Avoid considering synthetic methods such as + // lambdas used within methods because they're not relevant. + return !m.isSynthetic(); } protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor,