summaryrefslogtreecommitdiff
path: root/test/files/run/t9437b
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2015-08-31 05:03:29 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2016-01-25 19:21:43 +0100
commitc78d771e6f025e767801f7fe118acc2ea7540acd (patch)
treee2e4faa4bcc60e7b5fd0d9a59d5586ed5522b900 /test/files/run/t9437b
parent94a228f90e7d0cb997c866a8b9a7663c67e2df3d (diff)
downloadscala-c78d771e6f025e767801f7fe118acc2ea7540acd.tar.gz
scala-c78d771e6f025e767801f7fe118acc2ea7540acd.tar.bz2
scala-c78d771e6f025e767801f7fe118acc2ea7540acd.zip
SI-9437 Emit and support parameter names in class files
JEP 118 added a MethodParameters attribute to the class file spec which holds the parameter names of methods when compiling Java code with `javac -parameters`. We emit parameter names by default now.
Diffstat (limited to 'test/files/run/t9437b')
-rw-r--r--test/files/run/t9437b/Foo_1.scala3
-rw-r--r--test/files/run/t9437b/Test_2.scala16
2 files changed, 19 insertions, 0 deletions
diff --git a/test/files/run/t9437b/Foo_1.scala b/test/files/run/t9437b/Foo_1.scala
new file mode 100644
index 0000000000..ca6c9c6156
--- /dev/null
+++ b/test/files/run/t9437b/Foo_1.scala
@@ -0,0 +1,3 @@
+class Foo(a: Int, `_`: String, *** : Long, `unary_!` : Float, ABC: Double) {
+ def bar(a: Int, `_`: String, *** : Long, `unary_!` : Float, ABC: Double) = null
+}
diff --git a/test/files/run/t9437b/Test_2.scala b/test/files/run/t9437b/Test_2.scala
new file mode 100644
index 0000000000..521f525f1d
--- /dev/null
+++ b/test/files/run/t9437b/Test_2.scala
@@ -0,0 +1,16 @@
+object Test extends App {
+ val constrParams = classOf[Foo].getConstructors.head.getParameters
+ val methodParams = classOf[Foo].getDeclaredMethods.head.getParameters
+
+ def printParams(params: Array[java.lang.reflect.Parameter]) = {
+ params.foreach { param =>
+ println(s"name: ${param.getName}; isNamePresent: ${param.isNamePresent}; isSynthetic: ${param.isSynthetic}")
+ }
+ }
+
+ printParams(constrParams)
+ printParams(methodParams)
+
+ val foo = new Foo(a = 1, `_` = "2", *** = 3L, `unary_!` = 4.0f, ABC = 5.0)
+ foo.bar(a = 1, `_` = "2", *** = 3L, `unary_!` = 4.0f, ABC = 5.0)
+}