diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-08-29 06:51:20 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-08-29 06:51:20 -0700 |
commit | c9ef7f5a7e76887fdab775802bc7a81994bac362 (patch) | |
tree | c418778659d4d5147180d7f23e87db921b6bf45b /test/files/run/t7779.scala | |
parent | ba86ac61f489573d10590c5fc601e73673f204f1 (diff) | |
parent | 5dbc37dfbe0e9a039da6744e45012abc3034cdf5 (diff) | |
download | scala-c9ef7f5a7e76887fdab775802bc7a81994bac362.tar.gz scala-c9ef7f5a7e76887fdab775802bc7a81994bac362.tar.bz2 scala-c9ef7f5a7e76887fdab775802bc7a81994bac362.zip |
Merge pull request #2871 from retronym/ticket/7779
SI-7779 Account for class name compactification in reflection
Diffstat (limited to 'test/files/run/t7779.scala')
-rw-r--r-- | test/files/run/t7779.scala | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/test/files/run/t7779.scala b/test/files/run/t7779.scala new file mode 100644 index 0000000000..db32cb751f --- /dev/null +++ b/test/files/run/t7779.scala @@ -0,0 +1,67 @@ +// -Xmax-classfile-length doesn't compress top-level classes. +// class ::::::::::::::::::::::::::::::::::::::::::::::::: + +trait Marker + +class Short extends Marker + +// We just test with member classes +object O { + object ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker +} +class C { + class D { + class ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker + } +} + +package pack { + // abbreviates to: $colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon to $read$$iw$$iw$$colon$colon$colon$colon$colon$colon$colon$colon$$$$c39b3f245029fbed9732fc888d44231b$$$$on$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon + // class ::::::::::::::::::::::::::::::::::::::::::::::::: + + class Short extends Marker + + // We just test with member classes + object O { + object ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker + } + class C { + class D { + class ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker + } + } + package p2 { + class Short extends Marker + + object O { + object ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker + } + class C { + class D { + class ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker + } + } + } +} + + +object Test extends App { + import reflect.runtime.universe._ + def test[T: TypeTag] = { + val tt = typeTag[T] + val clz = tt.mirror.runtimeClass(tt.tpe) + assert(classOf[Marker].isAssignableFrom(clz), clz.toString) + } + + test[Short] + test[O.:::::::::::::::::::::::::::::::::::::::::::::::::.type] + test[C#D#`:::::::::::::::::::::::::::::::::::::::::::::::::`] + + test[pack.Short] + test[pack.O.:::::::::::::::::::::::::::::::::::::::::::::::::.type] + test[pack.C#D#`:::::::::::::::::::::::::::::::::::::::::::::::::`] + + test[pack.p2.Short] + test[pack.p2.O.:::::::::::::::::::::::::::::::::::::::::::::::::.type] + test[pack.p2.C#D#`:::::::::::::::::::::::::::::::::::::::::::::::::`] +} |