Fix JNI NoSuchMethodErrors.
No point calling PrettyMethod if you've just determined that your Method* is
NULL...
Also a few other debugging aids.
Change-Id: I8af520716215800b7ffe4aef784b9c4ec15dcb92
diff --git a/src/stl_util.h b/src/stl_util.h
index 5fcf089..d826510 100644
--- a/src/stl_util.h
+++ b/src/stl_util.h
@@ -3,6 +3,8 @@
#ifndef ART_SRC_STL_UTIL_H_
#define ART_SRC_STL_UTIL_H_
+#include <iostream>
+
namespace art {
// STLDeleteContainerPointers()
@@ -54,6 +56,20 @@
v->clear();
}
+template <class T>
+std::string ToString(const T& v) {
+ std::stringstream os;
+ os << "[";
+ for (size_t i = 0; i < v.size(); ++i) {
+ os << v[i];
+ if (i < v.size() - 1) {
+ os << ", ";
+ }
+ }
+ os << "]";
+ return os.str();
+}
+
} // namespace art
#endif // ART_SRC_STL_UTIL_H_