This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: new test case
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 02 Nov 2002 16:29:56 -0700
- Subject: Patch: FYI: new test case
- Reply-to: tromey at redhat dot com
I'm checking this in.
This is a test case for an error condition in class initialization.
Currently we fail this test. I have a fix which I'll check in
shortly.
Note that even with my patch we still fail when optimizing. I believe
we inline in a situation where we shouldn't.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* libjava.lang/initexc.java: New file.
* libjava.lang/initexc.out: New file.
Index: libjava.lang/initexc.java
===================================================================
RCS file: libjava.lang/initexc.java
diff -N libjava.lang/initexc.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libjava.lang/initexc.java 2 Nov 2002 23:34:33 -0000
@@ -0,0 +1,35 @@
+public class initexc
+{
+ public static class fail
+ {
+ static
+ {
+ throw new NullPointerException("nope");
+ }
+
+ public static int val ()
+ {
+ return 23;
+ }
+ }
+
+ public static void main (String[] args)
+ {
+ try
+ {
+ System.out.println (fail.val ());
+ }
+ catch (ExceptionInInitializerError _)
+ {
+ // Ok.
+ }
+ try
+ {
+ System.out.println (fail.val ());
+ }
+ catch (NoClassDefFoundError _)
+ {
+ // Ok.
+ }
+ }
+}
Index: libjava.lang/initexc.out
===================================================================
RCS file: libjava.lang/initexc.out
diff -N libjava.lang/initexc.out