1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_RUNTIME_REFLECTION_H_
18#define ART_RUNTIME_REFLECTION_H_
19
20#include "jni.h"
21#include "primitive.h"
22
23namespace art {
24namespace mirror {
25  class ArtField;
26  class ArtMethod;
27  class Class;
28  class Object;
29}  // namespace mirror
30union JValue;
31class ScopedObjectAccess;
32class ThrowLocation;
33
34mirror::Object* BoxPrimitive(Primitive::Type src_class, const JValue& value)
35    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
36bool UnboxPrimitiveForArgument(mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value,
37                               mirror::ArtMethod* m, size_t index)
38    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
39bool UnboxPrimitiveForField(mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value,
40                            mirror::ArtField* f)
41    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
42bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object* o,
43                             mirror::Class* dst_class, JValue& unboxed_value)
44    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
45
46bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbox_for_result,
47                           Primitive::Type src_class, Primitive::Type dst_class,
48                           const JValue& src, JValue& dst)
49    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
50
51jobject InvokeMethod(const ScopedObjectAccess& soa, jobject method, jobject receiver, jobject args)
52    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
53
54bool VerifyObjectInClass(mirror::Object* o, mirror::Class* c)
55    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
56
57}  // namespace art
58
59#endif  // ART_RUNTIME_REFLECTION_H_
60