summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/openjdkjvmti/ti_method.cc22
-rw-r--r--test/910-methods/expected.txt2
2 files changed, 23 insertions, 1 deletions
diff --git a/runtime/openjdkjvmti/ti_method.cc b/runtime/openjdkjvmti/ti_method.cc
index 2ddd64a2bc..a6cfcc12bc 100644
--- a/runtime/openjdkjvmti/ti_method.cc
+++ b/runtime/openjdkjvmti/ti_method.cc
@@ -34,7 +34,9 @@
#include "art_jvmti.h"
#include "art_method-inl.h"
#include "base/enums.h"
+#include "dex_file_annotations.h"
#include "jni_internal.h"
+#include "mirror/object_array-inl.h"
#include "modifiers.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-inl.h"
@@ -139,6 +141,26 @@ jvmtiError MethodUtil::GetMethodName(jvmtiEnv* env,
// TODO: Support generic signature.
if (generic_ptr != nullptr) {
*generic_ptr = nullptr;
+ if (!art_method->GetDeclaringClass()->IsProxyClass()) {
+ art::mirror::ObjectArray<art::mirror::String>* str_array =
+ art::annotations::GetSignatureAnnotationForMethod(art_method);
+ if (str_array != nullptr) {
+ std::ostringstream oss;
+ for (int32_t i = 0; i != str_array->GetLength(); ++i) {
+ oss << str_array->Get(i)->ToModifiedUtf8();
+ }
+ std::string output_string = oss.str();
+ unsigned char* tmp;
+ jvmtiError ret = CopyString(env, output_string.c_str(), &tmp);
+ if (ret != ERR(NONE)) {
+ return ret;
+ }
+ *generic_ptr = reinterpret_cast<char*>(tmp);
+ } else if (soa.Self()->IsExceptionPending()) {
+ // TODO: Should we report an error here?
+ soa.Self()->ClearException();
+ }
+ }
}
// Everything is fine, release the buffers.
diff --git a/test/910-methods/expected.txt b/test/910-methods/expected.txt
index c913b3ffe5..e87929f00c 100644
--- a/test/910-methods/expected.txt
+++ b/test/910-methods/expected.txt
@@ -28,7 +28,7 @@ Location end: JVMTI_ERROR_NATIVE_METHOD
Is native: true
Is obsolete: false
Is synthetic: false
-[add, (Ljava/lang/Object;)Z, null]
+[add, (Ljava/lang/Object;)Z, (TE;)Z]
interface java.util.List
1025
Max locals: 0