Revert "ART: Support for SourceDebugExtension"

This reverts commit 70a45017d6371521c251d67a9aac7d1c86fb6a06.

Pending fix for run-jdwp-tests.sh --mode=device.

Bug: 30109642
Test: art/tools/run-jdwp-tests.sh

Change-Id: I62f84e0fb09b6fe280ca6b518fbd2bc431318a56
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index d0b50fe..63794bf 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -1092,23 +1092,6 @@
   return JDWP::ERR_NONE;
 }
 
-JDWP::JdwpError Dbg::GetSourceDebugExtension(JDWP::RefTypeId class_id,
-                                             std::string* extension_data) {
-  JDWP::JdwpError error;
-  mirror::Class* c = DecodeClass(class_id, &error);
-  if (c == nullptr) {
-    return error;
-  }
-  StackHandleScope<1> hs(Thread::Current());
-  Handle<mirror::Class> klass(hs.NewHandle(c));
-  const char* data = annotations::GetSourceDebugExtension(klass);
-  if (data == nullptr) {
-    return JDWP::ERR_ABSENT_INFORMATION;
-  }
-  *extension_data = data;
-  return JDWP::ERR_NONE;
-}
-
 JDWP::JdwpError Dbg::GetSourceFile(JDWP::RefTypeId class_id, std::string* result) {
   JDWP::JdwpError error;
   mirror::Class* c = DecodeClass(class_id, &error);
diff --git a/runtime/debugger.h b/runtime/debugger.h
index 4f3ff40..27124e1 100644
--- a/runtime/debugger.h
+++ b/runtime/debugger.h
@@ -288,9 +288,6 @@
       REQUIRES_SHARED(Locks::mutator_lock_);
   static JDWP::JdwpError GetSignature(JDWP::RefTypeId ref_type_id, std::string* signature)
       REQUIRES_SHARED(Locks::mutator_lock_);
-  static JDWP::JdwpError GetSourceDebugExtension(JDWP::RefTypeId ref_type_id,
-                                                 std::string* extension_data)
-      REQUIRES_SHARED(Locks::mutator_lock_);
   static JDWP::JdwpError GetSourceFile(JDWP::RefTypeId ref_type_id, std::string* source_file)
       REQUIRES_SHARED(Locks::mutator_lock_);
   static JDWP::JdwpError GetObjectTag(JDWP::ObjectId object_id, uint8_t* tag)
diff --git a/runtime/dex_file_annotations.cc b/runtime/dex_file_annotations.cc
index 7d56bca6..6b9654d 100644
--- a/runtime/dex_file_annotations.cc
+++ b/runtime/dex_file_annotations.cc
@@ -1420,40 +1420,6 @@
   return GetSignatureValue(data, annotation_set);
 }
 
