Q:

How is 'classOf' expression represented in scala AST

I'm new to the Scala AST concepts.
I need to traverse a Scala code tree that contains an expression such as:
classOf[org.apache.commons.lang3.ArrayUtils]
I need to be able to identify this case when pattern matching on scala.reflect.internal.Trees.Tree.
For instance I know that it is not case _:Apply
What is the correct pattern in order to successfuly match this expression?

A:

A classOf[C] is represented as a Literal(value), where value.tag == ClazzTag, and value.typeValue is a Type representing C. You can match on it as:
case Literal(value) if value.tag == ClazzTag =>
  val tpe = value.typeValue
  // do something with `tpe`

See https://github.com/scala-js/scala-js/blob/ec5b328330276b9feb20cccadd75e19d27e887d3/compiler/src/main/scala/org/scalajs/nscplugin/GenJSCode.scala#L2043 for a real-world example.

