Skip to content

Commit 4464748

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

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,18 @@ 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 isKotlinValueClassFactory = m.isSynthetic() && m.getName().equals("box-impl");
285+
if (isKotlinValueClassFactory) {
286+
return true;
287+
}
288+
289+
// 09-Nov-2020, ckozak: Avoid considering synthetic methods such as
290+
// lambdas used within methods because they're not relevant.
291+
return !m.isSynthetic();
284292
}
285293

286294
protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor,

0 commit comments

Comments
 (0)