-const char* GetSourceDebugExtension(Handle<mirror::Class> klass) {
-  ClassData data(klass);
-  const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data);
-  if (annotation_set == nullptr) {
-    return nullptr;
-  }
-  const DexFile::AnnotationItem* annotation_item = SearchAnnotationSet(
-      data.GetDexFile(),
-      annotation_set,
-      "Ldalvik/annotation/SourceDebugExtension;",
-      DexFile::kDexVisibilitySystem);
-  if (annotation_item == nullptr) {
-    return nullptr;
-  }
-  const uint8_t* annotation =
-      SearchEncodedAnnotation(data.GetDexFile(), annotation_item->annotation_, "value");
-  if (annotation == nullptr) {
-    return nullptr;
-  }
-  DexFile::AnnotationValue annotation_value;
-  if (!ProcessAnnotationValue<false>(data,
-                                     &annotation,
-                                     &annotation_value,
-                                     ScopedNullHandle<mirror::Class>(),
-                                     DexFile::kAllRaw)) {
-    return nullptr;
-  }
-  if (annotation_value.type_ != DexFile::kDexAnnotationString) {
-    return nullptr;
-  }
-  dex::StringIndex index(static_cast<uint32_t>(annotation_value.value_.GetI()));
-  return data.GetDexFile().StringDataByIdx(index);
-}
-
 bool IsClassAnnotationPresent(Handle<mirror::Class> klass, Handle<mirror::Class> annotation_class) {
   ClassData data(klass);
   const DexFile::AnnotationSetItem* annotation_set = FindAnnotationSetForClass(data);
diff --git a/runtime/dex_file_annotations.h b/runtime/dex_file_annotations.h
index 651c984..c66c5bd 100644
--- a/runtime/dex_file_annotations.h
+++ b/runtime/dex_file_annotations.h
@@ -89,8 +89,6 @@
     REQUIRES_SHARED(Locks::mutator_lock_);
 mirror::ObjectArray<mirror::String>* GetSignatureAnnotationForClass(Handle<mirror::Class> klass)
     REQUIRES_SHARED(Locks::mutator_lock_);
-const char* GetSourceDebugExtension(Handle<mirror::Class> klass)
-    REQUIRES_SHARED(Locks::mutator_lock_);
 bool IsClassAnnotationPresent(Handle<mirror::Class> klass,
                               Handle<mirror::Class> annotation_class)
     REQUIRES_SHARED(Locks::mutator_lock_);
diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc
index e8a9904..971d039 100644
--- a/runtime/jdwp/jdwp_handler.cc
+++ b/runtime/jdwp/jdwp_handler.cc
@@ -335,7 +335,7 @@
   expandBufAdd1(reply, false);   // canUnrestrictedlyRedefineClasses
   expandBufAdd1(reply, false);   // canPopFrames
   expandBufAdd1(reply, true);    // canUseInstanceFilters
-  expandBufAdd1(reply, true);    // canGetSourceDebugExtension
+  expandBufAdd1(reply, false);   // canGetSourceDebugExtension
   expandBufAdd1(reply, false);   // canRequestVMDeathEvent
   expandBufAdd1(reply, false);   // canSetDefaultStratum
   expandBufAdd1(reply, true);    // 1.6: canGetInstanceInfo
@@ -499,18 +499,13 @@
 
 /*
  * Returns the value of the SourceDebugExtension attribute.
+ *
+ * JDB seems interested, but DEX files don't currently support this.
  */
-static JdwpError RT_SourceDebugExtension(JdwpState*, Request* request, ExpandBuf* pReply)
+static JdwpError RT_SourceDebugExtension(JdwpState*, Request*, ExpandBuf*)
     REQUIRES_SHARED(Locks::mutator_lock_) {
   /* referenceTypeId in, string out */
-  RefTypeId refTypeId = request->ReadRefTypeId();
-  std::string extension_data;
-  JdwpError status = Dbg::GetSourceDebugExtension(refTypeId, &extension_data);
-  if (status != ERR_NONE) {
-    return status;
-  }
-  expandBufAddUtf8String(pReply, extension_data);
-  return ERR_NONE;
+  return ERR_ABSENT_INFORMATION;
 }
 
 static JdwpError RT_Signature(JdwpState*, Request* request, ExpandBuf* pReply, bool with_generic)
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index 720b1d2..07c300e 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -108,17 +108,6 @@
   fi
 done
 
-# The JDWP tests include a class with a SourceDebugExtension attribute. Convert this class into
-# a DEX so the JDWP SourceDebugExtension can be tested. There is no corresponding java file as by
-# definition the class file is generated from a different language.
-jsr45_dex=$ANDROID_HOST_OUT/jsr45-test.dex
-(cd $ANDROID_BUILD_TOP/external/apache-harmony/jdwp/src/test/resources &&
- dx --dex --output=$jsr45_dex org/apache/harmony/jpda/tests/jdwp/Events/SourceDebugExtensionMockClass.class )
-if [ $? -ne 0 ]; then
-    echo Failed to convert class file to DEX. >&2
-    exit 1
-fi
-
 # For the host:
 #
 # If, on the other hand, there is a variant set, use it to modify the art_debugee parameter to
@@ -171,7 +160,7 @@
       --vm-arg -Djpda.settings.waitingTime=$jdwp_test_timeout \
       --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \
       --vm-arg -Djpda.settings.debuggeeJavaPath="$art_debugee $image $debuggee_args" \
-      --classpath $test_jack --resource-classpath $jsr45_dex \
+      --classpath $test_jack \
       --toolchain jack --language JN \
       --vm-arg -Xcompiler-option --vm-arg --debuggable \
       --jack-arg -g \