<#264 Better way to get product elements> Pull req...
# flyte-github
a
#264 Better way to get product elements Pull request opened by honnix TL;DR Prefer using Scala 2.13's way to get product element names Type ☑︎ Bug Fix ☐ Feature ☐ Plugin Are all requirements met? ☑︎ Code completed ☑︎ Smoke tested ☑︎ Unit tests added (covered by IT) ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description Since most users should have been on Scala 2.13, we can have a better way to get product element names, with fallback to Java's way.
getDeclaredFields
from Java is less reliable, and it doesn't get super classes' declared fields. We could do that ourselves, but it is impossible to get the correct order. For case class like:
Copy code
class B(val a: String, val b: String)

case class A(override val a: String, c: String, override val b: String) extends B(a, b)
productElementNames
can correctly get
[a, c, b]
for instance of
A
, but
getDeclaredFields
can only get
c
for instance of
A
. It won't work if we try to recursively go up to get all declared fields, because we would not be able to put up a correct order where
c
appears between
a
and
b
. Tracking Issue NA Follow-up issue NA flyteorg/flytekit-java ✅ All checks have passed 3/3 successful checks