I can get the formal type parameters (type variables) of any Java class/interface, including those defined in Scala, through java.lang.reflect API.
In addition, Scala allows to define type parameters of its classes as contravariant or covariant, information which is not present in JLS. The conventional wisdom is thus that one needs to use Scala 2 TypeTags to access this information, as Java language reflection does not have provisions for this eventuality.
Lack of the latter in Scala 3 leads me to seek alternatives.
The Scala compiler has to work even for compiled classes in absence of their source code, meaning that information has to be present in the byte code in some form.
If true, how can it be accessed, presumably with the help of some byte code manipulation library?
scalacdoes it, either. While whatever izumi provides will certainly prove useful in the future, it doesn't solve my current predicament.typeTag.ref match { case LightTypeTagRef.FullReference(_, params, _) => param.map(_.variance) }should work. Ad 2, as @som-snytt mentioned:ScalaSigis used by Scala 2. Scala 3 uses it to read 2.13 bytecode , but does not emit it. When 2.13 reads Scala 3 bytecode it needs-Ytasty-readerto get information from TASTY. So either use izymi-reflect, or a macro, or the tasty inspector.