Revert "Revert "Add basic checks for redefinition.""

This reverts commit f9d41c1d269f3031c0a89e34fc4a04303e186958.

Reason for revert: Fixed issue of missing target skip.

Test: mma -j40 test-art-host
Change-Id: Ibe632e1f3063373950fb873e1716d0439c561297
diff --git a/runtime/openjdkjvmti/ti_redefine.h b/runtime/openjdkjvmti/ti_redefine.h
index 9d23ce4..d6bccb4 100644
--- a/runtime/openjdkjvmti/ti_redefine.h
+++ b/runtime/openjdkjvmti/ti_redefine.h
@@ -152,14 +152,29 @@
 
   void RecordFailure(jvmtiError result, const std::string& error_msg);
 
-  // TODO Actually write this.
   // This will check that no constraints are violated (more than 1 class in dex file, any changes in
   // number/declaration of methods & fields, changes in access flags, etc.)
-  bool EnsureRedefinitionIsValid() {
-    LOG(WARNING) << "Redefinition is not checked for validity currently";
+  bool CheckRedefinitionIsValid() REQUIRES_SHARED(art::Locks::mutator_lock_);
+
+  // Checks that the class can even be redefined.
+  bool CheckRedefinable() REQUIRES_SHARED(art::Locks::mutator_lock_);
+
+  // Checks that the dex file does not add/remove methods.
+  bool CheckSameMethods() REQUIRES_SHARED(art::Locks::mutator_lock_) {
+    LOG(WARNING) << "methods are not checked for modification currently";
     return true;
   }
 
+  // Checks that the dex file does not modify fields
+  bool CheckSameFields() REQUIRES_SHARED(art::Locks::mutator_lock_) {
+    LOG(WARNING) << "Fields are not checked for modification currently";
+    return true;
+  }
+
+  // Checks that the dex file contains only the single expected class and that the top-level class
+  // data has not been modified in an incompatible manner.
+  bool CheckClass() REQUIRES_SHARED(art::Locks::mutator_lock_);
+
   bool UpdateJavaDexFile(art::ObjPtr<art::mirror::Object> java_dex_file,
                          art::ObjPtr<art::mirror::LongArray> new_cookie,
                          /*out*/art::ObjPtr<art::mirror::LongArray>* original_cookie)