summaryrefslogtreecommitdiff
path: root/test/pending/jvm
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-02 22:43:10 +0000
committerPaul Phillips <paulp@improving.org>2010-10-02 22:43:10 +0000
commit06aa1c9eff49d5190e82a72a876d7b3bd706d6d4 (patch)
tree4c38f2559c839ba297060a48023d69550c5d107e /test/pending/jvm
parent256aca612204f1316e5281af6d10a14300d58ad1 (diff)
downloadscala-06aa1c9eff49d5190e82a72a876d7b3bd706d6d4.tar.gz
scala-06aa1c9eff49d5190e82a72a876d7b3bd706d6d4.tar.bz2
scala-06aa1c9eff49d5190e82a72a876d7b3bd706d6d4.zip
Sorting through the tests in pending from oldes...
Sorting through the tests in pending from oldest to newest because I don't believe in having useless appendages. The verdict on the oldest fifteen tests is: 15/15 are fixed. Many were already in files under a different name. I moved a few and deleted the rest. Fun fact of the day: apparently there was a time when to call into java varargs with no arguments you might have to write something like: getClass().getMethod("getCount", Array[java.lang.Class[T] forSome { type T }]()) On this basis I retract any complaints I've ever had about anything. There is one question mark outlined in pos/testCoercionThis.scala, a file formerly called pos/moors.scala and therefore... review by moors.
Diffstat (limited to 'test/pending/jvm')
-rw-r--r--test/pending/jvm/annotations.scala159
-rw-r--r--test/pending/jvm/backendBugUnapply.scala9
2 files changed, 0 insertions, 168 deletions
diff --git a/test/pending/jvm/annotations.scala b/test/pending/jvm/annotations.scala
deleted file mode 100644
index 98b82edad4..0000000000
--- a/test/pending/jvm/annotations.scala
+++ /dev/null
@@ -1,159 +0,0 @@
-object Test1 {
- class Foo {
- @remote
- def foo: Unit = ()
- }
- def run {
- val method = classOf[Foo].getMethod("foo", Array())
- method.getExceptionTypes foreach println
- }
-}
-
-object Test2 {
- import java.io.{BufferedReader,FileReader, IOException}
- class Reader(fname: String) {
- private val in = new BufferedReader(new FileReader(fname))
-
- @throws(classOf[IOException])
- def read() = in.read()
- }
- def run {
- val method = classOf[Reader].getMethod("read", Array())
- method.getExceptionTypes foreach println
- }
-}
-
-/* Java:
-public class Main {
- @Deprecated
- public void foo() {}
- public static void main(String[] args) throws Exception {
- Method method = Class.forName("test.Main").getMethod("foo", new Class[]{});
- Annotation annotation = method.getAnnotation(Deprecated.class);
- System.out.println(annotation); // @java.lang.Deprecated()
- }
-}
-*/
-object Test3 {
- import java.lang.Deprecated
- class Foo {
- @Deprecated
- def foo: Unit = ()
- }
- def run {
- val method = classOf[Foo].getMethod("foo", Array())
- val annotation = method.getAnnotation(classOf[Deprecated])
- println(annotation)
- }
-}
-
-/* Java:
-@Retention(value=RetentionPolicy.RUNTIME)
-@interface Source {
- public String url();
- public String mail();
-}
-@Source(url="http://scala.epfl.ch", mail="scala@lists.epfl.ch")
-class Foo {}
-public class Main {
- public static void main(String[] args) throws Exception {
- Class clazz = Class.forName("test.Foo");
- Annotation[] annotations = clazz.getAnnotations();
- for (int i = 0; i < annotations.length; i++)
- System.out.println(annotations[i]);
- // @test.Main$Source(url=http://scala-lang.org, mail=scala@lists.epfl.ch)
- }
-}
-*/
-object Test4 {
- import test.SourceAnnotation // defined in SourceAnnotation.java
- @SourceAnnotation{val value = "http://scala-lang.org",
- val mails = Array("scala@lists.epfl.ch", "scala-lounge@lists.epfl.ch")}
- class Foo1
- @SourceAnnotation("http://bloodsuckers.com") { val mails = Array("you@bloodsuckers.com") }
- class Foo2
- @SourceAnnotation("http://bloodsuckers.com")
- class Foo3
- class Foo4 {
- @SourceAnnotation("file:///dev/null")
- val x = 1
- }
- class Foo5 {
- @SourceAnnotation("file:///dev/zero")
- def bar: Int = 0
- }
- class Foo6 @SourceAnnotation("primary constructor")(s: String) {
- // to guarantee that primary constructor annotations
- // are not applied to secondary constructors
- def this() = this("")
- }
- class Foo7(s: String) {
- @SourceAnnotation("secondary constructor")
- def this() = this("")
- }
- class Foo8(@SourceAnnotation("constructor val") val n: Int) {}
- def run {
- import java.lang.annotation.Annotation
- import java.lang.reflect.AnnotatedElement
- def printSourceAnnotations(target: AnnotatedElement) {
- //print SourceAnnotation in a predefined way to insure
- // against difference in the JVMs (e.g. Sun's vs IBM's)
- def printSourceAnnotation(a: Annotation) {
- val ann = a.asInstanceOf[SourceAnnotation]
- println("@test.SourceAnnotation(mails=" + ann.mails.deepMkString("{", ",", "}") +
- ", value=" + ann.value + ")")
- }
- val anns = target.getAnnotations()
- anns foreach printSourceAnnotation
- if (anns.length > 0) {
- println(target)
- println
- }
- }
- printSourceAnnotations(classOf[Foo1])
- printSourceAnnotations(classOf[Foo2])
- printSourceAnnotations(classOf[Foo3])
- classOf[Foo4].getDeclaredFields foreach printSourceAnnotations
- classOf[Foo4].getDeclaredMethods foreach printSourceAnnotations
- classOf[Foo5].getDeclaredMethods foreach printSourceAnnotations
- classOf[Foo6].getDeclaredConstructors foreach printSourceAnnotations
- classOf[Foo7].getDeclaredConstructors foreach printSourceAnnotations
- classOf[Foo8].getDeclaredFields foreach printSourceAnnotations
- classOf[Foo8].getDeclaredMethods foreach printSourceAnnotations
- }
-}
-
-object Test5 {
- import scala.reflect.BeanProperty
- import java.lang.Integer
-
- class Count {
- // we use "Integer" instead of "Int" because of Java reflection
- @BeanProperty
- private var count: Integer = 0
-
- private val getter =
- getClass().getMethod("getCount", Array[java.lang.Class[T] forSome { type T }]())
- private val setter =
- getClass().getMethod("setCount", Array(classOf[Integer]))
-
- def get = getter.invoke(this, Array()).asInstanceOf[Integer].intValue
- def set(n: Int) = setter.invoke(this, Array(new Integer(n)))
- }
- def run {
- val count = new Count
- println(count.get)
- count.set(99)
- println(count.get)
- }
-}
-
-object Test {
- def main(args: Array[String]) {
- Test1.run
- Test2.run
- Test3.run // requires the use of -target:jvm-1.5
- Test4.run
- Test5.run
- }
-}
diff --git a/test/pending/jvm/backendBugUnapply.scala b/test/pending/jvm/backendBugUnapply.scala
deleted file mode 100644
index f8abfeb713..0000000000
--- a/test/pending/jvm/backendBugUnapply.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-object Test { import scala.xml.{Node,HasKeyValue}
- def domatch(x:Node): Node = {
- val hasBar = new HasKeyValue("bar")
- x match {
- case Node("foo", hasBar(z), _*) => z
- case _ => null
- }
- }
-}