blob: 2c18205ec0a9861f55b923671b3c4ce82890ca15 [file] [log] [blame]
Ian Rogers22d5e732014-07-15 22:23:51 -07001/*
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_METHOD_HELPER_INL_H_
18#define ART_RUNTIME_METHOD_HELPER_INL_H_
19
20#include "method_helper.h"
21
Ian Rogerse5877a12014-07-16 12:06:35 -070022#include "class_linker.h"
Ian Rogersa0485602014-12-02 15:48:04 -080023#include "dex_file-inl.h"
Ian Rogers22d5e732014-07-15 22:23:51 -070024
25namespace art {
26
Andreas Gampe5a4b8a22014-09-11 08:30:08 -070027template <template <class T> class HandleKind>
28template <template <class T2> class HandleKind2>
29inline bool MethodHelperT<HandleKind>::HasSameNameAndSignature(MethodHelperT<HandleKind2>* other) {
Ian Rogers1ff3c982014-08-12 02:30:58 -070030 const DexFile* dex_file = method_->GetDexFile();
31 const DexFile::MethodId& mid = dex_file->GetMethodId(GetMethod()->GetDexMethodIndex());
32 if (method_->GetDexCache() == other->method_->GetDexCache()) {
33 const DexFile::MethodId& other_mid =
34 dex_file->GetMethodId(other->GetMethod()->GetDexMethodIndex());
35 return mid.name_idx_ == other_mid.name_idx_ && mid.proto_idx_ == other_mid.proto_idx_;
36 }
37 const DexFile* other_dex_file = other->method_->GetDexFile();
38 const DexFile::MethodId& other_mid =
39 other_dex_file->GetMethodId(other->GetMethod()->GetDexMethodIndex());
40 if (!DexFileStringEquals(dex_file, mid.name_idx_, other_dex_file, other_mid.name_idx_)) {
41 return false; // Name mismatch.
42 }
43 return dex_file->GetMethodSignature(mid) == other_dex_file->GetMethodSignature(other_mid);
44}
45
Ian Rogers22d5e732014-07-15 22:23:51 -070046} // namespace art
47
48#endif // ART_RUNTIME_METHOD_HELPER_INL_H_