aboutsummaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/testsuite/libjava.lang')
-rw-r--r--libjava/testsuite/libjava.lang/ArrayStore.java52
-rw-r--r--libjava/testsuite/libjava.lang/ArrayStore.out4
-rw-r--r--libjava/testsuite/libjava.lang/ArrayStore.xfail1
-rw-r--r--libjava/testsuite/libjava.lang/ArrayStore2.java31
-rw-r--r--libjava/testsuite/libjava.lang/ArrayStore2.out3
-rw-r--r--libjava/testsuite/libjava.lang/ArrayStore2.xfail1
6 files changed, 92 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/ArrayStore.java b/libjava/testsuite/libjava.lang/ArrayStore.java
new file mode 100644
index 0000000..9afac71
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/ArrayStore.java
@@ -0,0 +1,52 @@
+public class ArrayStore
+{
+ public static void main(String[] args)
+ {
+ ArrayStore s = new ArrayStore();
+
+ /* Check that bounds check takes precedence over array store check. */
+ try
+ {
+ s.a(new String[1]);
+ }
+ catch (Exception x)
+ {
+ System.out.println (x.getClass().getName());
+ }
+
+ try
+ {
+ s.a(new String[2]);
+ }
+ catch (Exception x)
+ {
+ System.out.println (x.getClass().getName());
+ }
+
+ /* Check that += operator on String[] element works and throws bounds
+ exception. */
+ try
+ {
+ s.b(new String[1]);
+ }
+ catch (Exception x)
+ {
+ System.out.println (x.getClass().getName());
+ }
+
+ String[] sb = new String[2];
+ sb[1] = "foo";
+ s.b(sb);
+ System.out.println (sb[1]);
+ }
+
+ void a(Object[] oa)
+ {
+ oa[1] = new Integer(2);
+ }
+
+ void b(String[] sa)
+ {
+ sa[1] += "bar";
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/ArrayStore.out b/libjava/testsuite/libjava.lang/ArrayStore.out
new file mode 100644
index 0000000..b22379d
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/ArrayStore.out
@@ -0,0 +1,4 @@
+java.lang.ArrayIndexOutOfBoundsException
+java.lang.ArrayStoreException
+java.lang.ArrayIndexOutOfBoundsException
+foobar
diff --git a/libjava/testsuite/libjava.lang/ArrayStore.xfail b/libjava/testsuite/libjava.lang/ArrayStore.xfail
new file mode 100644
index 0000000..7728fd2
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/ArrayStore.xfail
@@ -0,0 +1 @@
+xfail-byte-output
diff --git a/libjava/testsuite/libjava.lang/ArrayStore2.java b/libjava/testsuite/libjava.lang/ArrayStore2.java
new file mode 100644
index 0000000..1364d39
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/ArrayStore2.java
@@ -0,0 +1,31 @@
+public class ArrayStore2
+{
+ public static void main(String[] args)
+ {
+ new ArrayStore2().a(new Object[2], 3);
+ }
+
+ void a(Object[] oa, int i)
+ {
+ try
+ {
+ oa[index()] = obj();
+ }
+ catch (Exception x)
+ {
+ System.out.println (x.getClass().getName());
+ }
+ }
+
+ int index()
+ {
+ System.out.println ("index");
+ return 3;
+ }
+
+ Object obj()
+ {
+ System.out.println ("rhs");
+ return new Object();
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/ArrayStore2.out b/libjava/testsuite/libjava.lang/ArrayStore2.out
new file mode 100644
index 0000000..89dddb2
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/ArrayStore2.out
@@ -0,0 +1,3 @@
+index
+rhs
+java.lang.ArrayIndexOutOfBoundsException
diff --git a/libjava/testsuite/libjava.lang/ArrayStore2.xfail b/libjava/testsuite/libjava.lang/ArrayStore2.xfail
new file mode 100644
index 0000000..e4c7ce3
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/ArrayStore2.xfail
@@ -0,0 +1 @@
+xfail-source-output