diff options
Diffstat (limited to 'test/pending')
23 files changed, 291 insertions, 22 deletions
diff --git a/test/pending/pos/t1751.cmds b/test/pending/pos/t1751.cmds new file mode 100644 index 0000000000..d4a4898ffd --- /dev/null +++ b/test/pending/pos/t1751.cmds @@ -0,0 +1,3 @@ +javac SuiteClasses.java +scalac A2_1.scala +scalac A1_2.scala diff --git a/test/pending/pos/t1751/A1_2.scala b/test/pending/pos/t1751/A1_2.scala new file mode 100644 index 0000000000..354d5eecd0 --- /dev/null +++ b/test/pending/pos/t1751/A1_2.scala @@ -0,0 +1,2 @@ +@SuiteClasses(Array(classOf[A2])) +class A1 diff --git a/test/pending/pos/t1751/A2_1.scala b/test/pending/pos/t1751/A2_1.scala new file mode 100644 index 0000000000..c768062e43 --- /dev/null +++ b/test/pending/pos/t1751/A2_1.scala @@ -0,0 +1,2 @@ +@SuiteClasses(Array()) +class A2 diff --git a/test/pending/pos/t1751/SuiteClasses.java b/test/pending/pos/t1751/SuiteClasses.java new file mode 100644 index 0000000000..a415e4f572 --- /dev/null +++ b/test/pending/pos/t1751/SuiteClasses.java @@ -0,0 +1,3 @@ +public @interface SuiteClasses { + public Class<?>[] value(); +} diff --git a/test/pending/pos/t1782.cmds b/test/pending/pos/t1782.cmds new file mode 100644 index 0000000000..61f3d3788e --- /dev/null +++ b/test/pending/pos/t1782.cmds @@ -0,0 +1,2 @@ +javac Ann.java Days.java ImplementedBy.java +scalac Test_1.scala diff --git a/test/pending/pos/t1782/Ann.java b/test/pending/pos/t1782/Ann.java new file mode 100644 index 0000000000..0dcfbd2ed7 --- /dev/null +++ b/test/pending/pos/t1782/Ann.java @@ -0,0 +1,3 @@ +public @interface Ann { + public Days value(); +} diff --git a/test/pending/pos/t1782/Days.java b/test/pending/pos/t1782/Days.java new file mode 100644 index 0000000000..203a87b1c2 --- /dev/null +++ b/test/pending/pos/t1782/Days.java @@ -0,0 +1,3 @@ +public enum Days { + Friday, Sunday +} diff --git a/test/pending/pos/t1782/ImplementedBy.java b/test/pending/pos/t1782/ImplementedBy.java new file mode 100644 index 0000000000..6aa8b4fa9e --- /dev/null +++ b/test/pending/pos/t1782/ImplementedBy.java @@ -0,0 +1,3 @@ +public @interface ImplementedBy { + public Class<?> value(); +} diff --git a/test/pending/pos/t1782/Test_1.scala b/test/pending/pos/t1782/Test_1.scala new file mode 100644 index 0000000000..6467a74c29 --- /dev/null +++ b/test/pending/pos/t1782/Test_1.scala @@ -0,0 +1,16 @@ +@ImplementedBy(classOf[Provider]) +trait Service { + def someMethod() +} + +class Provider + extends Service +{ + // test enumeration java annotations + @Ann(Days.Friday) def someMethod() = () + + // #2103 + @scala.beans.BeanProperty + @Ann(value = Days.Sunday) + val t2103 = "test" +} diff --git a/test/pending/pos/t294.cmds b/test/pending/pos/t294.cmds new file mode 100644 index 0000000000..62c9a5a068 --- /dev/null +++ b/test/pending/pos/t294.cmds @@ -0,0 +1,3 @@ +javac Ann.java Ann2.java +scalac Test_1.scala +scalac Test_2.scala diff --git a/test/pending/pos/t294/Ann.java b/test/pending/pos/t294/Ann.java new file mode 100644 index 0000000000..934ca46297 --- /dev/null +++ b/test/pending/pos/t294/Ann.java @@ -0,0 +1,3 @@ +public @interface Ann { + public Ann2[] nested(); +} diff --git a/test/pending/pos/t294/Ann2.java b/test/pending/pos/t294/Ann2.java new file mode 100644 index 0000000000..025b79e794 --- /dev/null +++ b/test/pending/pos/t294/Ann2.java @@ -0,0 +1,3 @@ +public @interface Ann2 { + public int value(); +} diff --git a/test/pending/pos/t294/Test_1.scala b/test/pending/pos/t294/Test_1.scala new file mode 100644 index 0000000000..ff1f34b10e --- /dev/null +++ b/test/pending/pos/t294/Test_1.scala @@ -0,0 +1,7 @@ +// also test pickling of java annotations; Test_2.scala will +// read this class file +@Ann(nested = Array(new Ann2(10))) class Test { + @Ann2(100) var ctx: Object = _ + @Ann(nested = Array()) def foo = 10 + @Ann(nested = Array(new Ann2(10), new Ann2(23))) val bam = -3 +} diff --git a/test/pending/pos/t294/Test_2.scala b/test/pending/pos/t294/Test_2.scala new file mode 100644 index 0000000000..9fb1c6e175 --- /dev/null +++ b/test/pending/pos/t294/Test_2.scala @@ -0,0 +1 @@ +class Test2 extends Test diff --git a/test/pending/run/t3897.check b/test/pending/run/t3897.check new file mode 100644 index 0000000000..244b83716f --- /dev/null +++ b/test/pending/run/t3897.check @@ -0,0 +1,8 @@ +(One$$messages,scala.collection.mutable.MutableList<java.lang.String>) +(One$$messages,scala.collection.mutable.MutableList<java.lang.String>) +(messages,scala.collection.mutable.MutableList<java.lang.String>) +(messages,scala.collection.mutable.MutableList<java.lang.String>) +(One$$messages,scala.collection.mutable.MutableList<java.lang.String>) +(One$$messages,scala.collection.mutable.MutableList<java.lang.String>) +(messages,scala.collection.mutable.MutableList<java.lang.String>) +(messages,scala.collection.mutable.MutableList<java.lang.String>) diff --git a/test/pending/run/t3897/J_2.java b/test/pending/run/t3897/J_2.java new file mode 100644 index 0000000000..178412dc92 --- /dev/null +++ b/test/pending/run/t3897/J_2.java @@ -0,0 +1,27 @@ +import java.lang.reflect.*; + +public class J_2 { + public void f1(Class<?> clazz) { + Field[] fields = clazz.getDeclaredFields(); + for (int i = 0 ; i < fields.length; i++) { + String name = fields[i].getName(); + if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } + else System.out.println("(" + name + "," + fields[i].getGenericType() + ")"); + } + } + public void f2(Class<?> clazz) { + Method[] methods = clazz.getDeclaredMethods(); + for (int i = 0 ; i < methods.length; i++) { + String name = methods[i].getName(); + if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } + else System.out.println("(" + name + "," + methods[i].getGenericReturnType() + ")"); + } + } + + public void javaRun() { + f1(One.class); + f2(One.class); + f1(Two.class); + f2(Two.class); + } +}
\ No newline at end of file diff --git a/test/pending/run/t3897/a_1.scala b/test/pending/run/t3897/a_1.scala new file mode 100644 index 0000000000..4da959e2ac --- /dev/null +++ b/test/pending/run/t3897/a_1.scala @@ -0,0 +1,8 @@ +class One { + private val messages = new collection.mutable.MutableList[String] + List("a") foreach { messages += _ } +} + +class Two { + private val messages = new collection.mutable.MutableList[String] +} diff --git a/test/pending/run/t3897/a_2.scala b/test/pending/run/t3897/a_2.scala new file mode 100644 index 0000000000..4d9e59ef05 --- /dev/null +++ b/test/pending/run/t3897/a_2.scala @@ -0,0 +1,23 @@ +object Test { + def f1(clazz: Class[_]) = ( + clazz.getDeclaredFields.toList + . filterNot (_.getName contains "bitmap$") + . map (f => (f.getName, f.getGenericType)) + . foreach (println) + ) + def f2(clazz: Class[_]) = ( + clazz.getDeclaredMethods.toList + . filterNot (_.getName contains "bitmap$") + . map (f => (f.getName, f.getGenericReturnType)) + . foreach (println) + ) + + def main(args: Array[String]): Unit = { + f1(classOf[One]) + f2(classOf[One]) + f1(classOf[Two]) + f2(classOf[Two]) + + new J_2().javaRun + } +} diff --git a/test/pending/run/t5293-map.scala b/test/pending/run/t5293-map.scala new file mode 100644 index 0000000000..2707aed07e --- /dev/null +++ b/test/pending/run/t5293-map.scala @@ -0,0 +1,88 @@ + + + +import scala.collection.JavaConverters._ + + + +object Test extends App { + + def bench(label: String)(body: => Unit): Long = { + val start = System.nanoTime + + 0.until(10).foreach(_ => body) + + val end = System.nanoTime + + //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0)) + + end - start + } + + def benchJava(values: java.util.Map[Int, Int]) = { + bench("Java Map") { + val m = new java.util.HashMap[Int, Int] + + m.putAll(values) + } + } + + def benchScala(values: Iterable[(Int, Int)]) = { + bench("Scala Map") { + val m = new scala.collection.mutable.HashMap[Int, Int] + + m ++= values + } + } + + def benchScalaSorted(values: Iterable[(Int, Int)]) = { + bench("Scala Map sorted") { + val m = new scala.collection.mutable.HashMap[Int, Int] + + m ++= values.toArray.sorted + } + } + + def benchScalaPar(values: Iterable[(Int, Int)]) = { + bench("Scala ParMap") { + val m = new scala.collection.parallel.mutable.ParHashMap[Int, Int] map { x => x } + + m ++= values + } + } + + val total = 50000 + val values = (0 until total) zip (0 until total) + val map = scala.collection.mutable.HashMap.empty[Int, Int] + + map ++= values + + // warmup + for (x <- 0 until 5) { + benchJava(map.asJava) + benchScala(map) + benchScalaPar(map) + benchJava(map.asJava) + benchScala(map) + benchScalaPar(map) + } + + val javamap = benchJava(map.asJava) + val scalamap = benchScala(map) + val scalaparmap = benchScalaPar(map) + + // println(javamap) + // println(scalamap) + // println(scalaparmap) + + assert(scalamap < (javamap * 10), "scalamap: " + scalamap + " vs. javamap: " + javamap) + assert(scalaparmap < (javamap * 10), "scalaparmap: " + scalaparmap + " vs. javamap: " + javamap) +} + + + + + + + + diff --git a/test/pending/run/t5293.scala b/test/pending/run/t5293.scala new file mode 100644 index 0000000000..01ead45d2a --- /dev/null +++ b/test/pending/run/t5293.scala @@ -0,0 +1,83 @@ + + + +import scala.collection.JavaConverters._ + + + +object Test extends App { + + def bench(label: String)(body: => Unit): Long = { + val start = System.nanoTime + + 0.until(10).foreach(_ => body) + + val end = System.nanoTime + + //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0)) + + end - start + } + + def benchJava(values: java.util.Collection[Int]) = { + bench("Java Set") { + val set = new java.util.HashSet[Int] + + set.addAll(values) + } + } + + def benchScala(values: Iterable[Int]) = { + bench("Scala Set") { + val set = new scala.collection.mutable.HashSet[Int] + + set ++= values + } + } + + def benchScalaSorted(values: Iterable[Int]) = { + bench("Scala Set sorted") { + val set = new scala.collection.mutable.HashSet[Int] + + set ++= values.toArray.sorted + } + } + + def benchScalaPar(values: Iterable[Int]) = { + bench("Scala ParSet") { + val set = new scala.collection.parallel.mutable.ParHashSet[Int] map { x => x } + + set ++= values + } + } + + val values = 0 until 50000 + val set = scala.collection.mutable.HashSet.empty[Int] + + set ++= values + + // warmup + for (x <- 0 until 5) { + benchJava(set.asJava) + benchScala(set) + benchScalaPar(set) + benchJava(set.asJava) + benchScala(set) + benchScalaPar(set) + } + + val javaset = benchJava(set.asJava) + val scalaset = benchScala(set) + val scalaparset = benchScalaPar(set) + + assert(scalaset < (javaset * 8), "scalaset: " + scalaset + " vs. javaset: " + javaset) + assert(scalaparset < (javaset * 8), "scalaparset: " + scalaparset + " vs. javaset: " + javaset) +} + + + + + + + + diff --git a/test/pending/run/t5695.check b/test/pending/run/t5695.check deleted file mode 100644 index d50069ab4f..0000000000 --- a/test/pending/run/t5695.check +++ /dev/null @@ -1,2 +0,0 @@ -.. -.. diff --git a/test/pending/run/t5695/part_1.scala b/test/pending/run/t5695/part_1.scala deleted file mode 100644 index b8e8f8e52f..0000000000 --- a/test/pending/run/t5695/part_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import language.experimental.macros -import scala.reflect.makro.Context - -object Defs { - - def mkInt = macro mkIntImpl - def mkIntImpl(c: Context): c.Expr[Any] = { - println(c.enclosingApplication) - c.reify{ 23 } - } - -} diff --git a/test/pending/run/t5695/part_2.scala b/test/pending/run/t5695/part_2.scala deleted file mode 100644 index d34219437d..0000000000 --- a/test/pending/run/t5695/part_2.scala +++ /dev/null @@ -1,8 +0,0 @@ -import Defs._ - -object Test extends App { - - val i1 = mkInt - val i2 = identity(mkInt) - -} |