source: trunk/gcc/libjava/java/lang/reflect/natConstructor.cc@ 3150

Last change on this file since 3150 was 1392, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.6 KB
Line 
1// natConstructor.cc - Native code for Constructor class.
2
3/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11#include <config.h>
12
13#include <gcj/cni.h>
14#include <jvm.h>
15
16#include <java/lang/reflect/Constructor.h>
17#include <java/lang/reflect/Method.h>
18#include <java/lang/reflect/InvocationTargetException.h>
19#include <java/lang/reflect/Modifier.h>
20#include <java/lang/InstantiationException.h>
21#include <gcj/method.h>
22
23jint
24java::lang::reflect::Constructor::getModifiers ()
25{
26 // Ignore all unknown flags.
27 return _Jv_FromReflectedConstructor (this)->accflags & Modifier::ALL_FLAGS;
28}
29
30void
31java::lang::reflect::Constructor::getType ()
32{
33 _Jv_GetTypesFromSignature (_Jv_FromReflectedConstructor (this),
34 declaringClass,
35 &parameter_types,
36 NULL);
37
38 // FIXME: for now we have no way to get exception information.
39 exception_types =
40 (JArray<jclass> *) JvNewObjectArray (0, &java::lang::Class::class$, NULL);
41}
42
43jobject
44java::lang::reflect::Constructor::newInstance (jobjectArray args)
45{
46 if (parameter_types == NULL)
47 getType ();
48
49 using namespace java::lang::reflect;
50 if (Modifier::isAbstract (declaringClass->getModifiers()))
51 throw new InstantiationException;
52
53 _Jv_InitClass (declaringClass);
54
55 jmethodID meth = _Jv_FromReflectedConstructor (this);
56 // In the constructor case the return type is the type of the
57 // constructor.
58 return _Jv_CallAnyMethodA (NULL, declaringClass, meth, true,
59 parameter_types, args);
60}
Note: See TracBrowser for help on using the repository browser.