blob: 9e28bd72e39bd786d2876d45de42f283aca69ad5 [file] [log] [blame]
Ian Rogers87e552d2012-08-31 15:54:48 -07001/*
2 * Copyright (C) 2012 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_SRC_COMMON_THROWS__H_
18#define ART_SRC_COMMON_THROWS_H_
19
Elliott Hughes76b61672012-12-12 17:47:30 -080020#include "base/mutex.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080021#include "invoke_type.h"
Ian Rogers87e552d2012-08-31 15:54:48 -070022
23namespace art {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080024namespace mirror {
25class AbstractMethod;
26class Class;
27class Field;
28class Object;
29} // namespace mirror
30class StringPiece;
Ian Rogers87e552d2012-08-31 15:54:48 -070031
32// NullPointerException
33
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080034void ThrowNullPointerExceptionForFieldAccess(mirror::Field* field, bool is_read)
Ian Rogersb726dcb2012-09-05 08:57:23 -070035 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070036
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080037void ThrowNullPointerExceptionForMethodAccess(mirror::AbstractMethod* caller, uint32_t method_idx,
38 InvokeType type)
Ian Rogersb726dcb2012-09-05 08:57:23 -070039 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070040
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080041void ThrowNullPointerExceptionFromDexPC(mirror::AbstractMethod* throw_method, uint32_t dex_pc)
Ian Rogersb726dcb2012-09-05 08:57:23 -070042 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070043
44// IllegalAccessError
45
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080046void ThrowIllegalAccessErrorClass(mirror::Class* referrer, mirror::Class* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070047 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070048
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080049void ThrowIllegalAccessErrorClassForMethodDispatch(mirror::Class* referrer, mirror::Class* accessed,
50 const mirror::AbstractMethod* caller,
51 const mirror::AbstractMethod* called,
Ian Rogers87e552d2012-08-31 15:54:48 -070052 InvokeType type)
Ian Rogersb726dcb2012-09-05 08:57:23 -070053 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070054
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080055void ThrowIllegalAccessErrorMethod(mirror::Class* referrer, mirror::AbstractMethod* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070056 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070057
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080058void ThrowIllegalAccessErrorField(mirror::Class* referrer, mirror::Field* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070059 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070060
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080061void ThrowIllegalAccessErrorFinalField(const mirror::AbstractMethod* referrer,
62 mirror::Field* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070063 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070064
65// IncompatibleClassChangeError
66
67void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type,
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080068 mirror::AbstractMethod* method,
69 const mirror::AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070070 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070071
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080072void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const mirror::AbstractMethod* interface_method,
73 mirror::Object* this_object,
74 const mirror::AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070075 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070076
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080077void ThrowIncompatibleClassChangeErrorField(const mirror::Field* resolved_field, bool is_static,
78 const mirror::AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070079 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070080
81// NoSuchMethodError
82
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080083void ThrowNoSuchMethodError(InvokeType type, mirror::Class* c, const StringPiece& name,
84 const StringPiece& signature, const mirror::AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070085 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070086
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080087void ThrowNoSuchMethodError(uint32_t method_idx, const mirror::AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070088 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070089
90} // namespace art
91
92#endif // ART_SRC_COMMON_THROWS_H_