blob: 5a288d38be62b8b9a30571bc8e64e1a91f1d0799 [file] [log] [blame]
Alex Lightc18eba32019-09-24 14:36:27 -07001/*
2 * Copyright (C) 2019 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#include "reflective_value_visitor.h"
18#include <sstream>
19
20#include "base/locks.h"
21#include "base/mutex-inl.h"
22#include "mirror/class.h"
23#include "mirror/object-inl.h"
24
25namespace art {
26
27void HeapReflectiveSourceInfo::Describe(std::ostream& os) const {
28 Locks::mutator_lock_->AssertExclusiveHeld(Thread::Current());
29 ReflectionSourceInfo::Describe(os);
30 os << " Class=" << src_->GetClass()->PrettyClass();
31}
32
33template<>
34void JniIdReflectiveSourceInfo<jfieldID>::Describe(std::ostream& os) const {
35 ReflectionSourceInfo::Describe(os);
36 os << " jfieldID=" << reinterpret_cast<uintptr_t>(id_);
37}
38
39template<>
40void JniIdReflectiveSourceInfo<jmethodID>::Describe(std::ostream& os) const {
41 ReflectionSourceInfo::Describe(os);
42 os << " jmethodID=" << reinterpret_cast<uintptr_t>(id_);
43}
44
Alex Light55eccdf2019-10-07 13:51:13 +000045void ReflectiveHandleScopeSourceInfo::Describe(std::ostream& os) const {
46 ReflectionSourceInfo::Describe(os);
47 os << " source= (" << source_ << ") ";
48 if (source_ == nullptr) {
49 os << "nullptr";
50 } else {
51 os << *source_;
52 }
53}
Alex Lightc18eba32019-09-24 14:36:27 -070054} // namespace art