From b07ed7feb8f9fc07ef1fd0a9e181446f0d432559 Mon Sep 17 00:00:00 2001 From: rschuster Date: Wed, 1 Feb 2006 13:40:05 +0000 Subject: 2006-02-01 Robert Schuster * link.cc: (_Jv_Linker::find_field_helper): Added checks. (_Jv_Linker::find_field): Use exception swallowing class resolution and added early return. (_Jv_ThrowNoClassDefFoundErrorTrampoline): New function. (_Jv_Linker::link_symbol_table): Use exception swallowing class resolution, added ffi_closure installation routine, use _Jv_ThrowNoClassDefFoundError for missing static method. (_Jv_Linker::ensure_class_linked): Added string check which does not trigger class resolution. * java/lang/natClassLoader.cc: (_Jv_FindClassNoException): New method. * java/lang/Class.h: (_Jv_FindClassNoException): New method declaration. * include/jvm.h: (_Jv_FindClassNoException): New method declaration. (_Jv_FindClassFromSignatureNoException): New method declaration. * prims.cc: (_Jv_FindClassFromSignatureNoException): New method. * gcj/javaprims.h: (_Jv_equalsUtf8Classname): New method declaration. (_Jv_isPrimitiveOrDerived): Dito. * prims.cc: (_Jv_equalsUtf8Classnames): New method. (_Jv_isPrimitiveOrDerived): New method. * verify.cc: (ref_intersection::equals): Use new classname comparison method. (type::compatible): Use new classname comparison method. Added check whether LHS' type is java.lang.Object . (type::resolve): Added new optional debug message and simplified if-expression. (type::to_array): Added codepath that generates an array type without resolving the element type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110474 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/lang/natClassLoader.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libjava/java/lang/natClassLoader.cc') diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index 797005b54c7..5f4d957f61c 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -266,6 +266,30 @@ _Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *loader) system_class_list = SYSTEM_LOADER_INITIALIZED; } +// An internal variant of _Jv_FindClass which simply swallows a +// NoClassDefFoundError or a ClassNotFoundException. This gives the +// caller a chance to evaluate the situation and behave accordingly. +jclass +_Jv_FindClassNoException (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) +{ + jclass klass; + + try + { + klass = _Jv_FindClass(name, loader); + } + catch ( java::lang::NoClassDefFoundError *ncdfe ) + { + return NULL; + } + catch ( java::lang::ClassNotFoundException *cnfe ) + { + return NULL; + } + + return klass; +} + jclass _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) { -- cgit v1.2.3