// natClass.cc - Implementation of java.lang.Class native methods.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ 2010 Free Software Foundation
This file is part of libgcj.
#include <java/lang/reflect/Member.h>
#include <java/lang/reflect/Method.h>
#include <java/lang/reflect/Field.h>
+#include <java/lang/reflect/Proxy.h>
#include <java/lang/reflect/Constructor.h>
#include <java/lang/AbstractMethodError.h>
#include <java/lang/ArrayStoreException.h>
void
java::lang::Class::finalize (void)
{
- engine->unregister(this);
+ // Array classes don't have an engine, and don't need to be finalized.
+ if (engine)
+ engine->unregister(this);
}
+#ifdef INTERPRETER
void
_Jv_ClosureList::releaseClosures (_Jv_ClosureList **closures)
{
_Jv_ClosureList::registerClosure (jclass klass, void *ptr)
{
_Jv_ClosureList **closures = klass->engine->get_closure_list (klass);
- this->ptr = ptr;
- this->next = *closures;
- *closures = this;
+ if (closures)
+ {
+ this->ptr = ptr;
+ this->next = *closures;
+ *closures = this;
+ }
}
+#endif
// This implements the initialization process for a class. From Spec
// section 12.4.2.
_Jv_word indexes;
indexes.i = getEnclosingMethodData();
if (indexes.i == 0)
- return NULL;
+ // No enclosing method, but perhaps a member or anonymous class
+ return getDeclaringClass();
_Jv_ushort class_index, method_index;
_Jv_loadIndexes (&indexes, class_index, method_index);
return _Jv_Linker::resolve_pool_entry (this, class_index).clazz;
return klass->state;
}
+#ifdef INTERPRETER
+jstring
+_Jv_GetInterpClassSourceFile (jclass klass)
+{
+ if (_Jv_IsInterpretedClass (klass))
+ {
+ _Jv_InterpClass *iclass =
+ reinterpret_cast<_Jv_InterpClass *> (klass->aux_info);
+ return iclass->source_file_name;
+ }
+
+ return NULL;
+}
+#endif