diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-05-06 17:16:54 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-05-06 17:16:54 +0000 |
commit | e8ad9d9f30e20dc10f5fe012ed8833c9df3e1912 (patch) | |
tree | 2f06dab67d62a54434553012a28ab31c3890cbd8 /test/pending/run/bug2365/Test.scala | |
parent | 8b5acce2712dd6e7e86d006956214799669c67ff (diff) | |
download | scala-e8ad9d9f30e20dc10f5fe012ed8833c9df3e1912.tar.gz scala-e8ad9d9f30e20dc10f5fe012ed8833c9df3e1912.tar.bz2 scala-e8ad9d9f30e20dc10f5fe012ed8833c9df3e1912.zip |
Merged revisions 21810-21811,21816-21818,21826,...
Merged revisions 21810-21811,21816-21818,21826,21829 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk
........
r21810 | imaier | 2010-05-05 11:59:25 +0200 (Wed, 05 May 2010) | 1 line
Fixed #3358. Added explicit expected types to cachedWrapper calls,
deprecated explicit resizing of UIElements. ........ r21811 | rytz |
2010-05-05 13:53:31 +0200 (Wed, 05 May 2010) | 1 line
revert the revert of r21791 (fix constructor parameter annotations).
close #3390. together with a new starr it builds. no review. ........
r21816 | extempore | 2010-05-05 18:56:55 +0200 (Wed, 05 May 2010) | 2
lines
Rolled back a subset of partest to use StreamAppender and avoid
io.Process. No review. ........ r21817 | dragos | 2010-05-05 19:59:21
+0200 (Wed, 05 May 2010) | 3 lines
Tightened what gets specialized: only when the type parameter appears
at top level, or as a type argument to a Java array. For example T,
Array[T] cause specialization, but List[T] does not. Resurrected
spec-matrix, forgotten among the disabled tests. No review. ........
r21818 | dragos | 2010-05-05 20:26:17 +0200 (Wed, 05 May 2010) | 1 line
Removed some logging and prune CollectMethodBodies to not traverse
more than necessary. No review. ........ r21826 | extempore | 2010-05-06
16:57:56 +0200 (Thu, 06 May 2010) | 1 line
Fixed bug in transpose, closes #3397, no review.
........
r21829 | extempore | 2010-05-06 18:37:13 +0200 (Thu, 06 May 2010) | 5 lines
Rolled partest back to r21328. Attempted to make the minimum changes
necessary to plug it back in while preserving everything which has
happened since then in tests and such, but we should be the lookout for
overreversion. Review by phaller (but as a formality, I don't think it
requires direct review.) ........
Diffstat (limited to 'test/pending/run/bug2365/Test.scala')
-rw-r--r-- | test/pending/run/bug2365/Test.scala | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/pending/run/bug2365/Test.scala b/test/pending/run/bug2365/Test.scala new file mode 100644 index 0000000000..92b58f4a25 --- /dev/null +++ b/test/pending/run/bug2365/Test.scala @@ -0,0 +1,35 @@ +import scala.tools.nsc.io._ +import java.net.URL + +object A { def apply(d: { def apply(): Int}) = d.apply() } +object A2 { def apply(d: { def apply(): Int}) = d.apply() } +object A3 { def apply(d: { def apply(): Int}) = d.apply() } +object A4 { def apply(d: { def apply(): Int}) = d.apply() } + +class B extends Function0[Int] { + def apply() = 3 +} + +object Test +{ + type StructF0 = { def apply(): Int } + def main(args: Array[String]) { + for(i <- 0 until 150) + println(i + " " + test(A.apply) + " " + test(A2.apply) + " " + test(A3.apply) + " " + test(A3.apply)) + } + + def test(withF0: StructF0 => Int): Int = { + // Some large jar + val ivyJar = File("/local/lib/java/ivy.jar").toURL + // load a class in a separate loader that will be passed to A + val loader = new java.net.URLClassLoader(Array(File(".").toURL, ivyJar)) + // load a real class to fill perm gen space + Class.forName("org.apache.ivy.Ivy", true, loader).newInstance + // create a class from another class loader with an apply: Int method + val b = Class.forName("B", true, loader).newInstance + + // pass instance to a, which will call apply using structural type reflection. + // This should hold on to the class for B, which means bLoader will not get collected + withF0(b.asInstanceOf[StructF0]) + } +} |