gzoller/scala-reflection

handling of `sealed abstract class`

Closed this issue · 2 comments

In the code sample, below it would be great if this lib could produce an RType for the Animal class that exposes the 'children' sub types in a similar way to how SealedTraitInfo works.

sealed abstract class Animal {
  val name: String
  val animalType: String = "Animal"
}

class Dog(val name: String) extends Animal {
  override val animalType: String = "Dog"
}

class Cat(val name: String) extends Animal {
  override val animalType: String = "Cat"
}

Currently RType.of(classOf[Animal]) returns:

ScalaClassInfo(com.github.pjfanning.jackson.reflection.annotated.Animal):
   fields:
   non-constructor fields:
   annotations:

I have a fix for this in https://github.com/pjfanning/scala3-reflection v1.2.0 release

Rolled pfjanning's fix into feature branch. Will be available in next release. Sorry for the delay! Caught up in work.