Skip to content

Commit

Permalink
ignore string type in erasure helper
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Feb 1, 2024
1 parent 4d9b1b8 commit d7597aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ private[converter] object ErasureHelper {
val maybeClass: Option[Class[_]] = prop.typeSignature.typeArgs.headOption.flatMap { signature =>
if (signature.typeSymbol.isClass) {
signature.typeArgs.headOption match {
case Some(typeArg) => Option(mirror.runtimeClass(nestedTypeArg(typeArg)))
case Some(typeArg) => {
val resultType = nestedTypeArg(typeArg)
if (resultType.toString == "String") None else Option(mirror.runtimeClass(resultType))
}
case _ => Option(mirror.runtimeClass(signature))
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ class ErasureHelperTest extends AnyFlatSpec with Matchers {
it should "handle OptionSeqOptionLong" in {
ErasureHelper.erasedOptionalPrimitives(classOf[OptionSeqOptionLong]) shouldBe Map("values" -> classOf[Long])
}
it should "handle OptionSetString" in {
ErasureHelper.erasedOptionalPrimitives(classOf[OptionSetString]) shouldBe Map.empty
}
}

0 comments on commit d7597aa

Please sign in to comment.