OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [java/] [lang/] [reflect/] [natConstructor.cc] - Blame information for rev 758

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 758 jeremybenn
// natConstructor.cc - Native code for Constructor class.
2
 
3
/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006  Free Software Foundation
4
 
5
   This file is part of libgcj.
6
 
7
This software is copyrighted work licensed under the terms of the
8
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9
details.  */
10
 
11
#include <config.h>
12
 
13
#include <gcj/cni.h>
14
#include <jvm.h>
15
#include <java-stack.h>
16
 
17
#include <java/lang/ArrayIndexOutOfBoundsException.h>
18
#include <java/lang/IllegalAccessException.h>
19
#include <java/lang/reflect/Constructor.h>
20
#include <java/lang/reflect/Method.h>
21
#include <java/lang/reflect/InvocationTargetException.h>
22
#include <java/lang/reflect/Modifier.h>
23
#include <java/lang/InstantiationException.h>
24
#include <gcj/method.h>
25
 
26
typedef JArray< ::java::lang::annotation::Annotation * > * anno_a_t;
27
typedef JArray< JArray< ::java::lang::annotation::Annotation * > *> * anno_aa_t;
28
 
29
jint
30
java::lang::reflect::Constructor::getModifiersInternal ()
31
{
32
  return _Jv_FromReflectedConstructor (this)->accflags;
33
}
34
 
35
jstring
36
java::lang::reflect::Constructor::getSignature()
37
{
38
  return declaringClass->getReflectionSignature (this);
39
}
40
 
41
anno_a_t
42
java::lang::reflect::Constructor::getDeclaredAnnotationsInternal()
43
{
44
  return (anno_a_t) declaringClass->getDeclaredAnnotations(this, false);
45
}
46
 
47
anno_aa_t
48
java::lang::reflect::Constructor::getParameterAnnotationsInternal()
49
{
50
  return (anno_aa_t) declaringClass->getDeclaredAnnotations(this, true);
51
}
52
 
53
void
54
java::lang::reflect::Constructor::getType ()
55
{
56
  _Jv_GetTypesFromSignature (_Jv_FromReflectedConstructor (this),
57
                             declaringClass,
58
                             &parameter_types,
59
                             NULL);
60
 
61
  // FIXME: for now we have no way to get exception information.
62
  exception_types =
63
    (JArray<jclass> *) JvNewObjectArray (0, &java::lang::Class::class$, NULL);
64
}
65
 
66
jobject
67
java::lang::reflect::Constructor::newInstance (jobjectArray args)
68
{
69
  using namespace java::lang::reflect;
70
 
71
  if (parameter_types == NULL)
72
    getType ();
73
 
74
  jmethodID meth = _Jv_FromReflectedConstructor (this);
75
 
76
  // Check accessibility, if required.
77
  if (! (Modifier::isPublic (meth->accflags) || this->isAccessible()))
78
    {
79
      Class *caller = _Jv_StackTrace::GetCallingClass (&Constructor::class$);
80
      if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags))
81
        throw new IllegalAccessException;
82
    }
83
 
84
  if (Modifier::isAbstract (declaringClass->getModifiers()))
85
    throw new InstantiationException;
86
 
87
  _Jv_InitClass (declaringClass);
88
 
89
  // In the constructor case the return type is the type of the
90
  // constructor.
91
  return _Jv_CallAnyMethodA (NULL, declaringClass, meth, true,
92
                             parameter_types, args);
93
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.