aboutsummaryrefslogtreecommitdiff
path: root/libjava/testsuite
diff options
context:
space:
mode:
authorWarren Levy <warrenl@cygnus.com>2000-06-13 23:44:05 +0000
committerWarren Levy <warrenl@gcc.gnu.org>2000-06-13 23:44:05 +0000
commit7254e4eab9fa736b5a47fd44617b7604d83ff576 (patch)
treed1f8636f0121d089548ceddfd77ecba259a1f824 /libjava/testsuite
parent46327bc509a091ca9def304efd65b37110160d24 (diff)
downloadgcc-7254e4eab9fa736b5a47fd44617b7604d83ff576.zip
gcc-7254e4eab9fa736b5a47fd44617b7604d83ff576.tar.gz
gcc-7254e4eab9fa736b5a47fd44617b7604d83ff576.tar.bz2
Test for PR java.lang/258:
* libjava.lang/Class_1.java: New file. * libjava.lang/Class_1.out: New file. From-SVN: r34532
Diffstat (limited to 'libjava/testsuite')
-rw-r--r--libjava/testsuite/ChangeLog6
-rw-r--r--libjava/testsuite/libjava.lang/Class_1.java49
-rw-r--r--libjava/testsuite/libjava.lang/Class_1.out21
3 files changed, 76 insertions, 0 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog
index c8b383a..317ddfb 100644
--- a/libjava/testsuite/ChangeLog
+++ b/libjava/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-13 Warren Levy <warrenl@cygnus.com>
+
+ Test for PR java.lang/258:
+ * libjava.lang/Class_1.java: New file.
+ * libjava.lang/Class_1.out: New file.
+
2000-05-29 Bryce McKinlay <bryce@albatross.co.nz>
* libjava.lang/PR242.java: New file. PR gcj/242.
diff --git a/libjava/testsuite/libjava.lang/Class_1.java b/libjava/testsuite/libjava.lang/Class_1.java
new file mode 100644
index 0000000..f2156eb
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/Class_1.java
@@ -0,0 +1,49 @@
+class C {}
+class D extends C implements I {}
+interface I {}
+interface J extends I {}
+
+public class Class_1
+{
+ static void printIsAssignableFrom(Class a, Class b, boolean c)
+ {
+ // The field 'c' can be viewed to see the expected value.
+ System.out.println(a.isAssignableFrom(b));
+ }
+
+ public static void main (String arg[])
+ {
+ System.out.println("Testing class `Class_1'...");
+ printIsAssignableFrom(C.class, Object.class, false);
+ printIsAssignableFrom(C.class, C.class, true);
+ printIsAssignableFrom(C.class, D.class, true);
+ printIsAssignableFrom(D.class, C.class, false);
+
+ printIsAssignableFrom(Object.class, int[].class, true);
+ printIsAssignableFrom(int[].class, int[].class, true);
+ printIsAssignableFrom(C[].class, D.class, false);
+ printIsAssignableFrom(C[].class, D[].class, true);
+ // Known compiler limitation prevents next case from compiling.
+ // printIsAssignableFrom(C[].class, C[][].class, false);
+ System.out.println("printIsAssignableFrom(C[].class, C[][].class, false);" +
+ " case uncompilable due to known compiler limitation.");
+
+ printIsAssignableFrom(Object.class, I.class, true);
+ printIsAssignableFrom(I.class, I.class, true);
+ printIsAssignableFrom(D.class, I.class, false);
+ printIsAssignableFrom(I.class, D.class, true);
+
+ printIsAssignableFrom(D.class, J.class, false);
+ printIsAssignableFrom(J.class, D.class, false);
+
+ printIsAssignableFrom(I.class, J.class, true);
+ printIsAssignableFrom(J.class, J.class, true);
+ printIsAssignableFrom(J.class, I.class, false);
+
+ // Returns true iff both Class objects are equal.
+ printIsAssignableFrom(long.class, long.class, true);
+
+ // Does not work for primitive types in general.
+ printIsAssignableFrom(long.class, int.class, false);
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/Class_1.out b/libjava/testsuite/libjava.lang/Class_1.out
new file mode 100644
index 0000000..6a5863a
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/Class_1.out
@@ -0,0 +1,21 @@
+Testing class `Class_1'...
+false
+true
+true
+false
+true
+true
+false
+true
+printIsAssignableFrom(C[].class, C[][].class, false); case uncompilable due to known compiler limitation.
+true
+true
+false
+true
+false
+false
+true
+true
+false
+true
+false