summaryrefslogtreecommitdiff
path: root/test/files/run/trait_fields_bytecode.scala
blob: d87412f43ed2ae328c9a057e6db92ffb549d23d6 (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
trait TFinal { final val bla: Int = 123 }

// bla should be final in C
class CFinal extends TFinal


trait TConst { final val C = "S" }
// there should be a C method in `T$class`!
class CConst extends TConst {  }


object Test {
  def main(args: Array[String]): Unit = {
    val f1 = classOf[CFinal].getDeclaredMethod("bla")
    import java.lang.reflect.Modifier._
    assert(isFinal(f1.getModifiers), f1)

    classOf[CConst].getMethod("C")

    import language.reflectiveCalls
    assert(new CConst().asInstanceOf[{def C: String}].C == "S")
  }
}