diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-10-23 00:54:12 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-10-23 00:54:12 -0700 |
commit | 6062a9c599ae1b7ecc89ae5296cf04d4627907af (patch) | |
tree | c009f92bbd647da0065855890bea6253c6394ada /test/files/run | |
parent | 0c2d73755b3db80d976231b44b66107db5412426 (diff) | |
parent | 5a672866379f90a5c3a9c29a86f9a7b661a3c2c6 (diff) | |
download | scala-6062a9c599ae1b7ecc89ae5296cf04d4627907af.tar.gz scala-6062a9c599ae1b7ecc89ae5296cf04d4627907af.tar.bz2 scala-6062a9c599ae1b7ecc89ae5296cf04d4627907af.zip |
Merge pull request #3057 from xeno-by/topic/fancy-java-classes
fixes handling of fancy nested classes in runtime reflection
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/reflection-fancy-java-classes.check | 12 | ||||
-rw-r--r-- | test/files/run/reflection-fancy-java-classes/Foo_1.java | 5 | ||||
-rw-r--r-- | test/files/run/reflection-fancy-java-classes/Test_2.scala | 20 |
3 files changed, 37 insertions, 0 deletions
diff --git a/test/files/run/reflection-fancy-java-classes.check b/test/files/run/reflection-fancy-java-classes.check new file mode 100644 index 0000000000..258208dd99 --- /dev/null +++ b/test/files/run/reflection-fancy-java-classes.check @@ -0,0 +1,12 @@ +===== JAVA POV ===== +class Foo_1$1 +getEnclosingClass = class Foo_1 +getEnclosingMethod = null +getEnclosingConstructor = null +isMemberClass = false +isLocalClass = false +isAnonymousClass = true + +===== SCALA POV ===== +class 1 +object Foo_1 diff --git a/test/files/run/reflection-fancy-java-classes/Foo_1.java b/test/files/run/reflection-fancy-java-classes/Foo_1.java new file mode 100644 index 0000000000..f6fd76124b --- /dev/null +++ b/test/files/run/reflection-fancy-java-classes/Foo_1.java @@ -0,0 +1,5 @@ +public class Foo_1 { + public static Bar bar = new Bar(); + private static class Bar { + } +}
\ No newline at end of file diff --git a/test/files/run/reflection-fancy-java-classes/Test_2.scala b/test/files/run/reflection-fancy-java-classes/Test_2.scala new file mode 100644 index 0000000000..271960ee79 --- /dev/null +++ b/test/files/run/reflection-fancy-java-classes/Test_2.scala @@ -0,0 +1,20 @@ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + println("===== JAVA POV =====") + val jfancy = Class.forName("Foo_1$1") + println(jfancy) + println("getEnclosingClass = " + jfancy.getEnclosingClass) + println("getEnclosingMethod = " + jfancy.getEnclosingMethod) + println("getEnclosingConstructor = " + jfancy.getEnclosingConstructor) + println("isMemberClass = " + jfancy.isMemberClass) + println("isLocalClass = " + jfancy.isLocalClass) + println("isAnonymousClass = " + jfancy.isAnonymousClass) + + println("") + println("===== SCALA POV =====") + val sfancy = cm.classSymbol(jfancy) + println(sfancy) + println(sfancy.owner) +}
\ No newline at end of file |