diff options
author | Simon Ochsenreither <simon@ochsenreither.de> | 2015-08-31 05:03:29 +0200 |
---|---|---|
committer | Simon Ochsenreither <simon@ochsenreither.de> | 2016-01-25 19:21:43 +0100 |
commit | c78d771e6f025e767801f7fe118acc2ea7540acd (patch) | |
tree | e2e4faa4bcc60e7b5fd0d9a59d5586ed5522b900 /test/files/run/t9437a | |
parent | 94a228f90e7d0cb997c866a8b9a7663c67e2df3d (diff) | |
download | scala-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/t9437a')
-rw-r--r-- | test/files/run/t9437a/Test.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/t9437a/Test.scala b/test/files/run/t9437a/Test.scala new file mode 100644 index 0000000000..a86c17b646 --- /dev/null +++ b/test/files/run/t9437a/Test.scala @@ -0,0 +1,20 @@ +class Foo(a: Int, `_`: String, *** : Long, `unary_!` : Float, ABC: Double) { + def bar(a: Int, `_`: String, *** : Long, `unary_!` : Float, ABC: Double) = null +} + +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) +} |