1d336a099d
* java/lang/reflect/natField.cc (BooleanClass): Don't define. * java/lang/reflect/natArray.cc (BooleanClass): Don't define. * java/lang/Class.h (Object): Added `class$' field. * java/lang/Object.h (Object): Added `class$' field. * defineclass.cc (ClassClass): Use `class$' form. (ClassObject): Likewise. * resolve.cc (ClassObject): Use `class$' form. (ObjectClass): Likewise. * interpret.cc (ClassError): Removed. * java/net/natPlainDatagramSocketImpl.cc (BooleanClass): Use `class$' form. (IntegerClass): Likewise. * java/net/natPlainSocketImpl.cc (BooleanClass): Use `class$' form. * java/lang/natClassLoader.cc (CloneableClass): Use `class$' form. (ObjectClass, ClassClass, VMClassLoaderClass, ClassLoaderClass, SerializableClass): Likewise. Include Serializable.h, Cloneable.h. * java/lang/natSystem.cc (SystemClass): Removed. (init_properties): Use `class$' form. * java/lang/natObject.cc (CloneableClass): Removed. (clone): Use `class$' form. * java/lang/natClass.cc (CloneableClass): Use `class$' form. (ObjectClass, ErrorClass, ClassClass, MethodClass, FieldClass, ConstructorClass): Likewise. * java/lang/reflect/natMethod.cc (ObjectClass): Use `class$' form. (ClassClass, VoidClass, ByteClass, ShortClass, CharacterClass, IntegerClass, LongClass, FloatClass, DoubleClass): Likewise. * java/io/natObjectInputStream.cc (ObjectClass): Use `class$' form. (ClassClass): Likewise. * include/jvm.h (StringClass): Use `class$' form. * prims.cc (ObjectClass): Removed. (_Jv_RunMain): Use `class$' form. (_Jv_AllocObject): Likewise. * jni.cc (ClassClass): Use `class$' form. (ThrowableClass): Likewise. (ObjectClass): Likewise. (MethodClass): Likewise. (ThreadGroupClass): Likewise. (NativeThreadClass): Likewise. * boehm.cc (ObjectClass): Removed. (ClassClass): Removed. (_Jv_MarkObj): Use `class$' form. * gcj/field.h (JvFieldIsRef): Use `class$' form. Include RawData.h. From-SVN: r36740
77 lines
1.9 KiB
C++
77 lines
1.9 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>
|
|
|
|
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);
|
|
}
|
|
|