diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-27 22:39:44 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-27 22:39:44 -0700 |
commit | f3f1064c90371449949892f30de91cc1f2662c55 (patch) | |
tree | 42aefac9620bbf2f1bc62dcac018a726f5a838e0 /test/files/run | |
parent | 0b7dddbf88f582c9e04105407509334fb1ee50ec (diff) | |
parent | 050b4c951c838699c2fe30cbf01b63942c63a299 (diff) | |
download | scala-f3f1064c90371449949892f30de91cc1f2662c55.tar.gz scala-f3f1064c90371449949892f30de91cc1f2662c55.tar.bz2 scala-f3f1064c90371449949892f30de91cc1f2662c55.zip |
Merge pull request #2750 from retronym/ticket/7455-2.10.x
SI-7455 Drop dummy param for synthetic access constructor
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t7455.check | 4 | ||||
-rw-r--r-- | test/files/run/t7455/Outer.java | 31 | ||||
-rw-r--r-- | test/files/run/t7455/Test.scala | 30 |
3 files changed, 65 insertions, 0 deletions
diff --git a/test/files/run/t7455.check b/test/files/run/t7455.check new file mode 100644 index 0000000000..0eb9342888 --- /dev/null +++ b/test/files/run/t7455.check @@ -0,0 +1,4 @@ +private[package <empty>] def <init>(x$1: String): Outer[E] +private[package <empty>] def <init>(): Outer$PrivateInner +private[package <empty>] def <init>(): Outer$PrivateStaticInner +private[package <empty>] def <init>(x$2: String): Outer$PublicInner diff --git a/test/files/run/t7455/Outer.java b/test/files/run/t7455/Outer.java new file mode 100644 index 0000000000..10c97a9150 --- /dev/null +++ b/test/files/run/t7455/Outer.java @@ -0,0 +1,31 @@ +public class Outer<E> { + public void elements() { + new C<E>() { + }; + } + + private Outer(String a) {} + + static class SubSelf extends Outer<String> { + public SubSelf() { super(""); } + } + + private class PrivateInner { + } + class SubPrivateInner extends PrivateInner { + } + + private class PublicInner { + private PublicInner(String a) {} + } + class SubPublicInner extends PublicInner { + public SubPublicInner() { super(""); } + } + + private static class PrivateStaticInner { + } + public static class SubPrivateStaticInner extends PrivateStaticInner { + } +} + +class C<E> {} diff --git a/test/files/run/t7455/Test.scala b/test/files/run/t7455/Test.scala new file mode 100644 index 0000000000..b23a724c78 --- /dev/null +++ b/test/files/run/t7455/Test.scala @@ -0,0 +1,30 @@ +import scala.tools.partest._ + +// javac adds dummy parameters of type Outer$1 to synthetic access constructors +// This test shows that we strip them from the signatures. If we don't, we trigger +// parsing of Outer$1 which can fail if it references type parameters of the Outer. +// +// OLD OUTPUT: +// private[package <empty>] def <init>(x$2: Outer$1): Outer$PrivateInner +// error: error while loading Outer$1, class file 't7455-run.obj/Outer$1.class' is broken +// (class java.util.NoSuchElementException/key not found: E) +// ... +object Test extends DirectTest { + override def code = "" + + def show { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + val compiler = newCompiler("-cp", classpath, "-d", testOutput.path) + import compiler._, definitions._ + new compiler.Run + + for { + name <- Seq("Outer", "Outer$PrivateInner", "Outer$PrivateStaticInner", "Outer$PublicInner") + clazz = compiler.rootMirror.staticClass(name) + constr <- clazz.info.member(nme.CONSTRUCTOR).alternatives + } { + println(constr.defString) + fullyInitializeSymbol(constr) + } + } +} |