summaryrefslogtreecommitdiff
path: root/src/library/scala/reflect/base/AnnotationInfos.scala
blob: f03644deefc289fdefb8ecce20a77b41ee421415 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package scala.reflect
package base

trait AnnotationInfos { self: Universe =>

  type AnnotationInfo >: Null <: AnyRef
  implicit val AnnotationInfoTag: ClassTag[AnnotationInfo]
  val AnnotationInfo: AnnotationInfoExtractor

  abstract class AnnotationInfoExtractor {
    def apply(atp: Type, args: List[Tree], assocs: List[(Name, ClassfileAnnotArg)]): AnnotationInfo
    def unapply(info: AnnotationInfo): Option[(Type, List[Tree], List[(Name, ClassfileAnnotArg)])]
  }

  type ClassfileAnnotArg >: Null <: AnyRef
  implicit val ClassfileAnnotArgTag: ClassTag[ClassfileAnnotArg]

  type LiteralAnnotArg >: Null <: AnyRef with ClassfileAnnotArg
  implicit val LiteralAnnotArgTag: ClassTag[LiteralAnnotArg]
  val LiteralAnnotArg: LiteralAnnotArgExtractor

  abstract class LiteralAnnotArgExtractor {
    def apply(const: Constant): LiteralAnnotArg
    def unapply(arg: LiteralAnnotArg): Option[Constant]
  }

  type ArrayAnnotArg >: Null <: AnyRef with ClassfileAnnotArg
  implicit val ArrayAnnotArgTag: ClassTag[ArrayAnnotArg]
  val ArrayAnnotArg: ArrayAnnotArgExtractor

  abstract class ArrayAnnotArgExtractor {
    def apply(args: Array[ClassfileAnnotArg]): ArrayAnnotArg
    def unapply(arg: ArrayAnnotArg): Option[Array[ClassfileAnnotArg]]
  }

  type NestedAnnotArg >: Null <: AnyRef with ClassfileAnnotArg
  implicit val NestedAnnotArgTag: ClassTag[NestedAnnotArg]
  val NestedAnnotArg: NestedAnnotArgExtractor

  abstract class NestedAnnotArgExtractor {
    def apply(annInfo: AnnotationInfo): NestedAnnotArg
    def unapply(arg: NestedAnnotArg): Option[AnnotationInfo]
  }
}