1 /*
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // Class Reflection contains utility methods needed for implementing the
26 // reflection api.
27 //
28 // Used by functions in the JVM interface.
29 //
30 // NOTE that in JDK 1.4 most of reflection is now implemented in Java
31 // using dynamic bytecode generation. The Array class has not yet been
32 // rewritten using bytecodes; if it were, most of the rest of this
33 // class could go away, as well as a few more entry points in jvm.cpp.
34
35 class FieldStream;
36
37 class Reflection: public AllStatic {
38 private:
39 // Access checking
40 static bool reflect_check_access(klassOop field_class, AccessFlags acc, klassOop target_class, bool is_method_invoke, TRAPS);
41
42 // Conversion
43 static klassOop basic_type_mirror_to_arrayklass(oop basic_type_mirror, TRAPS);
44 static oop basic_type_arrayklass_to_mirror(klassOop basic_type_arrayklass, TRAPS);
149
150 // Reflective lookup of fields. Returns java.lang.reflect.Field instances.
151 static oop reflect_field(oop mirror, symbolOop field_name, jint which, TRAPS);
152 static objArrayOop reflect_fields(oop mirror, jint which, TRAPS);
153
154 // Reflective lookup of methods. Returns java.lang.reflect.Method instances.
155 static oop reflect_method(oop mirror, symbolHandle method_name, objArrayHandle types, jint which, TRAPS);
156 static objArrayOop reflect_methods(oop mirror, jint which, TRAPS);
157
158 // Reflective lookup of constructors. Returns java.lang.reflect.Constructor instances.
159 static oop reflect_constructor(oop mirror, objArrayHandle types, jint which, TRAPS);
160 static objArrayOop reflect_constructors(oop mirror, jint which, TRAPS);
161
162 // Method invokation through java.lang.reflect.Method
163 static oop invoke_method(oop method_mirror, Handle receiver, objArrayHandle args, TRAPS);
164 // Method invokation through java.lang.reflect.Constructor
165 static oop invoke_constructor(oop method_mirror, objArrayHandle args, TRAPS);
166 #endif /* SUPPORT_OLD_REFLECTION */
167
168 };
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_RUNTIME_REFLECTION_HPP
26 #define SHARE_VM_RUNTIME_REFLECTION_HPP
27
28 #include "oops/oop.hpp"
29 #include "runtime/fieldDescriptor.hpp"
30 #include "runtime/reflectionCompat.hpp"
31 #include "utilities/accessFlags.hpp"
32 #include "utilities/growableArray.hpp"
33
34 // Class Reflection contains utility methods needed for implementing the
35 // reflection api.
36 //
37 // Used by functions in the JVM interface.
38 //
39 // NOTE that in JDK 1.4 most of reflection is now implemented in Java
40 // using dynamic bytecode generation. The Array class has not yet been
41 // rewritten using bytecodes; if it were, most of the rest of this
42 // class could go away, as well as a few more entry points in jvm.cpp.
43
44 class FieldStream;
45
46 class Reflection: public AllStatic {
47 private:
48 // Access checking
49 static bool reflect_check_access(klassOop field_class, AccessFlags acc, klassOop target_class, bool is_method_invoke, TRAPS);
50
51 // Conversion
52 static klassOop basic_type_mirror_to_arrayklass(oop basic_type_mirror, TRAPS);
53 static oop basic_type_arrayklass_to_mirror(klassOop basic_type_arrayklass, TRAPS);
158
159 // Reflective lookup of fields. Returns java.lang.reflect.Field instances.
160 static oop reflect_field(oop mirror, symbolOop field_name, jint which, TRAPS);
161 static objArrayOop reflect_fields(oop mirror, jint which, TRAPS);
162
163 // Reflective lookup of methods. Returns java.lang.reflect.Method instances.
164 static oop reflect_method(oop mirror, symbolHandle method_name, objArrayHandle types, jint which, TRAPS);
165 static objArrayOop reflect_methods(oop mirror, jint which, TRAPS);
166
167 // Reflective lookup of constructors. Returns java.lang.reflect.Constructor instances.
168 static oop reflect_constructor(oop mirror, objArrayHandle types, jint which, TRAPS);
169 static objArrayOop reflect_constructors(oop mirror, jint which, TRAPS);
170
171 // Method invokation through java.lang.reflect.Method
172 static oop invoke_method(oop method_mirror, Handle receiver, objArrayHandle args, TRAPS);
173 // Method invokation through java.lang.reflect.Constructor
174 static oop invoke_constructor(oop method_mirror, objArrayHandle args, TRAPS);
175 #endif /* SUPPORT_OLD_REFLECTION */
176
177 };
178
179 #endif // SHARE_VM_RUNTIME_REFLECTION_HPP
|