From 327f88d16802daaddb85b33498a1cfc5b976bd28 Mon Sep 17 00:00:00 2001 From: mihaylov Date: Fri, 2 Mar 2007 08:35:59 +0000 Subject: renamed test/files/jvm5/attributes.scala to ann... renamed test/files/jvm5/attributes.scala to annotations.scala --- test/files/jvm5/annotations.check | 6 +++ test/files/jvm5/annotations.scala | 91 +++++++++++++++++++++++++++++++++++++++ test/files/jvm5/attributes.check | 6 --- test/files/jvm5/attributes.scala | 91 --------------------------------------- 4 files changed, 97 insertions(+), 97 deletions(-) create mode 100644 test/files/jvm5/annotations.check create mode 100644 test/files/jvm5/annotations.scala delete mode 100644 test/files/jvm5/attributes.check delete mode 100644 test/files/jvm5/attributes.scala (limited to 'test/files') diff --git a/test/files/jvm5/annotations.check b/test/files/jvm5/annotations.check new file mode 100644 index 0000000000..06d35ddb48 --- /dev/null +++ b/test/files/jvm5/annotations.check @@ -0,0 +1,6 @@ +class java.rmi.RemoteException +class java.io.IOException +@java.lang.Deprecated() +@test.SourceAnnotation(mail=scala@lists.epfl.ch, value=http://scala.epfl.ch) +@test.SourceAnnotation(mail=you@bloodsuckers.com, value=http://bloodsuckers.com) +@test.SourceAnnotation(mail=bill.gates@bloodsuckers.com, value=http://bloodsuckers.com) diff --git a/test/files/jvm5/annotations.scala b/test/files/jvm5/annotations.scala new file mode 100644 index 0000000000..fa5ab1476b --- /dev/null +++ b/test/files/jvm5/annotations.scala @@ -0,0 +1,91 @@ +import java.lang.Deprecated + +object Test1 { + class Foo { + @remote + def foo: Unit = () + } + def run: Unit = { + val method = classOf[Foo].getMethod("foo", Array()) + method.getExceptionTypes foreach Console.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: Unit = { + val method = classOf[Reader].getMethod("read", Array()) + method.getExceptionTypes foreach Console.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 { + class Foo { + @Deprecated + def foo: Unit = () + } + def run: Unit = { + val method = classOf[Foo].getMethod("foo", Array()) + val annotation = method.getAnnotation(classOf[Deprecated]) + Console.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.epfl.ch, mail=scala@lists.epfl.ch) + } +} +*/ +object Test4 { + import test.SourceAnnotation // defined in SourceAnnotation.java + @SourceAnnotation{val value = "http://scala.epfl.ch", val mail = "scala@lists.epfl.ch"} + class Foo1 + @SourceAnnotation("http://bloodsuckers.com") { val mail = "you@bloodsuckers.com" } + class Foo2 + @SourceAnnotation("http://bloodsuckers.com") + class Foo3 + def run: Unit = { + classOf[Foo1].getAnnotations foreach Console.println + classOf[Foo2].getAnnotations foreach Console.println + classOf[Foo3].getAnnotations foreach Console.println + } +} + +object Test { + def main(args: Array[String]): Unit = { + Test1.run + Test2.run + Test3.run // requires the use of -target:jvm-1.5 + Test4.run + } +} diff --git a/test/files/jvm5/attributes.check b/test/files/jvm5/attributes.check deleted file mode 100644 index 06d35ddb48..0000000000 --- a/test/files/jvm5/attributes.check +++ /dev/null @@ -1,6 +0,0 @@ -class java.rmi.RemoteException -class java.io.IOException -@java.lang.Deprecated() -@test.SourceAnnotation(mail=scala@lists.epfl.ch, value=http://scala.epfl.ch) -@test.SourceAnnotation(mail=you@bloodsuckers.com, value=http://bloodsuckers.com) -@test.SourceAnnotation(mail=bill.gates@bloodsuckers.com, value=http://bloodsuckers.com) diff --git a/test/files/jvm5/attributes.scala b/test/files/jvm5/attributes.scala deleted file mode 100644 index fa5ab1476b..0000000000 --- a/test/files/jvm5/attributes.scala +++ /dev/null @@ -1,91 +0,0 @@ -import java.lang.Deprecated - -object Test1 { - class Foo { - @remote - def foo: Unit = () - } - def run: Unit = { - val method = classOf[Foo].getMethod("foo", Array()) - method.getExceptionTypes foreach Console.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: Unit = { - val method = classOf[Reader].getMethod("read", Array()) - method.getExceptionTypes foreach Console.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 { - class Foo { - @Deprecated - def foo: Unit = () - } - def run: Unit = { - val method = classOf[Foo].getMethod("foo", Array()) - val annotation = method.getAnnotation(classOf[Deprecated]) - Console.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.epfl.ch, mail=scala@lists.epfl.ch) - } -} -*/ -object Test4 { - import test.SourceAnnotation // defined in SourceAnnotation.java - @SourceAnnotation{val value = "http://scala.epfl.ch", val mail = "scala@lists.epfl.ch"} - class Foo1 - @SourceAnnotation("http://bloodsuckers.com") { val mail = "you@bloodsuckers.com" } - class Foo2 - @SourceAnnotation("http://bloodsuckers.com") - class Foo3 - def run: Unit = { - classOf[Foo1].getAnnotations foreach Console.println - classOf[Foo2].getAnnotations foreach Console.println - classOf[Foo3].getAnnotations foreach Console.println - } -} - -object Test { - def main(args: Array[String]): Unit = { - Test1.run - Test2.run - Test3.run // requires the use of -target:jvm-1.5 - Test4.run - } -} -- cgit v1.2.3