Skip to content

Commit

Permalink
Use box-impl function as factory for kotlin value class
Browse files Browse the repository at this point in the history
  • Loading branch information
wplong11 committed Aug 3, 2023
1 parent 7d112ec commit 8fc9177
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,19 @@ private List<AnnotatedMethod> _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 isSynthetic = m.isSynthetic();
boolean kotlinValueClassFactory = isSynthetic && m.getName().equals("box-impl");
if (kotlinValueClassFactory) {
return true;
}

// 09-Nov-2020, ckozak: Avoid considering synthetic methods such as
// lambdas used within methods because they're not relevant.
return !isSynthetic;
}

protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor,
Expand Down

0 comments on commit 8fc9177

Please sign in to comment.