Skip to content

Commit 8fc9177

Browse files
committed
Use box-impl function as factory for kotlin value class
1 parent 7d112ec commit 8fc9177

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,19 @@ private List<AnnotatedMethod> _findPotentialFactories(TypeFactory typeFactory,
277277

278278
private static boolean _isIncludableFactoryMethod(Method m)
279279
{
280-
return Modifier.isStatic(m.getModifiers())
281-
// 09-Nov-2020, ckozak: Avoid considering synthetic methods such as
282-
// lambdas used within methods because they're not relevant.
283-
&& !m.isSynthetic();
280+
if (!Modifier.isStatic(m.getModifiers())) {
281+
return false;
282+
}
283+
284+
boolean isSynthetic = m.isSynthetic();
285+
boolean kotlinValueClassFactory = isSynthetic && m.getName().equals("box-impl");
286+
if (kotlinValueClassFactory) {
287+
return true;
288+
}
289+
290+
// 09-Nov-2020, ckozak: Avoid considering synthetic methods such as
291+
// lambdas used within methods because they're not relevant.
292+
return !isSynthetic;
284293
}
285294

286295
protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor,

0 commit comments

Comments
 (0)