if we have a look into the bytecode produced by this case class compilation
case class Person(name: String, age: Int)
we get besides others this method:
public scala.collection.Iterator<java.lang.String> productElementNames();
So, the question is, where it comes from and why it can not be called on a Person's instance like, for instance the other one from the same compiled class
public scala.collection.Iterator<java.lang.Object> productIterator();
I use this versions:
$ scala -version
Scala code runner version 2.13.8 -- Copyright 2002-2021, LAMP/EPFL and Lightbend, Inc.
$ scalac -version
Scala compiler version 2.13.8 -- Copyright 2002-2021, LAMP/EPFL and Lightbend, Inc.