summaryrefslogtreecommitdiff
path: root/src/common_throws.h
blob: e0766b6b9c1b7336f291b9d9f9359c480a6f8e88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ART_SRC_COMMON_THROWS__H_
#define ART_SRC_COMMON_THROWS_H_

#include "mutex.h"
#include "object.h"

namespace art {

// NullPointerException

void ThrowNullPointerExceptionForFieldAccess(Field* field, bool is_read)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowNullPointerExceptionForMethodAccess(AbstractMethod* caller, uint32_t method_idx, InvokeType type)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowNullPointerExceptionFromDexPC(AbstractMethod* throw_method, uint32_t dex_pc)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

// IllegalAccessError

void ThrowIllegalAccessErrorClass(Class* referrer, Class* accessed)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowIllegalAccessErrorClassForMethodDispatch(Class* referrer, Class* accessed,
                                                   const AbstractMethod* caller, const AbstractMethod* called,
                                                   InvokeType type)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowIllegalAccessErrorMethod(Class* referrer, AbstractMethod* accessed)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowIllegalAccessErrorField(Class* referrer, Field* accessed)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowIllegalAccessErrorFinalField(const AbstractMethod* referrer, Field* accessed)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

// IncompatibleClassChangeError

void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type,
                                       AbstractMethod* method, const AbstractMethod* referrer)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const AbstractMethod* interface_method,
                                                                Object* this_object,
                                                                const AbstractMethod* referrer)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowIncompatibleClassChangeErrorField(const Field* resolved_field, bool is_static,
                                            const AbstractMethod* referrer)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

// NoSuchMethodError

void ThrowNoSuchMethodError(InvokeType type, Class* c, const StringPiece& name,
                            const StringPiece& signature, const AbstractMethod* referrer)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

void ThrowNoSuchMethodError(uint32_t method_idx, const AbstractMethod* referrer)
    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);

}  // namespace art

#endif  // ART_SRC_COMMON_THROWS_H_