summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-06-07 11:13:47 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-06-07 11:13:47 +0000
commit8cc477f8b6fd81c45fe30ac454c021a9769911ad (patch)
treece574d8e84ea47c453298fe557b49f7d51ddfdf3 /test/files
parenta2166dec9d687347a08c9e6a95e07f1a67f0d370 (diff)
downloadscala-8cc477f8b6fd81c45fe30ac454c021a9769911ad.tar.gz
scala-8cc477f8b6fd81c45fe30ac454c021a9769911ad.tar.bz2
scala-8cc477f8b6fd81c45fe30ac454c021a9769911ad.zip
fixed BeanProperty, added BooleanBeanProperty, ...
fixed BeanProperty, added BooleanBeanProperty, added many tests (#1029, #1751, #294, #1942, #1782, #1788, #637).
Diffstat (limited to 'test/files')
-rw-r--r--test/files/pos/annotations.scala50
-rw-r--r--test/files/pos/t1029/Test_1.scala7
-rw-r--r--test/files/pos/t1029/Test_2.scala3
-rw-r--r--test/files/pos/t1751/A1_2.scala2
-rw-r--r--test/files/pos/t1751/A2_1.scala2
-rw-r--r--test/files/pos/t1751/SuiteClasses.java3
-rw-r--r--test/files/pos/t1782/ImplementedBy.java3
-rw-r--r--test/files/pos/t1782/Test_1.scala10
-rw-r--r--test/files/pos/t1942/A_1.scala11
-rw-r--r--test/files/pos/t1942/Test_2.scala3
-rw-r--r--test/files/pos/t294/Ann.java3
-rw-r--r--test/files/pos/t294/Ann2.java3
-rw-r--r--test/files/pos/t294/Test_1.scala7
-rw-r--r--test/files/pos/t294/Test_2.scala1
14 files changed, 108 insertions, 0 deletions
diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala
index 9f780c0094..5492d89351 100644
--- a/test/files/pos/annotations.scala
+++ b/test/files/pos/annotations.scala
@@ -22,5 +22,55 @@ object Test {
// bug #1070
trait T { @BeanProperty var field = 1 }
+
+ // annotation on annotation constructor
+ @(ann @ann(100))(200) def foo() = 300
+}
+
+// test forward references to getters / setters
+class BeanPropertyTests {
+ @scala.reflect.BeanProperty lazy val lv1 = 0
+
+ def foo() {
+ val bp1 = new BeanPropertyTests1
+
+ println(lv1)
+ println(getLv1())
+ println(bp1.getLv2())
+
+ println(getV1())
+ setV1(10)
+ bp1.setV2(100)
+ }
+
+ @scala.reflect.BeanProperty var v1 = 0
+
}
+class BeanPropertyTests1 {
+ @scala.reflect.BeanProperty lazy val lv2 = "0"
+ @scala.reflect.BeanProperty var v2 = 0
+}
+
+// test mixin of getters / setters, and implementing abstract
+// methods using @BeanProperty
+class C extends T with BeanF {
+ def foo() {
+ setF("doch!")
+ setG(true)
+ this.getF()
+ }
+}
+
+trait T {
+ @scala.reflect.BeanProperty var f = "nei"
+ @scala.reflect.BooleanBeanProperty var g = false
+}
+
+trait BeanF {
+ def getF(): String
+ def setF(n: String): Unit
+
+ def isG(): Boolean
+ def setG(nb: Boolean): Unit
+}
diff --git a/test/files/pos/t1029/Test_1.scala b/test/files/pos/t1029/Test_1.scala
new file mode 100644
index 0000000000..e828087f2c
--- /dev/null
+++ b/test/files/pos/t1029/Test_1.scala
@@ -0,0 +1,7 @@
+class ann(a: Array[Int]) extends StaticAnnotation
+
+object Test1 {
+ // bug #1029
+ @ann(Array(10, 2)) def u = ()
+ val v: String @ann(Array(13, 2)) = "-1"
+}
diff --git a/test/files/pos/t1029/Test_2.scala b/test/files/pos/t1029/Test_2.scala
new file mode 100644
index 0000000000..00589052cb
--- /dev/null
+++ b/test/files/pos/t1029/Test_2.scala
@@ -0,0 +1,3 @@
+object Test {
+ val t = Test1
+}
diff --git a/test/files/pos/t1751/A1_2.scala b/test/files/pos/t1751/A1_2.scala
new file mode 100644
index 0000000000..354d5eecd0
--- /dev/null
+++ b/test/files/pos/t1751/A1_2.scala
@@ -0,0 +1,2 @@
+@SuiteClasses(Array(classOf[A2]))
+class A1
diff --git a/test/files/pos/t1751/A2_1.scala b/test/files/pos/t1751/A2_1.scala
new file mode 100644
index 0000000000..c768062e43
--- /dev/null
+++ b/test/files/pos/t1751/A2_1.scala
@@ -0,0 +1,2 @@
+@SuiteClasses(Array())
+class A2
diff --git a/test/files/pos/t1751/SuiteClasses.java b/test/files/pos/t1751/SuiteClasses.java
new file mode 100644
index 0000000000..9f09021c5a
--- /dev/null
+++ b/test/files/pos/t1751/SuiteClasses.java
@@ -0,0 +1,3 @@
+public @interface SuiteClasses {
+ public Class<?>[] value();
+} \ No newline at end of file
diff --git a/test/files/pos/t1782/ImplementedBy.java b/test/files/pos/t1782/ImplementedBy.java
new file mode 100644
index 0000000000..6aa8b4fa9e
--- /dev/null
+++ b/test/files/pos/t1782/ImplementedBy.java
@@ -0,0 +1,3 @@
+public @interface ImplementedBy {
+ public Class<?> value();
+}
diff --git a/test/files/pos/t1782/Test_1.scala b/test/files/pos/t1782/Test_1.scala
new file mode 100644
index 0000000000..de4f0e9886
--- /dev/null
+++ b/test/files/pos/t1782/Test_1.scala
@@ -0,0 +1,10 @@
+@ImplementedBy(classOf[Provider])
+trait Service {
+ def someMethod()
+}
+
+class Provider
+ extends Service
+{
+ def someMethod() = ()
+}
diff --git a/test/files/pos/t1942/A_1.scala b/test/files/pos/t1942/A_1.scala
new file mode 100644
index 0000000000..19a7575a0a
--- /dev/null
+++ b/test/files/pos/t1942/A_1.scala
@@ -0,0 +1,11 @@
+class A {
+ def foo(x: Int) = 0
+ def foo(x: String) = 1
+}
+
+class ann(x: Int) extends StaticAnnotation
+
+class t {
+ val a = new A
+ @ann(a.foo(1)) def bar = 1
+}
diff --git a/test/files/pos/t1942/Test_2.scala b/test/files/pos/t1942/Test_2.scala
new file mode 100644
index 0000000000..6c045bbce5
--- /dev/null
+++ b/test/files/pos/t1942/Test_2.scala
@@ -0,0 +1,3 @@
+class Test {
+ println(new t)
+}
diff --git a/test/files/pos/t294/Ann.java b/test/files/pos/t294/Ann.java
new file mode 100644
index 0000000000..934ca46297
--- /dev/null
+++ b/test/files/pos/t294/Ann.java
@@ -0,0 +1,3 @@
+public @interface Ann {
+ public Ann2[] nested();
+}
diff --git a/test/files/pos/t294/Ann2.java b/test/files/pos/t294/Ann2.java
new file mode 100644
index 0000000000..958cf1ab76
--- /dev/null
+++ b/test/files/pos/t294/Ann2.java
@@ -0,0 +1,3 @@
+public @interface Ann2 {
+ public int value();
+} \ No newline at end of file
diff --git a/test/files/pos/t294/Test_1.scala b/test/files/pos/t294/Test_1.scala
new file mode 100644
index 0000000000..ff1f34b10e
--- /dev/null
+++ b/test/files/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/files/pos/t294/Test_2.scala b/test/files/pos/t294/Test_2.scala
new file mode 100644
index 0000000000..9fb1c6e175
--- /dev/null
+++ b/test/files/pos/t294/Test_2.scala
@@ -0,0 +1 @@
+class Test2 extends Test