
* java/lang/reflect/natConstructor.cc (newInstance): Use _Jv_CallAnyMethodA. * include/jvm.h: Declare _Jv_CallAnyMethodA. * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Renamed from _Jv_CallNonvirtualMethodA. Changed interface; overloaded. Include <jni.h>. (COPY): Removed. (invoke): Use _Jv_CallAnyMethodA. (VAL): Redefined. * java/lang/Class.h (Class): Declare JvGetFirstStaticField, JvNumStaticFields, JvNumMethods, and JvGetFirstMethod as friend functions. (struct _Jv_Method): Added getNextMethod method. (JvNumMethods): New function. (JvGetFirstMethod): Likewise. * gcj/field.h (JvGetFirstStaticField): New function. (JvNumStaticFields): Likewise. (getNextField): Renamed from getNextInstanceField. (struct _Jv_Field): New method getClass. * jni.cc: Wrote many new functions. * include/jni.h (JNI_TRUE): Define. (JNI_FALSE): Likewise. (jobject, jclass, jstring, jarray, jthrowable, jobjectArray, jbyteArray, jshortArray, jintArray, jlongArray, jbooleanArray, jcharArray, jfloatArray, jdoubleArray): New typedefs. (jfieldID, jmethodID): Likewise. (JNI_COMMIT, JNI_ABORT): New defines. (JNINativeMethod): New struct. (struct JNINativeInterface): Correctly declared more entries. (class _Jv_JNIEnv): Added `ex' member. (JNI_VERSION_1_1): New define. (JNI_VERSION_1_2): Likewise. * boehm.cc (_Jv_MarkObj): Use getNextField, not getNextInstanceField. From-SVN: r31553
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
// natConstructor.cc - Native code for Constructor class.
|
|
|
|
/* Copyright (C) 1999, 2000 Red Hat, Inc.
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
#include <config.h>
|
|
|
|
#include <gcj/cni.h>
|
|
#include <jvm.h>
|
|
|
|
#include <java/lang/reflect/Constructor.h>
|
|
#include <java/lang/reflect/Method.h>
|
|
#include <java/lang/reflect/InvocationTargetException.h>
|
|
#include <java/lang/reflect/Modifier.h>
|
|
#include <java/lang/InstantiationException.h>
|
|
#include <gcj/method.h>
|
|
|
|
jint
|
|
java::lang::reflect::Constructor::getModifiers ()
|
|
{
|
|
return _Jv_FromReflectedConstructor (this)->accflags;
|
|
}
|
|
|
|
void
|
|
java::lang::reflect::Constructor::getType ()
|
|
{
|
|
_Jv_GetTypesFromSignature (_Jv_FromReflectedConstructor (this),
|
|
declaringClass,
|
|
¶meter_types,
|
|
NULL);
|
|
}
|
|
|
|
jobject
|
|
java::lang::reflect::Constructor::newInstance (jobjectArray args)
|
|
{
|
|
if (parameter_types == NULL)
|
|
getType ();
|
|
|
|
using namespace java::lang::reflect;
|
|
if (Modifier::isAbstract (declaringClass->getModifiers()))
|
|
JvThrow (new InstantiationException);
|
|
|
|
jmethodID meth = _Jv_FromReflectedConstructor (this);
|
|
// In the constructor case the return type is the type of the
|
|
// constructor.
|
|
return _Jv_CallAnyMethodA (NULL, declaringClass, meth, true,
|
|
parameter_types, args);
|
|
}
|