mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-23 15:50:04 +08:00
213858c013
2000-11-24 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/System.java (setProperties): Only call init_properties() if properties is null. (getProperties): Ditto. (getProperty): Ditto. (setProperty): Call init_properties if properties are null. (prop_init): Remove field. * java/lang/natSystem.cc (init_properties): Synchronize the entire method. Check for null properties after synchronizing instead of prop_init flag. Set the properties field last for thread safety. * java/io/ObjectInputStream.java (ObjectInputStream): If DEBUG is set, test for gcj.dumpobjects property and enable object stream dumping if it is set. (dumpElement): No longer native. (dumpElementln): Ditto. (setDump): Do not define. * java/io/natObjectInputStream.cc (dumpElement): Removed. (dumpElementln): Removed. (setDump): Removed. 2000-11-24 Bryce McKinlay <bryce@albatross.co.nz> * configure: Rebuilt. * Makefile.in: Rebuilt. * Makefile.am (built_java_source_files): Add Configuration.java. * configure.in: Add Configuration.java to CONFIG_FILES. Set LIBGCJDEBUG substitution if --enable-libgcj-debug is specified. Create `gnu' directory in the build tree. * gnu/classpath/Configuration.java.in: New file. From-SVN: r37749
81 lines
2.0 KiB
C++
81 lines
2.0 KiB
C++
// natObjectInputStream.cc - Native part of ObjectInputStream class.
|
|
|
|
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
|
|
|
|
This ObjectInputStream is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the ObjectInputStream "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
#include <config.h>
|
|
|
|
#include <gcj/cni.h>
|
|
#include <jvm.h>
|
|
|
|
#include <java/io/ObjectInputStream$GetField.h>
|
|
#include <java/io/ObjectInputStream.h>
|
|
#include <java/io/IOException.h>
|
|
#include <java/lang/Class.h>
|
|
#include <java/lang/reflect/Modifier.h>
|
|
#include <java/lang/reflect/Method.h>
|
|
|
|
#ifdef DEBUG
|
|
#include <java/lang/System.h>
|
|
#include <java/io/PrintStream.h>
|
|
#endif
|
|
|
|
jobject
|
|
java::io::ObjectInputStream::allocateObject (jclass klass)
|
|
{
|
|
jobject obj = NULL;
|
|
using namespace java::lang::reflect;
|
|
|
|
try
|
|
{
|
|
JvAssert (klass && ! klass->isArray ());
|
|
if (klass->isInterface() || Modifier::isAbstract(klass->getModifiers()))
|
|
obj = NULL;
|
|
else
|
|
{
|
|
// FIXME: will this work for String?
|
|
obj = JvAllocObject (klass);
|
|
}
|
|
}
|
|
catch (jthrowable t)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
|
|
|
|
#define ObjectClass java::lang::Object::class$
|
|
#define ClassClass java::lang::Class::class$
|
|
|
|
void
|
|
java::io::ObjectInputStream::callConstructor (jclass klass, jobject obj)
|
|
{
|
|
jstring init_name = JvNewStringLatin1 ("<init>");
|
|
JArray<jclass> *arg_types
|
|
= (JArray<jclass> *) JvNewObjectArray (0, &ClassClass, NULL);
|
|
JArray<jobject> *args
|
|
= (JArray<jobject> *) JvNewObjectArray (0, &ObjectClass, NULL);
|
|
java::lang::reflect::Method *m = klass->getPrivateMethod (init_name, arg_types);
|
|
m->invoke (obj, args);
|
|
}
|
|
|
|
java::lang::reflect::Field *
|
|
java::io::ObjectInputStream::getField (jclass klass, jstring name)
|
|
{
|
|
return klass->getPrivateField (name);
|
|
}
|
|
|
|
java::lang::reflect::Method *
|
|
java::io::ObjectInputStream::getMethod (jclass klass, jstring name,
|
|
JArray<jclass> *arg_types)
|
|
{
|
|
return klass->getPrivateMethod (name, arg_types);
|
|
}
|