exception.cc (java_eh_info): Make value type jthrowable.
* 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
This commit is contained in:
parent
56b8908481
commit
b3208f56cb
36 changed files with 294 additions and 284 deletions
|
@ -118,7 +118,7 @@ java::io::File::getCanonicalPath (void)
|
|||
|
||||
#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.
|
||||
|
|
|
@ -54,7 +54,7 @@ java::io::FileDescriptor::sync (void)
|
|||
// as errors.
|
||||
#ifdef HAVE_FSYNC
|
||||
#else
|
||||
JvThrow (new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)));
|
||||
throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,9 @@ void
|
|||
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);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ java::io::FileDescriptor::seek (jlong pos, jint whence)
|
|||
jlong here = getFilePointer ();
|
||||
|
||||
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
|
||||
JvThrow (new EOFException);
|
||||
throw new EOFException;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ java::io::FileDescriptor::sync (void)
|
|||
// 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
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
|
|||
{
|
||||
char msg[MAXPATHLEN + 200];
|
||||
sprintf (msg, "%s: %s", buf, strerror (errno));
|
||||
JvThrow (new FileNotFoundException (JvNewStringLatin1 (msg)));
|
||||
throw new FileNotFoundException (JvNewStringLatin1 (msg));
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
@ -127,10 +127,10 @@ java::io::FileDescriptor::write (jint b)
|
|||
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.
|
||||
}
|
||||
|
||||
|
@ -138,9 +138,9 @@ void
|
|||
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())
|
||||
|
@ -148,10 +148,10 @@ java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
|
|||
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.
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ java::io::FileDescriptor::close (void)
|
|||
jint save = fd;
|
||||
fd = -1;
|
||||
if (::close (save))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
}
|
||||
|
||||
jint
|
||||
|
@ -173,11 +173,11 @@ java::io::FileDescriptor::seek (jlong pos, jint whence)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ java::io::FileDescriptor::length (void)
|
|||
{
|
||||
struct stat sb;
|
||||
if (::fstat (fd, &sb))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
return sb.st_size;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ java::io::FileDescriptor::getFilePointer (void)
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -211,10 +211,10 @@ java::io::FileDescriptor::read (void)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -222,10 +222,10 @@ jint
|
|||
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)
|
||||
|
@ -235,10 +235,10 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ java::io::FileDescriptor::available (void)
|
|||
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
|
||||
|
@ -313,6 +313,6 @@ java::io::FileDescriptor::available (void)
|
|||
|
||||
return (jint) num;
|
||||
#else
|
||||
JvThrow (new IOException (JvNewStringLatin1 ("unimplemented")));
|
||||
throw new IOException (JvNewStringLatin1 ("unimplemented"));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ java::io::FileDescriptor::valid (void) {
|
|||
void
|
||||
java::io::FileDescriptor::sync (void) {
|
||||
if (! FlushFileBuffers ((HANDLE)fd))
|
||||
JvThrow (new SyncFailedException (JvNewStringLatin1 (winerr ())));
|
||||
throw new SyncFailedException (JvNewStringLatin1 (winerr ()));
|
||||
}
|
||||
|
||||
jint
|
||||
|
@ -109,7 +109,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
|
|||
{
|
||||
char msg[MAX_PATH + 1000];
|
||||
sprintf (msg, "%s: %s", buf, winerr ());
|
||||
JvThrow (new FileNotFoundException (JvNewStringLatin1 (msg)));
|
||||
throw new FileNotFoundException (JvNewStringLatin1 (msg));
|
||||
}
|
||||
|
||||
return (jint)handle;
|
||||
|
@ -127,13 +127,13 @@ java::io::FileDescriptor::write (jint b)
|
|||
{
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -141,9 +141,9 @@ void
|
|||
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;
|
||||
|
@ -153,11 +153,11 @@ java::io::FileDescriptor::write(jbyteArray b, jint offset, jint len)
|
|||
{
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ java::io::FileDescriptor::close (void)
|
|||
HANDLE save = (HANDLE)fd;
|
||||
fd = (jint)INVALID_HANDLE_VALUE;
|
||||
if (! CloseHandle (save))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
}
|
||||
|
||||
jint
|
||||
|
@ -179,12 +179,12 @@ java::io::FileDescriptor::seek (jlong pos, jint whence)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ java::io::FileDescriptor::getFilePointer(void)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ java::io::FileDescriptor::read(void)
|
|||
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
|
||||
|
@ -227,17 +227,17 @@ jint
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ java::io::File::getCanonicalPath (void)
|
|||
|
||||
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.
|
||||
|
|
|
@ -75,7 +75,7 @@ jclass
|
|||
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];
|
||||
|
@ -93,7 +93,7 @@ java::lang::Class::forName (jstring className, java::lang::ClassLoader *loader)
|
|||
if (klass)
|
||||
_Jv_InitClass (klass);
|
||||
else
|
||||
JvThrow (new java::lang::ClassNotFoundException (className));
|
||||
throw new java::lang::ClassNotFoundException (className);
|
||||
|
||||
return klass;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ java::lang::Class::getConstructor (JArray<jclass> *param_types)
|
|||
return cons;
|
||||
}
|
||||
}
|
||||
JvThrow (new java::lang::NoSuchMethodException);
|
||||
throw new java::lang::NoSuchMethodException;
|
||||
}
|
||||
|
||||
JArray<java::lang::reflect::Constructor *> *
|
||||
|
@ -194,7 +194,7 @@ java::lang::Class::getDeclaredConstructor (JArray<jclass> *param_types)
|
|||
return cons;
|
||||
}
|
||||
}
|
||||
JvThrow (new java::lang::NoSuchMethodException);
|
||||
throw new java::lang::NoSuchMethodException;
|
||||
}
|
||||
|
||||
java::lang::reflect::Field *
|
||||
|
@ -241,7 +241,7 @@ java::lang::Class::getDeclaredField (jstring name)
|
|||
rfield->name = name;
|
||||
return rfield;
|
||||
}
|
||||
JvThrow (new java::lang::NoSuchFieldException (name));
|
||||
throw new java::lang::NoSuchFieldException (name);
|
||||
}
|
||||
|
||||
JArray<java::lang::reflect::Field *> *
|
||||
|
@ -324,7 +324,7 @@ java::lang::Class::getDeclaredMethod (jstring name,
|
|||
return rmethod;
|
||||
}
|
||||
}
|
||||
JvThrow (new java::lang::NoSuchMethodException);
|
||||
throw new java::lang::NoSuchMethodException;
|
||||
}
|
||||
|
||||
JArray<java::lang::reflect::Method *> *
|
||||
|
@ -500,7 +500,7 @@ java::lang::Class::getMethod (jstring name, JArray<jclass> *param_types)
|
|||
}
|
||||
}
|
||||
}
|
||||
JvThrow (new java::lang::NoSuchMethodException);
|
||||
throw new java::lang::NoSuchMethodException;
|
||||
}
|
||||
|
||||
// This is a very slow implementation, since it re-scans all the
|
||||
|
@ -645,19 +645,19 @@ java::lang::Class::newInstance (void)
|
|||
// 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);
|
||||
|
@ -725,7 +725,7 @@ java::lang::Class::initializeClass (void)
|
|||
if (state == JV_STATE_ERROR)
|
||||
{
|
||||
_Jv_MonitorExit (this);
|
||||
JvThrow (new java::lang::NoClassDefFoundError);
|
||||
throw new java::lang::NoClassDefFoundError;
|
||||
}
|
||||
|
||||
// Step 6.
|
||||
|
@ -776,7 +776,7 @@ java::lang::Class::initializeClass (void)
|
|||
state = JV_STATE_ERROR;
|
||||
notifyAll ();
|
||||
_Jv_MonitorExit (this);
|
||||
JvThrow (except);
|
||||
throw except;
|
||||
}
|
||||
|
||||
_Jv_MonitorEnter (this);
|
||||
|
@ -880,21 +880,20 @@ _Jv_LookupInterfaceMethod (jclass klass, _Jv_Utf8Const *name,
|
|||
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.
|
||||
|
@ -988,11 +987,11 @@ _Jv_CheckCast (jclass c, jobject obj)
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
@ -1007,7 +1006,7 @@ _Jv_CheckArrayStore (jobject arr, jobject 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1214,7 +1213,7 @@ _Jv_GetMethodString (jclass klass, _Jv_Utf8Const *name)
|
|||
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
|
||||
|
@ -1257,14 +1256,14 @@ _Jv_AppendPartialITable (jclass klass, jclass iface, void **itable,
|
|||
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;
|
||||
}
|
||||
|
@ -1414,5 +1413,5 @@ java::lang::Class::getPrivateMethod (jstring name, JArray<jclass> *param_types)
|
|||
}
|
||||
}
|
||||
}
|
||||
JvThrow (new java::lang::NoSuchMethodException);
|
||||
throw new java::lang::NoSuchMethodException;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// 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.
|
||||
|
||||
|
@ -80,8 +80,8 @@ java::lang::ClassLoader::defineClass0 (jstring name,
|
|||
_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;
|
||||
}
|
||||
|
@ -104,7 +104,10 @@ java::lang::ClassLoader::defineClass0 (jstring name,
|
|||
// 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.
|
||||
|
@ -151,9 +154,7 @@ _Jv_WaitForState (jclass klass, int state)
|
|||
_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.
|
||||
|
@ -253,7 +254,7 @@ _Jv_PrepareCompiledClass (jclass klass)
|
|||
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;
|
||||
|
|
|
@ -184,5 +184,5 @@ java::lang::Double::parseDouble(jstring str)
|
|||
if (endptr == data + blength)
|
||||
return val;
|
||||
}
|
||||
_Jv_Throw (new NumberFormatException);
|
||||
throw new NumberFormatException;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// 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.
|
||||
|
||||
|
@ -90,7 +90,7 @@ java::lang::Object::clone (void)
|
|||
else
|
||||
{
|
||||
if (! java::lang::Cloneable::class$.isAssignableFrom(klass))
|
||||
JvThrow (new CloneNotSupportedException);
|
||||
throw new CloneNotSupportedException;
|
||||
|
||||
size = klass->size();
|
||||
r = JvAllocObject (klass, size);
|
||||
|
@ -173,8 +173,8 @@ java::lang::Object::notify (void)
|
|||
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
|
||||
|
@ -184,8 +184,8 @@ java::lang::Object::notifyAll (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
|
||||
|
@ -194,16 +194,16 @@ java::lang::Object::wait (jlong timeout, jint nanos)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ _Jv_MonitorEnter (jobject obj)
|
|||
{
|
||||
#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 ();
|
||||
|
@ -239,7 +239,7 @@ _Jv_MonitorExit (jobject obj)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ java::lang::ConcreteProcess::exitValue (void)
|
|||
if (r == -1)
|
||||
{
|
||||
jstring x = JvNewStringLatin1 (strerror (errno));
|
||||
_Jv_Throw (new IllegalThreadStateException (x));
|
||||
throw new IllegalThreadStateException (x);
|
||||
}
|
||||
|
||||
hasExited = true;
|
||||
|
@ -85,7 +85,7 @@ java::lang::ConcreteProcess::waitFor (void)
|
|||
}
|
||||
|
||||
if (java::lang::Thread::interrupted())
|
||||
_Jv_Throw (new InterruptedException (JvNewStringLatin1 ("wait interrupted")));
|
||||
throw new InterruptedException (JvNewStringLatin1 ("wait interrupted"));
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
|
@ -136,7 +136,7 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
|
|||
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);
|
||||
|
@ -154,14 +154,14 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
|
|||
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 */
|
||||
}
|
||||
|
||||
|
|
|
@ -378,11 +378,11 @@ java::lang::String::init(jcharArray chars, jint offset, jint count,
|
|||
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)
|
||||
|
@ -408,11 +408,11 @@ java::lang::String::init(jbyteArray ascii, jint hibyte, jint offset,
|
|||
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);
|
||||
|
@ -431,11 +431,11 @@ java::lang::String::init (jbyteArray bytes, jint offset, jint count,
|
|||
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);
|
||||
|
@ -493,7 +493,7 @@ jchar
|
|||
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];
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ java::lang::String::getChars(jint srcBegin, jint srcEnd,
|
|||
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;
|
||||
|
@ -554,7 +554,7 @@ java::lang::String::getBytes(jint srcBegin, jint srcEnd,
|
|||
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;
|
||||
|
@ -745,7 +745,7 @@ jstring
|
|||
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;
|
||||
|
@ -944,7 +944,7 @@ java::lang::String::valueOf(jcharArray data, jint offset, jint count)
|
|||
{
|
||||
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);
|
||||
|
|
|
@ -90,7 +90,7 @@ java::lang::System::arraycopy (jobject src, jint src_offset,
|
|||
jint count)
|
||||
{
|
||||
if (! src || ! dst)
|
||||
_Jv_Throw (new NullPointerException);
|
||||
throw new NullPointerException;
|
||||
|
||||
jclass src_c = src->getClass();
|
||||
jclass dst_c = dst->getClass();
|
||||
|
@ -100,14 +100,14 @@ java::lang::System::arraycopy (jobject src, jint src_offset,
|
|||
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)
|
||||
|
@ -149,7 +149,7 @@ java::lang::System::arraycopy (jobject src, jint src_offset,
|
|||
{
|
||||
if (*src_elts
|
||||
&& ! dst_comp->isAssignableFrom((*src_elts)->getClass()))
|
||||
_Jv_Throw (new ArrayStoreException);
|
||||
throw new ArrayStoreException;
|
||||
*dst_elts++ = *src_elts++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ void
|
|||
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 ();
|
||||
|
||||
|
@ -135,7 +135,7 @@ java::lang::Thread::join (jlong millis, jint nanos)
|
|||
_Jv_MutexUnlock (&nt->join_mutex);
|
||||
|
||||
if (current->isInterrupted (true))
|
||||
_Jv_Throw (new InterruptedException);
|
||||
throw new InterruptedException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -150,7 +150,7 @@ java::lang::Thread::setPriority (jint newPriority)
|
|||
{
|
||||
checkAccess ();
|
||||
if (newPriority < MIN_PRIORITY || newPriority > MAX_PRIORITY)
|
||||
_Jv_Throw (new IllegalArgumentException);
|
||||
throw new IllegalArgumentException;
|
||||
|
||||
jint gmax = group->getMaxPriority();
|
||||
if (newPriority > gmax)
|
||||
|
@ -165,7 +165,7 @@ void
|
|||
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;
|
||||
|
@ -180,7 +180,7 @@ java::lang::Thread::sleep (jlong millis, jint nanos)
|
|||
_Jv_MutexUnlock (&nt->join_mutex);
|
||||
|
||||
if (current->isInterrupted (true))
|
||||
_Jv_Throw (new InterruptedException);
|
||||
throw new InterruptedException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -299,7 +299,7 @@ java::lang::Thread::start (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;
|
||||
|
@ -310,16 +310,16 @@ java::lang::Thread::start (void)
|
|||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// 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.
|
||||
|
||||
|
@ -64,7 +64,7 @@ java::lang::reflect::Array::getLength (jobject array)
|
|||
{
|
||||
jclass arrayType = array->getClass();
|
||||
if (! arrayType->isArray ())
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
return ((__JArray*) array)->length;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ java::lang::reflect::Array::getElementType (jobject array, jint index)
|
|||
{
|
||||
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);
|
||||
|
@ -86,7 +86,7 @@ java::lang::reflect::Array::getBoolean (jobject array, jint 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
|
||||
|
@ -95,7 +95,7 @@ java::lang::reflect::Array::getChar (jobject array, jint index)
|
|||
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
|
||||
|
@ -104,7 +104,7 @@ java::lang::reflect::Array::getByte (jobject array, jint index)
|
|||
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
|
||||
|
@ -115,7 +115,7 @@ java::lang::reflect::Array::getShort (jobject array, jint index)
|
|||
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
|
||||
|
@ -130,7 +130,7 @@ java::lang::reflect::Array::getInt (jobject array, jint index)
|
|||
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
|
||||
|
@ -147,7 +147,7 @@ java::lang::reflect::Array::getLong (jobject array, jint index)
|
|||
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
|
||||
|
@ -166,7 +166,7 @@ java::lang::reflect::Array::getFloat (jobject array, jint index)
|
|||
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
|
||||
|
@ -187,7 +187,7 @@ java::lang::reflect::Array::getDouble (jobject array, jint index)
|
|||
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
|
||||
|
@ -218,7 +218,7 @@ java::lang::reflect::Array::get (jobject array, jint index)
|
|||
else
|
||||
return java::lang::Boolean::FALSE;
|
||||
}
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -236,7 +236,7 @@ java::lang::reflect::Array::setChar (jobject array, jint index, jchar value)
|
|||
else if (elementType == JvPrimClass (double))
|
||||
elements ((jdoubleArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -256,7 +256,7 @@ java::lang::reflect::Array::setByte (jobject array, jint index, jbyte value)
|
|||
else if (elementType == JvPrimClass (double))
|
||||
elements ((jdoubleArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -274,7 +274,7 @@ java::lang::reflect::Array::setShort (jobject array, jint index, jshort value)
|
|||
else if (elementType == JvPrimClass (double))
|
||||
elements ((jdoubleArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -290,7 +290,7 @@ java::lang::reflect::Array::setInt (jobject array, jint index, jint value)
|
|||
else if (elementType == JvPrimClass (double))
|
||||
elements ((jdoubleArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -304,7 +304,7 @@ java::lang::reflect::Array::setLong (jobject array, jint index, jlong value)
|
|||
else if (elementType == JvPrimClass (double))
|
||||
elements ((jdoubleArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -316,7 +316,7 @@ java::lang::reflect::Array::setFloat (jobject array, jint index, jfloat value)
|
|||
else if (elementType == JvPrimClass (double))
|
||||
elements ((jdoubleArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -326,7 +326,7 @@ java::lang::reflect::Array::setDouble (jobject array, jint index, jdouble value)
|
|||
if (elementType == JvPrimClass (double))
|
||||
elements ((jdoubleArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -337,7 +337,7 @@ java::lang::reflect::Array::setBoolean (jobject array,
|
|||
if (elementType == JvPrimClass (boolean))
|
||||
elements ((jbooleanArray) array) [index] = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -345,6 +345,6 @@ java::lang::reflect::Array::set (jobject array, jint index,
|
|||
jobject value, jclass elType)
|
||||
{
|
||||
if (! _Jv_IsInstanceOf (value, elType))
|
||||
JvThrow (new java::lang::IllegalArgumentException ());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
elements ((jobjectArray) array) [index] = value;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// 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.
|
||||
|
||||
|
@ -48,7 +48,7 @@ java::lang::reflect::Constructor::newInstance (jobjectArray args)
|
|||
|
||||
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
|
||||
|
|
|
@ -79,9 +79,9 @@ getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj)
|
|||
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 ());
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ getBoolean (jclass cls, void* addr)
|
|||
{
|
||||
if (cls == JvPrimClass (boolean))
|
||||
return * (jboolean *) addr;
|
||||
_Jv_Throw (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static jchar
|
||||
|
@ -99,7 +99,7 @@ getChar (jclass cls, void* addr)
|
|||
{
|
||||
if (cls == JvPrimClass (char))
|
||||
return * (jchar *) addr;
|
||||
_Jv_Throw (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static jbyte
|
||||
|
@ -107,7 +107,7 @@ getByte (jclass cls, void* addr)
|
|||
{
|
||||
if (cls == JvPrimClass (byte))
|
||||
return * (jbyte *) addr;
|
||||
_Jv_Throw (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static jshort
|
||||
|
@ -117,7 +117,7 @@ getShort (jclass cls, void* addr)
|
|||
return * (jshort *) addr;
|
||||
if (cls == JvPrimClass (byte))
|
||||
return * (jbyte *) addr;
|
||||
_Jv_Throw (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static jint
|
||||
|
@ -131,7 +131,7 @@ getInt (jclass cls, void* addr)
|
|||
return * (jchar *) addr;
|
||||
if (cls == JvPrimClass (byte))
|
||||
return * (jbyte *) addr;
|
||||
_Jv_Throw (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static jlong
|
||||
|
@ -249,7 +249,7 @@ java::lang::reflect::Field::get (jclass caller, jobject obj)
|
|||
else
|
||||
return java::lang::Boolean::FALSE;
|
||||
}
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -258,7 +258,7 @@ setBoolean (jclass type, void *addr, jboolean value)
|
|||
if (type == JvPrimClass (boolean))
|
||||
* (jboolean *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -275,7 +275,7 @@ setChar (jclass type, void *addr, jchar value)
|
|||
else if (type == JvPrimClass (double))
|
||||
* (jdouble *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -294,7 +294,7 @@ setByte (jclass type, void *addr, jbyte value)
|
|||
else if (type == JvPrimClass (double))
|
||||
* (jdouble *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -311,7 +311,7 @@ setShort (jclass type, void *addr, jshort value)
|
|||
else if (type == JvPrimClass (double))
|
||||
* (jdouble *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -326,7 +326,7 @@ setInt (jclass type, void *addr, jint value)
|
|||
else if (type == JvPrimClass (double))
|
||||
* (jdouble *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -339,7 +339,7 @@ setLong (jclass type, void *addr, jlong value)
|
|||
else if (type == JvPrimClass (double))
|
||||
* (jdouble *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -350,7 +350,7 @@ setFloat (jclass type, void *addr, jfloat value)
|
|||
else if (type == JvPrimClass (double))
|
||||
* (jdouble *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -359,7 +359,7 @@ setDouble (jclass type, void *addr, jdouble value)
|
|||
if (type == JvPrimClass (double))
|
||||
* (jdouble *) addr = value;
|
||||
else
|
||||
JvThrow (new java::lang::IllegalArgumentException());
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -421,7 +421,7 @@ 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;
|
||||
}
|
||||
|
|
|
@ -160,9 +160,9 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
|
|||
{
|
||||
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
|
||||
|
@ -447,7 +447,7 @@ _Jv_CallAnyMethodA (jobject obj,
|
|||
// 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;
|
||||
|
||||
|
@ -469,7 +469,7 @@ _Jv_CallAnyMethodA (jobject obj,
|
|||
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],
|
||||
|
@ -499,7 +499,7 @@ _Jv_CallAnyMethodA (jobject obj,
|
|||
else
|
||||
{
|
||||
if (argelts[i] && ! paramelts[i]->isAssignableFrom (k))
|
||||
JvThrow (new java::lang::IllegalArgumentException);
|
||||
throw new java::lang::IllegalArgumentException;
|
||||
COPY (&argvals[i], argelts[i], jobject);
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ _Jv_CallAnyMethodA (jobject obj,
|
|||
&ret_value);
|
||||
|
||||
if (ex)
|
||||
JvThrow (ex);
|
||||
throw ex;
|
||||
|
||||
jobject r;
|
||||
#define VAL(Wrapper, Field) (new Wrapper (ret_value.Field))
|
||||
|
|
|
@ -37,9 +37,9 @@ java::util::zip::Deflater::deflate (jbyteArray buf, jint off, jint 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;
|
||||
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
@ -58,7 +58,7 @@ java::util::zip::Deflater::deflate (jbyteArray buf, jint off, jint len)
|
|||
case Z_STREAM_ERROR:
|
||||
case Z_BUF_ERROR:
|
||||
// FIXME?
|
||||
_Jv_Throw (new java::lang::InternalError);
|
||||
throw new java::lang::InternalError;
|
||||
break;
|
||||
|
||||
case Z_OK:
|
||||
|
@ -134,9 +134,9 @@ java::util::zip::Deflater::setDictionary (jbyteArray buf, jint off, jint 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;
|
||||
|
||||
// Ignore errors.
|
||||
deflateSetDictionary (s, (Bytef *) (elements (buf) + off), len);
|
||||
|
@ -149,9 +149,9 @@ java::util::zip::Deflater::setInput (jbyteArray buf, jint off, jint 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;
|
||||
|
@ -205,7 +205,7 @@ java::util::zip::Deflater::init (jint level, jboolean no_header)
|
|||
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);
|
||||
|
|
|
@ -94,9 +94,9 @@ java::util::zip::Inflater::inflate (jbyteArray buf, jint off, jint 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;
|
||||
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
@ -127,12 +127,12 @@ java::util::zip::Inflater::inflate (jbyteArray buf, jint off, jint len)
|
|||
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:
|
||||
|
@ -158,9 +158,9 @@ java::util::zip::Inflater::setDictionary (jbyteArray buf, jint off, jint 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;
|
||||
|
||||
// Ignore errors.
|
||||
inflateSetDictionary (s, (Bytef *) (elements (buf) + off), len);
|
||||
|
@ -174,9 +174,9 @@ java::util::zip::Inflater::setInput (jbyteArray buf, jint off, jint 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;
|
||||
|
@ -202,7 +202,7 @@ java::util::zip::Inflater::init (jboolean no_header)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue