summaryrefslogtreecommitdiff
path: root/test/files/run/trait_fields_bytecode.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/trait_fields_bytecode.scala')
-rw-r--r--test/files/run/trait_fields_bytecode.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/files/run/trait_fields_bytecode.scala b/test/files/run/trait_fields_bytecode.scala
new file mode 100644
index 0000000000..d87412f43e
--- /dev/null
+++ b/test/files/run/trait_fields_bytecode.scala
@@ -0,0 +1,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")
+ }
+}