blob: be3ba412f891e24252bb419979c81cb4bc30f85a (
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
45
46
47
|
Type in expressions to have them evaluated.
Type :help for more information.
scala> :power
** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
** global._, definitions._ also imported **
** Try :help, :vals, power.<tab> **
scala> :paste
// Entering paste mode (ctrl-D to finish)
{
val clazz = rootMirror.getClassByName(newTermName("test.ThrowsDeclaration_2"));
{
val method = clazz.info.member(newTermName("foo"))
val throwsAnn = method.annotations.head
val atp = throwsAnn.atp
println("foo")
println("atp.typeParams.isEmpty: " + atp.typeParams.isEmpty)
println(throwsAnn)
}
println
{
val method = clazz.info.member(newTermName("bar"))
val throwsAnn = method.annotations.head
val Literal(const) = throwsAnn.args.head
val tp = const.typeValue
println("bar")
println("tp.typeParams.isEmpty: " + tp.typeParams.isEmpty)
println(throwsAnn)
}
}
// Exiting paste mode, now interpreting.
foo
atp.typeParams.isEmpty: true
throws[IllegalStateException](classOf[java.lang.IllegalStateException])
bar
tp.typeParams.isEmpty: true
throws[test.PolymorphicException[_]](classOf[test.PolymorphicException])
scala>
|