summaryrefslogtreecommitdiff
path: root/test/files/jvm/throws-annot-from-java.check
blob: ace264a4f551657831f15941eac1ad4a9efd8068 (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
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> :quit