* exception.cc (java_eh_info): Make value type jthrowable.
(_Jv_type_matcher): Remove now unneeded cast.
(_Jv_Throw): Make argument type jthrowable. Munge name
for SJLJ_EXCEPTIONS here ...
* gcj/cni.h: ... not here.
(JvThrow): Remove.
* gcj/javaprims.h (_Jv_Throw, _Jv_Sjlj_Throw): Update declarations.
* defineclass.cc, interpret.cc, jni.cc, posix-threads.cc,
prims.cc, resolve.cc, gnu/gcj/runtime/natFirstThread.cc,
gnu/gcj/xlib/natDrawable.cc, gnu/gcj/xlib/natFont.cc,
gnu/gcj/xlib/natWMSizeHints.cc, gnu/gcj/xlib/natWindowAttributes.cc,
gnu/gcj/xlib/natXImage.cc, java/io/natFile.cc,
java/io/natFileDescriptorEcos.cc, java/io/natFileDescriptorPosix.cc,
java/io/natFileDescriptorWin32.cc, java/io/natFileWin32.cc,
java/lang/natClass.cc, java/lang/natClassLoader.cc,
java/lang/natDouble.cc, java/lang/natObject.cc,
java/lang/natPosixProcess.cc, java/lang/natRuntime.cc,
java/lang/natString.cc, java/lang/natSystem.cc,
java/lang/natThread.cc, java/lang/reflect/natArray.cc,
java/lang/reflect/natConstructor.cc, java/lang/reflect/natField.cc,
java/lang/reflect/natMethod.cc, java/util/zip/natDeflater.cc,
java/util/zip/natInflater.cc:
Use throw, not JvThrow or _Jv_Throw.
From-SVN: r40838
+2001-03-25 Richard Henderson <rth@redhat.com>
+
+ * exception.cc (java_eh_info): Make value type jthrowable.
+ (_Jv_type_matcher): Remove now unneeded cast.
+ (_Jv_Throw): Make argument type jthrowable. Munge name
+ for SJLJ_EXCEPTIONS here ...
+ * gcj/cni.h: ... not here.
+ (JvThrow): Remove.
+ * gcj/javaprims.h (_Jv_Throw, _Jv_Sjlj_Throw): Update declarations.
+
+ * defineclass.cc, interpret.cc, jni.cc, posix-threads.cc,
+ prims.cc, resolve.cc, gnu/gcj/runtime/natFirstThread.cc,
+ gnu/gcj/xlib/natDrawable.cc, gnu/gcj/xlib/natFont.cc,
+ gnu/gcj/xlib/natWMSizeHints.cc, gnu/gcj/xlib/natWindowAttributes.cc,
+ gnu/gcj/xlib/natXImage.cc, java/io/natFile.cc,
+ java/io/natFileDescriptorEcos.cc, java/io/natFileDescriptorPosix.cc,
+ java/io/natFileDescriptorWin32.cc, java/io/natFileWin32.cc,
+ java/lang/natClass.cc, java/lang/natClassLoader.cc,
+ java/lang/natDouble.cc, java/lang/natObject.cc,
+ java/lang/natPosixProcess.cc, java/lang/natRuntime.cc,
+ java/lang/natString.cc, java/lang/natSystem.cc,
+ java/lang/natThread.cc, java/lang/reflect/natArray.cc,
+ java/lang/reflect/natConstructor.cc, java/lang/reflect/natField.cc,
+ java/lang/reflect/natMethod.cc, java/util/zip/natDeflater.cc,
+ java/util/zip/natInflater.cc:
+ Use throw, not JvThrow or _Jv_Throw.
+
2001-03-24 Bryce McKinlay <bryce@albatross.co.nz>
* java/util/HashMap.java (HashMap): If 0 is given for initialCapacity
// defineclass.cc - defining a class from .class format.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
static void
throw_no_class_def_found_error (jstring msg)
{
- if (msg == 0)
- JvThrow (new java::lang::NoClassDefFoundError);
- else
- JvThrow (new java::lang::NoClassDefFoundError (msg));
+ throw (msg
+ ? new java::lang::NoClassDefFoundError (msg)
+ : new java::lang::NoClassDefFoundError);
}
static void
static void
throw_class_format_error (jstring msg)
{
- if (msg == 0)
- JvThrow (new java::lang::ClassFormatError);
- else
- JvThrow (new java::lang::ClassFormatError (msg));
+ throw (msg
+ ? new java::lang::ClassFormatError (msg)
+ : new java::lang::ClassFormatError);
}
static void
throw_internal_error (char *msg)
{
- JvThrow
- (new java::lang::InternalError (JvNewStringLatin1 (msg)));
+ throw new java::lang::InternalError (JvNewStringLatin1 (msg));
}
static jfloat int_bits_to_float (jint value)
static void throw_incompatible_class_change_error (jstring msg)
{
- JvThrow (new java::lang::IncompatibleClassChangeError (msg));
+ throw new java::lang::IncompatibleClassChangeError (msg);
}
static void throw_class_circularity_error (jstring msg)
{
- JvThrow (new java::lang::ClassCircularityError (msg));
+ throw new java::lang::ClassCircularityError (msg);
}
#endif /* INTERPRETER */
typedef struct {
__eh_info eh_info;
- void *value;
+ jthrowable value;
} java_eh_info;
size_t mi = (size_t) match_info;
if ((mi & 1) != 0)
match_info = _Jv_FindClass ((Utf8Const*) (mi - 1), NULL);
- if (! _Jv_IsInstanceOf ((jobject) info->value, (jclass) match_info))
+ if (! _Jv_IsInstanceOf (info->value, (jclass) match_info))
return NULL;
}
/* Perform a throw, Java style. Throw will unwind through this call,
so there better not be any handlers or exception thrown here. */
+#ifdef SJLJ_EXCEPTIONS
+#define _Jv_Throw _Jv_Sjlj_Throw
+#endif
+
extern "C" void
-_Jv_Throw (void *value)
+_Jv_Throw (jthrowable value)
{
if (value == NULL)
- value = (void *) new java::lang::NullPointerException ();
+ value = new java::lang::NullPointerException;
java_eh_info *ehinfo = *(__get_eh_info ());
if (ehinfo == NULL)
{
{ _Jv_MonitorExit (obj); }
};
-#ifdef SJLJ_EXCEPTIONS
-#define _Jv_Throw _Jv_Sjlj_Throw
-#endif
-
-// Throw some exception.
-extern void JvThrow (jobject obj) __attribute__ ((__noreturn__));
-extern inline void
-JvThrow (jobject obj)
-{
- _Jv_Throw ((void *) obj);
-}
-
/* Call malloc, but throw exception if insufficient memory. */
extern inline void *
JvMalloc (jsize size)
extern "C" jsize _Jv_GetStringUTFLength (jstring);
extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
-extern "C" void _Jv_Throw (void *) __attribute__ ((__noreturn__));
-extern "C" void _Jv_Sjlj_Throw (void *) __attribute__ ((__noreturn__));
+extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
+extern "C" void _Jv_Sjlj_Throw (jthrowable) __attribute__ ((__noreturn__));
extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
extern "C" void* _Jv_Realloc (void *, jsize);
extern "C" void _Jv_Free (void*);
if (vers != JNI_VERSION_1_1 && vers != JNI_VERSION_1_2)
{
// FIXME: unload the library.
- _Jv_Throw (new java::lang::UnsatisfiedLinkError (JvNewStringLatin1 ("unrecognized version from preloaded JNI_OnLoad")));
+ throw new java::lang::UnsatisfiedLinkError (JvNewStringLatin1 ("unrecognized version from preloaded JNI_OnLoad"));
}
}
switch (status)
{
case BadDrawable:
- JvThrow(new XException(display, status));
+ throw new XException(display, status);
default:
; // All OK, NOP.
}
XFontStruct* fontStruct = XLoadQueryFont(dpy, cName);
if (fontStruct == 0)
{
- JvThrow(new XException(JvNewStringLatin1("font not found")));
+ throw new XException(JvNewStringLatin1("font not found"));
}
return reinterpret_cast<gnu::gcj::RawData*>(fontStruct);
if (hints == 0)
{
jstring errorMessage = JvNewStringLatin1("XAllocSizeHints failed");
- JvThrow(new java::lang::OutOfMemoryError(errorMessage));
+ throw new java::lang::OutOfMemoryError(errorMessage);
}
if (copyFrom != 0)
Status status = XGetWindowAttributes(dpy, win, attributesIn);
if ((status == BadDrawable) | (status == BadWindow))
- JvThrow(new XException(display, status));
+ throw new XException(display, status);
}
if (ximage == 0)
{
jstring errorMessage = JvNewStringLatin1("XCreateImage failed");
- JvThrow(new java::lang::OutOfMemoryError(errorMessage));
+ throw new java::lang::OutOfMemoryError(errorMessage);
}
bool reinitialize = false;
+ storage_size * sizeof (_Jv_word));
jobject ex = _this->run (cif, ret, args, inv);
- if (ex != 0) _Jv_Throw (ex);
+ if (ex != 0) throw static_cast<jthrowable>(ex);
}
void _Jv_InterpMethod::run_synch_object (ffi_cif* cif,
jobject ex = _this->run (cif, ret, args, inv);
_Jv_MonitorExit (rcv);
- if (ex != 0) _Jv_Throw (ex);
+ if (ex != 0) throw static_cast<jthrowable>(ex);
}
void _Jv_InterpMethod::run_synch_class (ffi_cif* cif,
jobject ex = _this->run (cif, ret, args, inv);
_Jv_MonitorExit (sync);
- if (ex != 0) _Jv_Throw (ex);
+ if (ex != 0) throw static_cast<jthrowable>(ex);
}
/*
// working if the method is final. So instead we do an
// explicit test.
if (! sp[0].o)
- throw new java::lang::NullPointerException ();
+ throw new java::lang::NullPointerException;
if (rmeth->vtable_index == -1)
{
jclass type = field->type;
jint field_offset = field->u.boffset;
if (field_offset > 0xffff)
- JvThrow (new java::lang::VirtualMachineError);
+ throw new java::lang::VirtualMachineError;
jobject obj = POPA();
NULLCHECK(obj);
jint field_offset = field->u.boffset;
if (field_offset > 0xffff)
- JvThrow (new java::lang::VirtualMachineError);
+ throw new java::lang::VirtualMachineError;
if (type->isPrimitive ())
{
SAVE_PC;
{
jobject value = POPA();
- JvThrow (value);
+ throw static_cast<jthrowable>(value);
}
NEXT_INSN;
if (value != NULL && ! to->isInstance (value))
{
- JvThrow (new java::lang::ClassCastException
- (to->getName()));
+ throw new java::lang::ClassCastException (to->getName());
}
PUSHA (value);
static void
throw_internal_error (char *msg)
{
- JvThrow (new java::lang::InternalError (JvNewStringLatin1 (msg)));
+ throw new java::lang::InternalError (JvNewStringLatin1 (msg));
}
static void
throw_incompatible_class_change_error (jstring msg)
{
- JvThrow (new java::lang::IncompatibleClassChangeError (msg));
+ throw new java::lang::IncompatibleClassChangeError (msg);
}
#ifndef HANDLE_SEGV
if (null_pointer_exc == NULL)
null_pointer_exc = new java::lang::NullPointerException;
- JvThrow (null_pointer_exc);
+ throw null_pointer_exc;
}
#endif
#ifdef HAVE_REALPATH
if (realpath (buf, buf2) == NULL)
- _Jv_Throw (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
// FIXME: what encoding to assume for file names? This affects many
// calls.
// as errors.
#ifdef HAVE_FSYNC
#else
- JvThrow (new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)));
+ throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE));
#endif
}
java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
{
if (! b)
- JvThrow (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
- JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
char *bytes = (char *)elements (b) + offset;
::diag_write (bytes, len);
}
jlong here = getFilePointer ();
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
- JvThrow (new EOFException);
+ throw new EOFException;
return 0;
}
// as errors.
#ifdef HAVE_FSYNC
if (::fsync (fd) && errno != EROFS && errno != EINVAL)
- JvThrow (new SyncFailedException (JvNewStringLatin1 (strerror (errno))));
+ throw new SyncFailedException (JvNewStringLatin1 (strerror (errno)));
#else
- JvThrow (new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)));
+ throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE));
#endif
}
{
char msg[MAXPATHLEN + 200];
sprintf (msg, "%s: %s", buf, strerror (errno));
- JvThrow (new FileNotFoundException (JvNewStringLatin1 (msg)));
+ throw new FileNotFoundException (JvNewStringLatin1 (msg));
}
return fd;
}
InterruptedIOException *iioe
= new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r;
- JvThrow (iioe);
+ throw iioe;
}
else if (r == -1)
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
// FIXME: loop if r != 1.
}
java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
{
if (! b)
- JvThrow (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
- JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
jbyte *bytes = elements (b) + offset;
int r = ::write (fd, bytes, len);
if (java::lang::Thread::interrupted())
InterruptedIOException *iioe
= new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r;
- JvThrow (iioe);
+ throw iioe;
}
else if (r == -1)
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
// FIXME: loop if r != len.
}
jint save = fd;
fd = -1;
if (::close (save))
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
jint
jlong here = getFilePointer ();
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
- JvThrow (new EOFException);
+ throw new EOFException;
off_t r = ::lseek (fd, (off_t) pos, whence == SET ? SEEK_SET : SEEK_CUR);
if (r == -1)
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
return r;
}
{
struct stat sb;
if (::fstat (fd, &sb))
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
return sb.st_size;
}
{
off_t r = ::lseek (fd, 0, SEEK_CUR);
if (r == -1)
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
return r;
}
InterruptedIOException *iioe
= new InterruptedIOException (JvNewStringLatin1 ("read interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r;
- JvThrow (iioe);
+ throw iioe;
}
else if (r == -1)
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
return b & 0xFF;
}
java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
{
if (! buffer)
- JvThrow (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
jsize bsize = JvGetArrayLength (buffer);
if (offset < 0 || count < 0 || offset + count > bsize)
- JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
jbyte *bytes = elements (buffer) + offset;
int r = ::read (fd, bytes, count);
if (r == 0)
InterruptedIOException *iioe
= new InterruptedIOException (JvNewStringLatin1 ("read interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r;
- JvThrow (iioe);
+ throw iioe;
}
else if (r == -1)
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
return r;
}
if (r == -1)
{
posix_error:
- JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
// If we didn't get anything, and we have fstat, then see if see if
return (jint) num;
#else
- JvThrow (new IOException (JvNewStringLatin1 ("unimplemented")));
+ throw new IOException (JvNewStringLatin1 ("unimplemented"));
#endif
}
void
java::io::FileDescriptor::sync (void) {
if (! FlushFileBuffers ((HANDLE)fd))
- JvThrow (new SyncFailedException (JvNewStringLatin1 (winerr ())));
+ throw new SyncFailedException (JvNewStringLatin1 (winerr ()));
}
jint
{
char msg[MAX_PATH + 1000];
sprintf (msg, "%s: %s", buf, winerr ());
- JvThrow (new FileNotFoundException (JvNewStringLatin1 (msg)));
+ throw new FileNotFoundException (JvNewStringLatin1 (msg));
}
return (jint)handle;
{
InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
iioe->bytesTransferred = bytesWritten;
- JvThrow (iioe);
+ throw iioe;
}
if (bytesWritten != 1)
- JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
}
else
- JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
// FIXME: loop until bytesWritten == 1
}
java::io::FileDescriptor::write(jbyteArray b, jint offset, jint len)
{
if (! b)
- JvThrow (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if(offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
- JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
jbyte *buf = elements (b) + offset;
DWORD bytesWritten;
{
InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
iioe->bytesTransferred = bytesWritten;
- JvThrow (iioe);
+ throw iioe;
}
}
else
- JvThrow(new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
// FIXME: loop until bytesWritten == len
}
HANDLE save = (HANDLE)fd;
fd = (jint)INVALID_HANDLE_VALUE;
if (! CloseHandle (save))
- JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
}
jint
jlong here = getFilePointer();
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
- JvThrow (new EOFException);
+ throw new EOFException;
LONG high = pos >> 32;
DWORD low = SetFilePointer ((HANDLE)fd, (DWORD)(0xffffffff & pos), &high, whence == SET ? FILE_BEGIN : FILE_CURRENT);
if ((low == 0xffffffff) && (GetLastError () != NO_ERROR))
- JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
return low;
}
LONG high = 0;
DWORD low = SetFilePointer ((HANDLE)fd, 0, &high, FILE_CURRENT);
if ((low == 0xffffffff) && (GetLastError() != NO_ERROR))
- JvThrow(new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
return (((jlong)high) << 32L) | (jlong)low;
}
DWORD read;
if (! ReadFile ((HANDLE)fd, &buf, 1, &read, NULL))
- JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
if (! read)
return -1;
else
java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count)
{
if (! buffer)
- JvThrow(new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
jsize bsize = JvGetArrayLength (buffer);
if (offset < 0 || count < 0 || offset + count > bsize)
- JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
jbyte *bytes = elements (buffer) + offset;
DWORD read;
if (! ReadFile((HANDLE)fd, bytes, count, &read, NULL))
- JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
+ throw new IOException (JvNewStringLatin1 (winerr ()));
return (jint)read;
}
LPTSTR unused;
if(!GetFullPathName(buf, MAX_PATH, buf2, &unused))
- _Jv_Throw (new IOException (JvNewStringLatin1 ("GetFullPathName failed")));
+ throw new IOException (JvNewStringLatin1 ("GetFullPathName failed"));
// FIXME: what encoding to assume for file names? This affects many
// calls.
java::lang::Class::forName (jstring className, java::lang::ClassLoader *loader)
{
if (! className)
- JvThrow (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
jsize length = _Jv_GetStringUTFLength (className);
char buffer[length];
if (klass)
_Jv_InitClass (klass);
else
- JvThrow (new java::lang::ClassNotFoundException (className));
+ throw new java::lang::ClassNotFoundException (className);
return klass;
}
return cons;
}
}
- JvThrow (new java::lang::NoSuchMethodException);
+ throw new java::lang::NoSuchMethodException;
}
JArray<java::lang::reflect::Constructor *> *
return cons;
}
}
- JvThrow (new java::lang::NoSuchMethodException);
+ throw new java::lang::NoSuchMethodException;
}
java::lang::reflect::Field *
rfield->name = name;
return rfield;
}
- JvThrow (new java::lang::NoSuchFieldException (name));
+ throw new java::lang::NoSuchFieldException (name);
}
JArray<java::lang::reflect::Field *> *
return rmethod;
}
}
- JvThrow (new java::lang::NoSuchMethodException);
+ throw new java::lang::NoSuchMethodException;
}
JArray<java::lang::reflect::Method *> *
}
}
}
- JvThrow (new java::lang::NoSuchMethodException);
+ throw new java::lang::NoSuchMethodException;
}
// This is a very slow implementation, since it re-scans all the
// FIXME: we special-case one check here just to pass a Plum Hall
// test. Once access checking is implemented, remove this.
if (this == &ClassClass)
- JvThrow (new java::lang::IllegalAccessException);
+ throw new java::lang::IllegalAccessException;
if (isPrimitive ()
|| isInterface ()
|| isArray ()
|| java::lang::reflect::Modifier::isAbstract(accflags))
- JvThrow (new java::lang::InstantiationException);
+ throw new java::lang::InstantiationException;
_Jv_InitClass (this);
_Jv_Method *meth = _Jv_GetMethodLocal (this, init_name, void_signature);
if (! meth)
- JvThrow (new java::lang::NoSuchMethodException);
+ throw new java::lang::NoSuchMethodException;
jobject r = JvAllocObject (this);
((void (*) (jobject)) meth->ncode) (r);
if (state == JV_STATE_ERROR)
{
_Jv_MonitorExit (this);
- JvThrow (new java::lang::NoClassDefFoundError);
+ throw new java::lang::NoClassDefFoundError;
}
// Step 6.
state = JV_STATE_ERROR;
notifyAll ();
_Jv_MonitorExit (this);
- JvThrow (except);
+ throw except;
}
_Jv_MonitorEnter (this);
continue;
if (Modifier::isStatic(meth->accflags))
- JvThrow (new java::lang::IncompatibleClassChangeError
- (_Jv_GetMethodString (klass, meth->name)));
+ throw new java::lang::IncompatibleClassChangeError
+ (_Jv_GetMethodString (klass, meth->name));
if (Modifier::isAbstract(meth->accflags))
- JvThrow (new java::lang::AbstractMethodError
- (_Jv_GetMethodString (klass, meth->name)));
+ throw new java::lang::AbstractMethodError
+ (_Jv_GetMethodString (klass, meth->name));
if (! Modifier::isPublic(meth->accflags))
- JvThrow (new java::lang::IllegalAccessError
- (_Jv_GetMethodString (klass, meth->name)));
+ throw new java::lang::IllegalAccessError
+ (_Jv_GetMethodString (klass, meth->name));
_Jv_AddMethodToCache (klass, meth);
return meth->ncode;
}
- JvThrow (new java::lang::IncompatibleClassChangeError);
- return NULL; // Placate compiler.
+ throw new java::lang::IncompatibleClassChangeError;
}
// Fast interface method lookup by index.
{
if (__builtin_expect
(obj != NULL && ! _Jv_IsAssignableFrom(c, JV_CLASS (obj)), false))
- JvThrow (new java::lang::ClassCastException
- ((new java::lang::StringBuffer
- (obj->getClass()->getName()))->append
- (JvNewStringUTF(" cannot be cast to "))->append
- (c->getName())->toString()));
+ throw new java::lang::ClassCastException
+ ((new java::lang::StringBuffer
+ (obj->getClass()->getName()))->append
+ (JvNewStringUTF(" cannot be cast to "))->append
+ (c->getName())->toString());
return obj;
}
jclass obj_class = JV_CLASS (obj);
if (__builtin_expect
(! _Jv_IsAssignableFrom (elt_class, obj_class), false))
- JvThrow (new java::lang::ArrayStoreException);
+ throw new java::lang::ArrayStoreException;
}
}
void
_Jv_ThrowNoSuchMethodError ()
{
- JvThrow (new java::lang::NoSuchMethodError ());
+ throw new java::lang::NoSuchMethodError;
}
// Each superinterface of a class (i.e. each interface that the class
else if (meth)
{
if (Modifier::isStatic(meth->accflags))
- JvThrow (new java::lang::IncompatibleClassChangeError
- (_Jv_GetMethodString (klass, meth->name)));
+ throw new java::lang::IncompatibleClassChangeError
+ (_Jv_GetMethodString (klass, meth->name));
if (Modifier::isAbstract(meth->accflags))
- JvThrow (new java::lang::AbstractMethodError
- (_Jv_GetMethodString (klass, meth->name)));
+ throw new java::lang::AbstractMethodError
+ (_Jv_GetMethodString (klass, meth->name));
if (! Modifier::isPublic(meth->accflags))
- JvThrow (new java::lang::IllegalAccessError
- (_Jv_GetMethodString (klass, meth->name)));
+ throw new java::lang::IllegalAccessError
+ (_Jv_GetMethodString (klass, meth->name));
itable[pos] = meth->ncode;
}
}
}
}
- JvThrow (new java::lang::NoSuchMethodException);
+ throw new java::lang::NoSuchMethodException;
}
// natClassLoader.cc - Implementation of java.lang.ClassLoader native methods.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
_Jv_Utf8Const * name2 = _Jv_makeUtf8Const (name);
if (! _Jv_VerifyClassName (name2))
- JvThrow (new java::lang::ClassFormatError
- (JvNewStringLatin1 ("erroneous class name")));
+ throw new java::lang::ClassFormatError
+ (JvNewStringLatin1 ("erroneous class name"));
klass->name = name2;
}
// anything but ClassNotFoundException,
// or some kind of Error.
- JvThrow (ex);
+ // FIXME: Rewrite this as a cleanup instead of
+ // as a catch handler.
+
+ throw ex;
}
// if everything proceeded sucessfully, we're loaded.
_Jv_MonitorExit (klass);
if (klass->state == JV_STATE_ERROR)
- {
- _Jv_Throw (new java::lang::LinkageError ());
- }
+ throw new java::lang::LinkageError;
}
// Finish linking a class. Only called from ClassLoader::resolveClass.
if (! found)
{
jstring str = _Jv_NewStringUTF (name->data);
- JvThrow (new java::lang::ClassNotFoundException (str));
+ throw new java::lang::ClassNotFoundException (str);
}
pool->data[index].clazz = found;
if (endptr == data + blength)
return val;
}
- _Jv_Throw (new NumberFormatException);
+ throw new NumberFormatException;
}
// natObject.cc - Implementation of the Object class.
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
else
{
if (! java::lang::Cloneable::class$.isAssignableFrom(klass))
- JvThrow (new CloneNotSupportedException);
+ throw new CloneNotSupportedException;
size = klass->size();
r = JvAllocObject (klass, size);
sync_init ();
_Jv_SyncInfo *si = (_Jv_SyncInfo *) sync_info;
if (__builtin_expect (_Jv_CondNotify (&si->condition, &si->mutex), false))
- JvThrow (new IllegalMonitorStateException(JvNewStringLatin1
- ("current thread not owner")));
+ throw new IllegalMonitorStateException(JvNewStringLatin1
+ ("current thread not owner"));
}
void
sync_init ();
_Jv_SyncInfo *si = (_Jv_SyncInfo *) sync_info;
if (__builtin_expect (_Jv_CondNotifyAll (&si->condition, &si->mutex), false))
- JvThrow (new IllegalMonitorStateException(JvNewStringLatin1
- ("current thread not owner")));
+ throw new IllegalMonitorStateException(JvNewStringLatin1
+ ("current thread not owner"));
}
void
if (__builtin_expect (INIT_NEEDED (this), false))
sync_init ();
if (__builtin_expect (timeout < 0 || nanos < 0 || nanos > 999999, false))
- JvThrow (new IllegalArgumentException);
+ throw new IllegalArgumentException;
_Jv_SyncInfo *si = (_Jv_SyncInfo *) sync_info;
switch (_Jv_CondWait (&si->condition, &si->mutex, timeout, nanos))
{
case _JV_NOT_OWNER:
- JvThrow (new IllegalMonitorStateException (JvNewStringLatin1
- ("current thread not owner")));
+ throw new IllegalMonitorStateException (JvNewStringLatin1
+ ("current thread not owner"));
case _JV_INTERRUPTED:
if (Thread::interrupted ())
- JvThrow (new InterruptedException);
+ throw new InterruptedException;
}
}
{
#ifndef HANDLE_SEGV
if (__builtin_expect (! obj, false))
- JvThrow (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
#endif
if (__builtin_expect (INIT_NEEDED (obj), false))
obj->sync_init ();
JvAssert (! INIT_NEEDED (obj));
_Jv_SyncInfo *si = (_Jv_SyncInfo *) obj->sync_info;
if (__builtin_expect (_Jv_MutexUnlock (&si->mutex), false))
- JvThrow (new java::lang::IllegalMonitorStateException);
+ throw new java::lang::IllegalMonitorStateException;
return 0;
}
if (r == -1)
{
jstring x = JvNewStringLatin1 (strerror (errno));
- _Jv_Throw (new IllegalThreadStateException (x));
+ throw new IllegalThreadStateException (x);
}
hasExited = true;
}
if (java::lang::Thread::interrupted())
- _Jv_Throw (new InterruptedException (JvNewStringLatin1 ("wait interrupted")));
+ throw new InterruptedException (JvNewStringLatin1 ("wait interrupted"));
}
return status;
const char *msg = lt_dlerror ();
jstring str = path->concat (JvNewStringLatin1 (": "));
str = str->concat (JvNewStringLatin1 (msg));
- _Jv_Throw (new UnsatisfiedLinkError (str));
+ throw new UnsatisfiedLinkError (str);
}
add_library (h);
if (vers != JNI_VERSION_1_1 && vers != JNI_VERSION_1_2)
{
// FIXME: unload the library.
- _Jv_Throw (new UnsatisfiedLinkError (JvNewStringLatin1 ("unrecognized version from JNI_OnLoad")));
+ throw new UnsatisfiedLinkError (JvNewStringLatin1 ("unrecognized version from JNI_OnLoad"));
}
}
#else
- _Jv_Throw (new UnknownError
- (JvNewStringLatin1 (do_search
- ? "Runtime.loadLibrary not implemented"
- : "Runtime.load not implemented")));
+ throw new UnknownError
+ (JvNewStringLatin1 (do_search
+ ? "Runtime.loadLibrary not implemented"
+ : "Runtime.load not implemented"));
#endif /* USE_LTDL */
}
jboolean dont_copy)
{
if (! chars)
- JvThrow (new NullPointerException);
+ throw new NullPointerException;
jsize data_size = JvGetArrayLength (chars);
if (offset < 0 || count < 0 || offset + count < 0
|| offset + count > data_size)
- JvThrow (new StringIndexOutOfBoundsException());
+ throw new StringIndexOutOfBoundsException;
jcharArray array;
jchar *pdst;
if (! dont_copy)
jint count)
{
if (! ascii)
- JvThrow (new NullPointerException);
+ throw new NullPointerException;
jsize data_size = JvGetArrayLength (ascii);
if (offset < 0 || count < 0 || offset + count < 0
|| offset + count > data_size)
- JvThrow (new java::lang::StringIndexOutOfBoundsException());
+ throw new java::lang::StringIndexOutOfBoundsException;
jcharArray array = JvNewCharArray(count);
jbyte *psrc = elements (ascii) + offset;
jchar *pdst = elements (array);
jstring encoding)
{
if (! bytes)
- JvThrow (new NullPointerException);
+ throw new NullPointerException;
jsize data_size = JvGetArrayLength (bytes);
if (offset < 0 || count < 0 || offset + count < 0
|| offset + count > data_size)
- JvThrow (new StringIndexOutOfBoundsException);
+ throw new StringIndexOutOfBoundsException;
jcharArray array = JvNewCharArray (count);
gnu::gcj::convert::BytesToUnicode *converter
= gnu::gcj::convert::BytesToUnicode::getDecoder(encoding);
java::lang::String::charAt(jint i)
{
if (i < 0 || i >= count)
- JvThrow (new java::lang::StringIndexOutOfBoundsException());
+ throw new java::lang::StringIndexOutOfBoundsException;
return JvGetStringChars(this)[i];
}
jint dst_length = JvGetArrayLength (dst);
if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count
|| dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length)
- JvThrow (new java::lang::StringIndexOutOfBoundsException());
+ throw new java::lang::StringIndexOutOfBoundsException;
jchar *dPtr = elements (dst) + dstBegin;
jchar *sPtr = JvGetStringChars (this) + srcBegin;
jint i = srcEnd-srcBegin;
jint dst_length = JvGetArrayLength (dst);
if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count
|| dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length)
- JvThrow (new java::lang::StringIndexOutOfBoundsException());
+ throw new java::lang::StringIndexOutOfBoundsException;
jbyte *dPtr = elements (dst) + dstBegin;
jchar *sPtr = JvGetStringChars (this) + srcBegin;
jint i = srcEnd-srcBegin;
java::lang::String::substring (jint beginIndex, jint endIndex)
{
if (beginIndex < 0 || endIndex > count || beginIndex > endIndex)
- JvThrow (new StringIndexOutOfBoundsException());
+ throw new StringIndexOutOfBoundsException;
if (beginIndex == 0 && endIndex == count)
return this;
jint newCount = endIndex - beginIndex;
{
jint data_length = JvGetArrayLength (data);
if (offset < 0 || count < 0 || offset+count > data_length)
- JvThrow (new java::lang::IndexOutOfBoundsException());
+ throw new java::lang::IndexOutOfBoundsException;
jstring result = JvAllocString(count);
jchar *sPtr = elements (data) + offset;
jchar *dPtr = JvGetStringChars(result);
jint count)
{
if (! src || ! dst)
- _Jv_Throw (new NullPointerException);
+ throw new NullPointerException;
jclass src_c = src->getClass();
jclass dst_c = dst->getClass();
if (! src_c->isArray() || ! dst_c->isArray()
|| src_comp->isPrimitive() != dst_comp->isPrimitive()
|| (src_comp->isPrimitive() && src_comp != dst_comp))
- _Jv_Throw (new ArrayStoreException);
+ throw new ArrayStoreException;
__JArray *src_a = (__JArray *) src;
__JArray *dst_a = (__JArray *) dst;
if (src_offset < 0 || dst_offset < 0 || count < 0
|| src_offset + count > src_a->length
|| dst_offset + count > dst_a->length)
- _Jv_Throw (new ArrayIndexOutOfBoundsException);
+ throw new ArrayIndexOutOfBoundsException;
// Do-nothing cases.
if ((src == dst && src_offset == dst_offset)
{
if (*src_elts
&& ! dst_comp->isAssignableFrom((*src_elts)->getClass()))
- _Jv_Throw (new ArrayStoreException);
+ throw new ArrayStoreException;
*dst_elts++ = *src_elts++;
}
}
java::lang::Thread::join (jlong millis, jint nanos)
{
if (millis < 0 || nanos < 0 || nanos > 999999)
- _Jv_Throw (new IllegalArgumentException);
+ throw new IllegalArgumentException;
Thread *current = currentThread ();
_Jv_MutexUnlock (&nt->join_mutex);
if (current->isInterrupted (true))
- _Jv_Throw (new InterruptedException);
+ throw new InterruptedException;
}
void
{
checkAccess ();
if (newPriority < MIN_PRIORITY || newPriority > MAX_PRIORITY)
- _Jv_Throw (new IllegalArgumentException);
+ throw new IllegalArgumentException;
jint gmax = group->getMaxPriority();
if (newPriority > gmax)
java::lang::Thread::sleep (jlong millis, jint nanos)
{
if (millis < 0 || nanos < 0 || nanos > 999999)
- _Jv_Throw (new IllegalArgumentException);
+ throw new IllegalArgumentException;
if (millis == 0 && nanos == 0)
++nanos;
_Jv_MutexUnlock (&nt->join_mutex);
if (current->isInterrupted (true))
- _Jv_Throw (new InterruptedException);
+ throw new InterruptedException;
}
void
// Its illegal to re-start() a thread, even if its dead.
if (!startable_flag)
- _Jv_Throw (new IllegalThreadStateException);
+ throw new IllegalThreadStateException;
alive_flag = true;
startable_flag = false;
void
java::lang::Thread::stop (java::lang::Throwable *)
{
- _Jv_Throw (new UnsupportedOperationException
- (JvNewStringLatin1 ("java::lang::Thread::stop unimplemented")));
+ throw new UnsupportedOperationException
+ (JvNewStringLatin1 ("java::lang::Thread::stop unimplemented"));
}
void
java::lang::Thread::suspend (void)
{
checkAccess ();
- _Jv_Throw (new UnsupportedOperationException
- (JvNewStringLatin1 ("java::lang::Thread::suspend unimplemented")));
+ throw new UnsupportedOperationException
+ (JvNewStringLatin1 ("java::lang::Thread::suspend unimplemented"));
}
void
// natField.cc - Implementation of java.lang.reflect.Field native methods.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
{
jclass arrayType = array->getClass();
if (! arrayType->isArray ())
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
return ((__JArray*) array)->length;
}
{
jclass arrayType = array->getClass();
if (! arrayType->isArray ())
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
jint length = ((__JArray*) array)->length;
if ((_Jv_uint) index >= (_Jv_uint) length)
_Jv_ThrowBadArrayIndex(index);
jclass elementType = getElementType (array, index);
if (elementType == JvPrimClass (boolean))
return elements ((jbooleanArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jchar
jclass elementType = getElementType (array, index);
if (elementType == JvPrimClass (char))
return elements ((jcharArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jbyte
jclass elementType = getElementType (array, index);
if (elementType == JvPrimClass (byte))
return elements ((jbyteArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jshort
return elements ((jshortArray) array) [index];
if (elementType == JvPrimClass (byte))
return elements ((jbyteArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jint
return elements ((jbyteArray) array) [index];
if (elementType == JvPrimClass (char))
return elements ((jcharArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jlong
return elements ((jbyteArray) array) [index];
if (elementType == JvPrimClass (char))
return elements ((jcharArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jfloat
return elements ((jbyteArray) array) [index];
if (elementType == JvPrimClass (char))
return elements ((jcharArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jdouble
return elements ((jbyteArray) array) [index];
if (elementType == JvPrimClass (char))
return elements ((jcharArray) array) [index];
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
jobject
else
return java::lang::Boolean::FALSE;
}
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
else if (elementType == JvPrimClass (double))
elements ((jdoubleArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
else if (elementType == JvPrimClass (double))
elements ((jdoubleArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
else if (elementType == JvPrimClass (double))
elements ((jdoubleArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
else if (elementType == JvPrimClass (double))
elements ((jdoubleArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
else if (elementType == JvPrimClass (double))
elements ((jdoubleArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
else if (elementType == JvPrimClass (double))
elements ((jdoubleArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
if (elementType == JvPrimClass (double))
elements ((jdoubleArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
if (elementType == JvPrimClass (boolean))
elements ((jbooleanArray) array) [index] = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
jobject value, jclass elType)
{
if (! _Jv_IsInstanceOf (value, elType))
- JvThrow (new java::lang::IllegalArgumentException ());
+ throw new java::lang::IllegalArgumentException;
elements ((jobjectArray) array) [index] = value;
}
// natConstructor.cc - Native code for Constructor class.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
using namespace java::lang::reflect;
if (Modifier::isAbstract (declaringClass->getModifiers()))
- JvThrow (new InstantiationException);
+ throw new InstantiationException;
jmethodID meth = _Jv_FromReflectedConstructor (this);
// In the constructor case the return type is the type of the
else
{
if (obj == NULL)
- _Jv_Throw (new java::lang::NullPointerException ());
+ throw new java::lang::NullPointerException;
if (! _Jv_IsInstanceOf (obj, field->getDeclaringClass()))
- JvThrow (new java::lang::IllegalArgumentException ());
+ throw new java::lang::IllegalArgumentException;
return (void*) ((char*) obj + fld->getOffset ());
}
}
{
if (cls == JvPrimClass (boolean))
return * (jboolean *) addr;
- _Jv_Throw (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static jchar
{
if (cls == JvPrimClass (char))
return * (jchar *) addr;
- _Jv_Throw (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static jbyte
{
if (cls == JvPrimClass (byte))
return * (jbyte *) addr;
- _Jv_Throw (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static jshort
return * (jshort *) addr;
if (cls == JvPrimClass (byte))
return * (jbyte *) addr;
- _Jv_Throw (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static jint
return * (jchar *) addr;
if (cls == JvPrimClass (byte))
return * (jbyte *) addr;
- _Jv_Throw (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static jlong
else
return java::lang::Boolean::FALSE;
}
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
if (type == JvPrimClass (boolean))
* (jboolean *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
else if (type == JvPrimClass (double))
* (jdouble *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
else if (type == JvPrimClass (double))
* (jdouble *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
else if (type == JvPrimClass (double))
* (jdouble *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
else if (type == JvPrimClass (double))
* (jdouble *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
else if (type == JvPrimClass (double))
* (jdouble *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
else if (type == JvPrimClass (double))
* (jdouble *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
static void
if (type == JvPrimClass (double))
* (jdouble *) addr = value;
else
- JvThrow (new java::lang::IllegalArgumentException());
+ throw new java::lang::IllegalArgumentException;
}
void
java::lang::reflect::Field::set (jclass caller, jobject object, jobject value, jclass type)
{
if (! _Jv_IsInstanceOf (value, type))
- JvThrow (new java::lang::IllegalArgumentException ());
+ throw new java::lang::IllegalArgumentException;
void* addr = getAddr (this, caller, object);
* (jobject*) addr = value;
}
{
jclass k = obj ? obj->getClass() : NULL;
if (! obj)
- JvThrow (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (! declaringClass->isAssignableFrom(k))
- JvThrow (new java::lang::IllegalArgumentException);
+ throw new java::lang::IllegalArgumentException;
// FIXME: access checks.
// Find the possibly overloaded method based on the runtime type
// The JDK accepts this, so we do too.
}
else if (parameter_types->length != args->length)
- JvThrow (new java::lang::IllegalArgumentException);
+ throw new java::lang::IllegalArgumentException;
int param_count = parameter_types->length;
if (! argelts[i]
|| ! k
|| ! can_widen (k, paramelts[i]))
- JvThrow (new java::lang::IllegalArgumentException);
+ throw new java::lang::IllegalArgumentException;
if (paramelts[i] == JvPrimClass (boolean))
COPY (&argvals[i],
else
{
if (argelts[i] && ! paramelts[i]->isAssignableFrom (k))
- JvThrow (new java::lang::IllegalArgumentException);
+ throw new java::lang::IllegalArgumentException;
COPY (&argvals[i], argelts[i], jobject);
}
}
&ret_value);
if (ex)
- JvThrow (ex);
+ throw ex;
jobject r;
#define VAL(Wrapper, Field) (new Wrapper (ret_value.Field))
z_streamp s = (z_streamp) zstream;
if (! buf)
- _Jv_Throw (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (off < 0 || len < 0 || off + len > buf->length)
- _Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
if (len == 0)
return 0;
case Z_STREAM_ERROR:
case Z_BUF_ERROR:
// FIXME?
- _Jv_Throw (new java::lang::InternalError);
+ throw new java::lang::InternalError;
break;
case Z_OK:
z_streamp s = (z_streamp) zstream;
if (! buf)
- _Jv_Throw (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (off < 0 || len < 0 || off + len > buf->length)
- _Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
// Ignore errors.
deflateSetDictionary (s, (Bytef *) (elements (buf) + off), len);
z_streamp s = (z_streamp) zstream;
if (! buf)
- _Jv_Throw (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (off < 0 || len < 0 || off + len > buf->length)
- _Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
s->next_in = (Bytef *) (elements (buf) + off);
s->avail_in = len;
jstring msg = NULL;
if (stream->msg != NULL)
msg = JvNewStringLatin1 (stream->msg);
- _Jv_Throw (new java::lang::InternalError (msg));
+ throw new java::lang::InternalError (msg);
}
zstream = reinterpret_cast<gnu::gcj::RawData *> (stream);
z_streamp s = (z_streamp) zstream;
if (! buf)
- _Jv_Throw (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (off < 0 || len < 0 || off + len > buf->length)
- _Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
if (len == 0)
return 0;
break;
case Z_DATA_ERROR:
- _Jv_Throw (new java::util::zip::DataFormatException
- (s->msg == NULL ? NULL : JvNewStringLatin1 (s->msg)));
+ throw new java::util::zip::DataFormatException
+ (s->msg == NULL ? NULL : JvNewStringLatin1 (s->msg));
break;
case Z_MEM_ERROR:
- _Jv_Throw (new java::lang::OutOfMemoryError);
+ throw new java::lang::OutOfMemoryError;
break;
case Z_OK:
z_streamp s = (z_streamp) zstream;
if (! buf)
- _Jv_Throw (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (off < 0 || len < 0 || off + len > buf->length)
- _Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
// Ignore errors.
inflateSetDictionary (s, (Bytef *) (elements (buf) + off), len);
z_streamp s = (z_streamp) zstream;
if (! buf)
- _Jv_Throw (new java::lang::NullPointerException);
+ throw new java::lang::NullPointerException;
if (off < 0 || len < 0 || off + len > buf->length)
- _Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
+ throw new java::lang::ArrayIndexOutOfBoundsException;
s->next_in = (Bytef *) (elements (buf) + off);
s->avail_in = len;
jstring msg = NULL;
if (stream->msg != NULL)
msg = JvNewStringLatin1 (stream->msg);
- _Jv_Throw (new java::lang::InternalError (msg));
+ throw new java::lang::InternalError (msg);
}
zstream = reinterpret_cast<gnu::gcj::RawData *> (stream);
if (function == NULL)
{
jstring str = JvNewStringUTF (name->data);
- JvThrow (new java::lang::AbstractMethodError (str));
+ throw new java::lang::AbstractMethodError (str);
}
}
if (r)
{
const char* msg = "Cannot create additional threads";
- JvThrow (new java::lang::OutOfMemoryError (JvNewStringUTF (msg)));
+ throw new java::lang::OutOfMemoryError (JvNewStringUTF (msg));
}
}
#endif
\f
-extern "C" void _Jv_ThrowSignal (void *) __attribute ((noreturn));
+extern "C" void _Jv_ThrowSignal (jthrowable) __attribute ((noreturn));
// Just like _Jv_Throw, but fill in the stack trace first. Although
// this is declared extern in order that its name not be mangled, it
// is not intended to be used outside this file.
void
-_Jv_ThrowSignal (void *e)
+_Jv_ThrowSignal (jthrowable throwable)
{
- java::lang::Throwable *throwable = (java::lang::Throwable *)e;
throwable->fillInStackTrace ();
- _Jv_Throw (throwable);
+ throw throwable;
}
#ifdef HANDLE_SEGV
len = strlen (s);
Utf8Const* m = (Utf8Const*) _Jv_AllocBytes (sizeof(Utf8Const) + len + 1);
if (! m)
- JvThrow (no_memory);
+ throw no_memory;
memcpy (m->data, s, len);
m->data[len] = 0;
m->length = len;
void
_Jv_ThrowBadArrayIndex(jint bad_index)
{
- JvThrow (new java::lang::ArrayIndexOutOfBoundsException
- (java::lang::String::valueOf(bad_index)));
+ throw new java::lang::ArrayIndexOutOfBoundsException
+ (java::lang::String::valueOf (bad_index));
}
void
_Jv_ThrowNullPointerException ()
{
- throw new java::lang::NullPointerException ();
+ throw new java::lang::NullPointerException;
}
// Allocate some unscanned memory and throw an exception if no memory.
{
void *r = _Jv_AllocBytes (size);
if (! r)
- _Jv_Throw (no_memory);
+ throw no_memory;
return r;
}
jobject obj = (jobject) _Jv_AllocObj (size, klass);
if (__builtin_expect (! obj, false))
- JvThrow (no_memory);
+ throw no_memory;
// If this class has inherited finalize from Object, then don't
// bother registering a finalizer. We know that finalize() is the
_Jv_NewObjectArray (jsize count, jclass elementClass, jobject init)
{
if (__builtin_expect (count < 0, false))
- JvThrow (new java::lang::NegativeArraySizeException);
+ throw new java::lang::NegativeArraySizeException;
JvAssert (! elementClass->isPrimitive ());
obj = (jobjectArray) _Jv_AllocArray (size, klass);
if (__builtin_expect (! obj, false))
- JvThrow (no_memory);
+ throw no_memory;
// Cast away const.
jsize *lp = const_cast<jsize *> (&obj->length);
*lp = count;
{
int elsize = eltype->size();
if (__builtin_expect (count < 0, false))
- JvThrow (new java::lang::NegativeArraySizeException ());
+ throw new java::lang::NegativeArraySizeException;
JvAssert (eltype->isPrimitive ());
jobject dummy = NULL;
// Check for overflow.
if (__builtin_expect ((size_t) count >
(SIZE_T_MAX - size) / elsize, false))
- JvThrow (no_memory);
+ throw no_memory;
jclass klass = _Jv_GetArrayClass (eltype, 0);
__JArray *arr = (__JArray*) _Jv_AllocObj (size + elsize * count, klass);
if (__builtin_expect (! arr, false))
- JvThrow (no_memory);
+ throw no_memory;
// Cast away const.
jsize *lp = const_cast<jsize *> (&arr->length);
*lp = count;
size = 1;
void *ptr = malloc ((size_t) size);
if (__builtin_expect (ptr == NULL, false))
- JvThrow (no_memory);
+ throw no_memory;
return ptr;
}
size = 1;
ptr = realloc (ptr, (size_t) size);
if (__builtin_expect (ptr == NULL, false))
- JvThrow (no_memory);
+ throw no_memory;
return ptr;
}
static void throw_incompatible_class_change_error (jstring msg)
{
- JvThrow (new java::lang::IncompatibleClassChangeError (msg));
+ throw new java::lang::IncompatibleClassChangeError (msg);
}
_Jv_word
if (! found)
{
jstring str = _Jv_NewStringUTF (name->data);
- JvThrow (new java::lang::ClassNotFoundException (str));
+ throw new java::lang::ClassNotFoundException (str);
}
if ((found->accflags & Modifier::PUBLIC) == Modifier::PUBLIC
}
else
{
- JvThrow (new java::lang::IllegalAccessError (found->getName()));
+ throw new java::lang::IllegalAccessError (found->getName());
}
}
break;
_Jv_ResolveField (field, cls->loader);
if (field_type != 0 && field->type != field_type)
- JvThrow
- (new java::lang::LinkageError
- (JvNewStringLatin1
- ("field type mismatch with different loaders")));
+ throw new java::lang::LinkageError
+ (JvNewStringLatin1
+ ("field type mismatch with different loaders"));
the_field = field;
goto end_of_field_search;
}
else
{
- JvThrow (new java::lang::IllegalAccessError);
+ throw new java::lang::IllegalAccessError;
}
}
}
msg = msg->concat (JvNewStringLatin1("."));
msg = msg->concat (_Jv_NewStringUTF (method_name->data));
msg = msg->concat (JvNewStringLatin1(" was not found."));
- JvThrow(new java::lang::NoSuchMethodError (msg));
+ throw new java::lang::NoSuchMethodError (msg);
}
pool->data[index].rmethod =
}
else
{
- JvThrow (new java::lang::IllegalAccessError);
+ throw new java::lang::IllegalAccessError;
}
}
return 0;
static void
_Jv_abstractMethodError ()
{
- JvThrow (new java::lang::AbstractMethodError);
+ throw new java::lang::AbstractMethodError;
}
void
{
clz->state = JV_STATE_ERROR;
clz->notifyAll ();
- JvThrow (new java::lang::IncompatibleClassChangeError
- (clz->getName ()));
+ throw new java::lang::IncompatibleClassChangeError (clz->getName ());
}
/* FIXME: At this point, if (loader != super_class->loader), we
static void
throw_class_format_error (jstring msg)
{
- if (msg == 0)
- JvThrow (new java::lang::ClassFormatError);
- else
- JvThrow (new java::lang::ClassFormatError (msg));
+ throw (msg
+ ? new java::lang::ClassFormatError (msg)
+ : new java::lang::ClassFormatError);
}
static void
static void
throw_internal_error (char *msg)
{
- JvThrow
- (new java::lang::InternalError (JvNewStringLatin1 (msg)));
+ throw new java::lang::InternalError (JvNewStringLatin1 (msg));
}