Constructor.java (toString): Avoid extra whitespace on constructor with no modifiers.
2003-10-26 Bryce McKinlay <bryce@mckinlay.net.nz> * java/lang/reflect/Constructor.java (toString): Avoid extra whitespace on constructor with no modifiers. * java/lang/reflect/natConstructor.java (newInstance): Look up caller and perform accessibility check only if constructor is non-public and accessible flag is not set. 2003-10-26 Bryce McKinlay <bryce@mckinlay.net.nz> * jni.cc (_Jv_JNI_CallAnyMethodV, _Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodV, _Jv_JNI_CallAnyVoidMethodA): Don't use _Jv_LookupDeclaredMethod(). Call _Jv_CallAnyMethodA with is_virtual_call argument. * include/jvm.h (_Jv_isVirtualMethod): Moved and renamed from natClass.cc. * java/lang/natClass.cc (_Jv_LayoutVTableMethods): Use _Jv_isVirtualMethod. * java/lang/reflect/natMethod.cc (invoke): Don't use _Jv_LookupDeclaredMethod. (_Jv_CallAnyMethodA): New is_virtual_call argument. If specified, look up method in target object's vtable. From-SVN: r72942
This commit is contained in:
parent
077a148bf5
commit
b9b5672b49
7 changed files with 90 additions and 57 deletions
|
@ -45,34 +45,39 @@ java::lang::reflect::Constructor::getType ()
|
|||
jobject
|
||||
java::lang::reflect::Constructor::newInstance (jobjectArray args)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
if (parameter_types == NULL)
|
||||
getType ();
|
||||
|
||||
gnu::gcj::runtime::StackTrace *t
|
||||
= new gnu::gcj::runtime::StackTrace(4);
|
||||
Class *caller = NULL;
|
||||
try
|
||||
jmethodID meth = _Jv_FromReflectedConstructor (this);
|
||||
|
||||
// Check accessibility, if required.
|
||||
if (! (Modifier::isPublic (meth->accflags) || this->isAccessible()))
|
||||
{
|
||||
for (int i = 1; !caller; i++)
|
||||
gnu::gcj::runtime::StackTrace *t
|
||||
= new gnu::gcj::runtime::StackTrace(4);
|
||||
Class *caller = NULL;
|
||||
try
|
||||
{
|
||||
caller = t->classAt (i);
|
||||
for (int i = 1; !caller; i++)
|
||||
{
|
||||
caller = t->classAt (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (::java::lang::ArrayIndexOutOfBoundsException *e)
|
||||
{
|
||||
catch (::java::lang::ArrayIndexOutOfBoundsException *e)
|
||||
{
|
||||
}
|
||||
|
||||
if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags))
|
||||
throw new IllegalAccessException;
|
||||
}
|
||||
|
||||
if (! isAccessible() && ! _Jv_CheckAccess(caller, declaringClass,
|
||||
declaringClass->getModifiers()))
|
||||
throw new java::lang::IllegalAccessException;
|
||||
|
||||
using namespace java::lang::reflect;
|
||||
if (Modifier::isAbstract (declaringClass->getModifiers()))
|
||||
throw new InstantiationException;
|
||||
|
||||
_Jv_InitClass (declaringClass);
|
||||
|
||||
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue