From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/java/lang/reflect/natConstructor.cc | 93 +++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 libjava/java/lang/reflect/natConstructor.cc (limited to 'libjava/java/lang/reflect/natConstructor.cc') diff --git a/libjava/java/lang/reflect/natConstructor.cc b/libjava/java/lang/reflect/natConstructor.cc new file mode 100644 index 000000000..953d86dd4 --- /dev/null +++ b/libjava/java/lang/reflect/natConstructor.cc @@ -0,0 +1,93 @@ +// natConstructor.cc - Native code for Constructor class. + +/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006 Free Software Foundation + + 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 + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef JArray< ::java::lang::annotation::Annotation * > * anno_a_t; +typedef JArray< JArray< ::java::lang::annotation::Annotation * > *> * anno_aa_t; + +jint +java::lang::reflect::Constructor::getModifiersInternal () +{ + return _Jv_FromReflectedConstructor (this)->accflags; +} + +jstring +java::lang::reflect::Constructor::getSignature() +{ + return declaringClass->getReflectionSignature (this); +} + +anno_a_t +java::lang::reflect::Constructor::getDeclaredAnnotationsInternal() +{ + return (anno_a_t) declaringClass->getDeclaredAnnotations(this, false); +} + +anno_aa_t +java::lang::reflect::Constructor::getParameterAnnotationsInternal() +{ + return (anno_aa_t) declaringClass->getDeclaredAnnotations(this, true); +} + +void +java::lang::reflect::Constructor::getType () +{ + _Jv_GetTypesFromSignature (_Jv_FromReflectedConstructor (this), + declaringClass, + ¶meter_types, + NULL); + + // FIXME: for now we have no way to get exception information. + exception_types = + (JArray *) JvNewObjectArray (0, &java::lang::Class::class$, NULL); +} + +jobject +java::lang::reflect::Constructor::newInstance (jobjectArray args) +{ + using namespace java::lang::reflect; + + if (parameter_types == NULL) + getType (); + + jmethodID meth = _Jv_FromReflectedConstructor (this); + + // Check accessibility, if required. + if (! (Modifier::isPublic (meth->accflags) || this->isAccessible())) + { + Class *caller = _Jv_StackTrace::GetCallingClass (&Constructor::class$); + if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags)) + throw new IllegalAccessException; + } + + if (Modifier::isAbstract (declaringClass->getModifiers())) + throw new InstantiationException; + + _Jv_InitClass (declaringClass); + + // In the constructor case the return type is the type of the + // constructor. + return _Jv_CallAnyMethodA (NULL, declaringClass, meth, true, + parameter_types, args); +} -- cgit v1.2.3