diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 7ddae88..7253cad 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -2324,6 +2324,78 @@
 }
 
 
+llvm::Value* MethodCompiler::EmitLoadDexCacheAddr(MemberOffset offset) {
+  llvm::Value* method_object_addr = EmitLoadMethodObjectAddr();
+
+  llvm::Value* dex_cache_offset_value =
+    irb_.getPtrEquivInt(offset.Int32Value());
+
+  llvm::Value* dex_cache_field_addr =
+    irb_.CreatePtrDisp(method_object_addr, dex_cache_offset_value,
+                       irb_.getJObjectTy()->getPointerTo());
+
+  return irb_.CreateLoad(dex_cache_field_addr);
+}
+
+
+void MethodCompiler::
+EmitLoadDexCacheCodeAndDirectMethodFieldAddr(llvm::Value*& code_field_addr,
+                                             llvm::Value*& method_field_addr,
+                                             uint32_t method_idx) {
+  llvm::Value* cadms_dex_cache_addr =
+    EmitLoadDexCacheAddr(Method::GetDexCacheCodeAndDirectMethodsOffset());
+
+  llvm::Value* code_index_value =
+    irb_.getPtrEquivInt(CodeAndDirectMethods::CodeIndex(method_idx));
+
+  llvm::Value* method_index_value =
+    irb_.getPtrEquivInt(CodeAndDirectMethods::MethodIndex(method_idx));
+
+  // Return the field address
+  code_field_addr = EmitArrayGEP(cadms_dex_cache_addr, code_index_value,
+                                 irb_.getJIntTy());
+
+  method_field_addr = EmitArrayGEP(cadms_dex_cache_addr, method_index_value,
+                                   irb_.getJIntTy());
+}
+
+
+llvm::Value* MethodCompiler::
+EmitLoadDexCacheStaticStorageFieldAddr(uint32_t type_idx) {
+  llvm::Value* static_storage_dex_cache_addr =
+    EmitLoadDexCacheAddr(Method::DexCacheInitializedStaticStorageOffset());
+
+  llvm::Value* type_idx_value = irb_.getPtrEquivInt(type_idx);
+
+  return EmitArrayGEP(static_storage_dex_cache_addr, type_idx_value,
+                      irb_.getJObjectTy());
+}
+
+
+llvm::Value* MethodCompiler::
+EmitLoadDexCacheResolvedTypeFieldAddr(uint32_t type_idx) {
+  llvm::Value* resolved_type_dex_cache_addr =
+    EmitLoadDexCacheAddr(Method::DexCacheResolvedTypesOffset());
+
+  llvm::Value* type_idx_value = irb_.getPtrEquivInt(type_idx);
+
+  return EmitArrayGEP(resolved_type_dex_cache_addr, type_idx_value,
+                      irb_.getJObjectTy());
+}
+
+
+llvm::Value* MethodCompiler::
+EmitLoadDexCacheStringFieldAddr(uint32_t string_idx) {
+  llvm::Value* string_dex_cache_addr =
+    EmitLoadDexCacheAddr(Method::DexCacheStringsOffset());
+
+  llvm::Value* string_idx_value = irb_.getPtrEquivInt(string_idx);
+
+  return EmitArrayGEP(string_dex_cache_addr, string_idx_value,
+                      irb_.getJObjectTy());
+}
+
+
 CompiledMethod *MethodCompiler::Compile() {
   // Code generation
   CreateFunction();
diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h
index f86d740..6a6768b 100644
--- a/src/compiler_llvm/method_compiler.h
+++ b/src/compiler_llvm/method_compiler.h
@@ -264,6 +264,21 @@
 #undef GEN_INSN_ARGS
 
 
+  // Dex cache code generation helper function
+  llvm::Value* EmitLoadDexCacheAddr(MemberOffset dex_cache_offset);
+
+  void EmitLoadDexCacheCodeAndDirectMethodFieldAddr(
+                                          llvm::Value*& code_addr_field_addr,
+                                          llvm::Value*& method_field_addr,
+                                          uint32_t method_idx);
+
+  llvm::Value* EmitLoadDexCacheStaticStorageFieldAddr(uint32_t type_idx);
+
+  llvm::Value* EmitLoadDexCacheResolvedTypeFieldAddr(uint32_t type_idx);
+
+  llvm::Value* EmitLoadDexCacheStringFieldAddr(uint32_t string_idx);
+
+
   // Code generation helper function
 
   llvm::Value* EmitLoadMethodObjectAddr();
diff --git a/src/debugger.cc b/src/debugger.cc
index 8c28cd9..bbdff71 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -43,6 +43,9 @@
 static const size_t kMaxAllocRecordStackDepth = 16; // Max 255.
 static const size_t kNumAllocRecords = 512; // Must be power of 2.
 
+static const uintptr_t kInvalidId = 1;
+static const Object* kInvalidObject = reinterpret_cast<Object*>(kInvalidId);
+
 class ObjectRegistry {
  public:
   ObjectRegistry() : lock_("ObjectRegistry lock") {
@@ -70,10 +73,14 @@
   }
 
   template<typename T> T Get(JDWP::ObjectId id) {
+    if (id == 0) {
+      return NULL;
+    }
+
     MutexLock mu(lock_);
     typedef std::map<JDWP::ObjectId, Object*>::iterator It; // C++0x auto
     It it = map_.find(id);
-    return (it != map_.end()) ? reinterpret_cast<T>(it->second) : NULL;
+    return (it != map_.end()) ? reinterpret_cast<T>(it->second) : reinterpret_cast<T>(kInvalidId);
   }
 
   void VisitRoots(Heap::RootVisitor* visitor, void* arg) {
@@ -187,6 +194,42 @@
   return false;
 }
 
+static Array* DecodeArray(JDWP::RefTypeId id, JDWP::JdwpError& status) {
+  Object* o = gRegistry->Get<Object*>(id);
+  if (o == NULL || o == kInvalidObject) {
+    status = JDWP::ERR_INVALID_OBJECT;
+    return NULL;
+  }
+  if (!o->IsArrayInstance()) {
+    status = JDWP::ERR_INVALID_ARRAY;
+    return NULL;
+  }
+  status = JDWP::ERR_NONE;
+  return o->AsArray();
+}
+
+static Class* DecodeClass(JDWP::RefTypeId id, JDWP::JdwpError& status) {
+  Object* o = gRegistry->Get<Object*>(id);
+  if (o == NULL || o == kInvalidObject) {
+    status = JDWP::ERR_INVALID_OBJECT;
+    return NULL;
+  }
+  if (!o->IsClass()) {
+    status = JDWP::ERR_INVALID_CLASS;
+    return NULL;
+  }
+  status = JDWP::ERR_NONE;
+  return o->AsClass();
+}
+
+static Thread* DecodeThread(JDWP::ObjectId threadId) {
+  Object* thread_peer = gRegistry->Get<Object*>(threadId);
+  if (thread_peer == NULL || thread_peer == kInvalidObject) {
+    return NULL;
+  }
+  return Thread::FromManagedThread(thread_peer);
+}
+
 static JDWP::JdwpTag BasicTagFromDescriptor(const char* descriptor) {
   // JDWP deliberately uses the descriptor characters' ASCII values for its enum.
   // Note that by "basic" we mean that we don't get more specific than JT_OBJECT.
@@ -502,56 +545,26 @@
 
 std::string Dbg::GetClassName(JDWP::RefTypeId classId) {
   Object* o = gRegistry->Get<Object*>(classId);
-  if (o == NULL || !o->IsClass()) {
+  if (o == NULL) {
+    return "NULL";
+  }
+  if (o == kInvalidObject) {
+    return StringPrintf("invalid object %p", reinterpret_cast<void*>(classId));
+  }
+  if (!o->IsClass()) {
     return StringPrintf("non-class %p", o); // This is only used for debugging output anyway.
   }
   return DescriptorToName(ClassHelper(o->AsClass()).GetDescriptor());
 }
 
-bool Dbg::GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId& classObjectId) {
-  Object* o = gRegistry->Get<Object*>(id);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId& classObjectId) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(id, status);
+  if (c == NULL) {
+    return status;
   }
-  classObjectId = gRegistry->Add(o);
-  return true;
-}
-
-static Array* DecodeArray(JDWP::RefTypeId id, JDWP::JdwpError& status) {
-  Object* o = gRegistry->Get<Object*>(id);
-  if (o == NULL) {
-    status = JDWP::ERR_INVALID_OBJECT;
-    return NULL;
-  }
-  if (!o->IsArrayInstance()) {
-    status = JDWP::ERR_INVALID_ARRAY;
-    return NULL;
-  }
-  status = JDWP::ERR_NONE;
-  return o->AsArray();
-}
-
-// TODO: this should probably be used everywhere we're converting a RefTypeId to a Class*.
-static Class* DecodeClass(JDWP::RefTypeId id, JDWP::JdwpError& status) {
-  Object* o = gRegistry->Get<Object*>(id);
-  if (o == NULL) {
-    status = JDWP::ERR_INVALID_OBJECT;
-    return NULL;
-  }
-  if (!o->IsClass()) {
-    status = JDWP::ERR_INVALID_CLASS;
-    return NULL;
-  }
-  status = JDWP::ERR_NONE;
-  return o->AsClass();
-}
-
-static Thread* DecodeThread(JDWP::ObjectId threadId) {
-  Object* thread_peer = gRegistry->Get<Object*>(threadId);
-  if (thread_peer == NULL) {
-    return NULL;
-  }
-  return Thread::FromManagedThread(thread_peer);
+  classObjectId = gRegistry->Add(c);
+  return JDWP::ERR_NONE;
 }
 
 JDWP::JdwpError Dbg::GetSuperclass(JDWP::RefTypeId id, JDWP::RefTypeId& superclassId) {
@@ -569,27 +582,43 @@
   return JDWP::ERR_NONE;
 }
 
-JDWP::ObjectId Dbg::GetClassLoader(JDWP::RefTypeId id) {
+JDWP::JdwpError Dbg::GetClassLoader(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply) {
   Object* o = gRegistry->Get<Object*>(id);
-  return gRegistry->Add(o->GetClass()->GetClassLoader());
+  if (o == NULL || o == kInvalidObject) {
+    return JDWP::ERR_INVALID_OBJECT;
+  }
+  expandBufAddObjectId(pReply, gRegistry->Add(o->GetClass()->GetClassLoader()));
+  return JDWP::ERR_NONE;
 }
 
-bool Dbg::GetAccessFlags(JDWP::RefTypeId id, uint32_t& access_flags) {
-  Object* o = gRegistry->Get<Object*>(id);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::GetModifiers(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(id, status);
+  if (c == NULL) {
+    return status;
   }
-  access_flags = o->AsClass()->GetAccessFlags() & kAccJavaFlagsMask;
-  return true;
+
+  uint32_t access_flags = c->GetAccessFlags() & kAccJavaFlagsMask;
+
+  // Set ACC_SUPER; dex files don't contain this flag, but all classes are supposed to have it set.
+  // Class.getModifiers doesn't return it, but JDWP does, so we set it here.
+  access_flags |= kAccSuper;
+
+  expandBufAdd4BE(pReply, access_flags);
+
+  return JDWP::ERR_NONE;
 }
 
-bool Dbg::IsInterface(JDWP::RefTypeId classId, bool& is_interface) {
-  Object* o = gRegistry->Get<Object*>(classId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::GetReflectedType(JDWP::RefTypeId classId, JDWP::ExpandBuf* pReply) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(classId, status);
+  if (c == NULL) {
+    return status;
   }
-  is_interface = o->AsClass()->IsInterface();
-  return true;
+
+  expandBufAdd1(pReply, c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS);
+  expandBufAddRefTypeId(pReply, classId);
+  return JDWP::ERR_NONE;
 }
 
 void Dbg::GetClassList(std::vector<JDWP::RefTypeId>& classes) {
@@ -618,13 +647,13 @@
   Runtime::Current()->GetClassLinker()->VisitClasses(ClassListCreator::Visit, &clc);
 }
 
-bool Dbg::GetClassInfo(JDWP::RefTypeId classId, JDWP::JdwpTypeTag* pTypeTag, uint32_t* pStatus, std::string* pDescriptor) {
-  Object* o = gRegistry->Get<Object*>(classId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::GetClassInfo(JDWP::RefTypeId classId, JDWP::JdwpTypeTag* pTypeTag, uint32_t* pStatus, std::string* pDescriptor) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(classId, status);
+  if (c == NULL) {
+    return status;
   }
 
-  Class* c = o->AsClass();
   if (c->IsArrayClass()) {
     *pStatus = JDWP::CS_VERIFIED | JDWP::CS_PREPARED;
     *pTypeTag = JDWP::TT_ARRAY;
@@ -640,7 +669,7 @@
   if (pDescriptor != NULL) {
     *pDescriptor = ClassHelper(c).GetDescriptor();
   }
-  return true;
+  return JDWP::ERR_NONE;
 }
 
 void Dbg::FindLoadedClassBySignature(const char* descriptor, std::vector<JDWP::RefTypeId>& ids) {
@@ -654,7 +683,7 @@
 
 JDWP::JdwpError Dbg::GetReferenceType(JDWP::ObjectId objectId, JDWP::ExpandBuf* pReply) {
   Object* o = gRegistry->Get<Object*>(objectId);
-  if (o == NULL) {
+  if (o == NULL || o == kInvalidObject) {
     return JDWP::ERR_INVALID_OBJECT;
   }
 
@@ -674,9 +703,9 @@
   return JDWP::ERR_NONE;
 }
 
-JDWP::JdwpError Dbg::GetSignature(JDWP::RefTypeId refTypeId, std::string& signature) {
+JDWP::JdwpError Dbg::GetSignature(JDWP::RefTypeId classId, std::string& signature) {
   JDWP::JdwpError status;
-  Class* c = DecodeClass(refTypeId, status);
+  Class* c = DecodeClass(classId, status);
   if (c == NULL) {
     return status;
   }
@@ -684,13 +713,14 @@
   return JDWP::ERR_NONE;
 }
 
-bool Dbg::GetSourceFile(JDWP::RefTypeId refTypeId, std::string& result) {
-  Object* o = gRegistry->Get<Object*>(refTypeId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::GetSourceFile(JDWP::RefTypeId classId, std::string& result) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(classId, status);
+  if (c == NULL) {
+    return status;
   }
-  result = ClassHelper(o->AsClass()).GetSourceFile();
-  return result != NULL;
+  result = ClassHelper(c).GetSourceFile();
+  return JDWP::ERR_NONE;
 }
 
 uint8_t Dbg::GetObjectTag(JDWP::ObjectId objectId) {
@@ -822,7 +852,11 @@
     ObjectArray<Object>* oa = a->AsObjectArray<Object>();
     for (int i = 0; i < count; ++i) {
       JDWP::ObjectId id = JDWP::ReadObjectId(&src);
-      oa->Set(offset + i, gRegistry->Get<Object*>(id));
+      Object* o = gRegistry->Get<Object*>(id);
+      if (o == kInvalidObject) {
+        return JDWP::ERR_INVALID_OBJECT;
+      }
+      oa->Set(offset + i, o);
     }
   }
 
@@ -833,30 +867,38 @@
   return gRegistry->Add(String::AllocFromModifiedUtf8(str.c_str()));
 }
 
-bool Dbg::CreateObject(JDWP::RefTypeId classId, JDWP::ObjectId& new_object) {
-  Object* o = gRegistry->Get<Object*>(classId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::CreateObject(JDWP::RefTypeId classId, JDWP::ObjectId& new_object) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(classId, status);
+  if (c == NULL) {
+    return status;
   }
-  new_object = gRegistry->Add(o->AsClass()->AllocObject());
-  return true;
+  new_object = gRegistry->Add(c->AllocObject());
+  return JDWP::ERR_NONE;
 }
 
 /*
  * Used by Eclipse's "Display" view to evaluate "new byte[5]" to get "(byte[]) [0, 0, 0, 0, 0]".
  */
-bool Dbg::CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length, JDWP::ObjectId& new_array) {
-  Object* o = gRegistry->Get<Object*>(arrayTypeId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::CreateArrayObject(JDWP::RefTypeId arrayClassId, uint32_t length, JDWP::ObjectId& new_array) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(arrayClassId, status);
+  if (c == NULL) {
+    return status;
   }
-  new_array = gRegistry->Add(Array::Alloc(o->AsClass(), length));
-  return true;
+  new_array = gRegistry->Add(Array::Alloc(c, length));
+  return JDWP::ERR_NONE;
 }
 
 bool Dbg::MatchType(JDWP::RefTypeId instClassId, JDWP::RefTypeId classId) {
-  // TODO: error handling if the RefTypeIds aren't actually Class*s.
-  return gRegistry->Get<Class*>(instClassId)->InstanceOf(gRegistry->Get<Class*>(classId));
+  JDWP::JdwpError status;
+  Class* c1 = DecodeClass(instClassId, status);
+  Class* c2 = DecodeClass(classId, status);
+  if (c1 == NULL || c2 == NULL) {
+    // TODO: it doesn't seem like we can do any better here?
+    return false;
+  }
+  return c1->InstanceOf(c2);
 }
 
 static JDWP::FieldId ToFieldId(const Field* f) {
@@ -903,7 +945,7 @@
   }
 }
 
-std::string Dbg::GetMethodName(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId) {
+std::string Dbg::GetMethodName(JDWP::RefTypeId, JDWP::MethodId methodId) {
   Method* m = FromMethodId(methodId);
   return MethodHelper(m).GetName();
 }
@@ -957,13 +999,13 @@
   return slot;
 }
 
-bool Dbg::OutputDeclaredFields(JDWP::RefTypeId refTypeId, bool with_generic, JDWP::ExpandBuf* pReply) {
-  Object* o = gRegistry->Get<Object*>(refTypeId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::OutputDeclaredFields(JDWP::RefTypeId classId, bool with_generic, JDWP::ExpandBuf* pReply) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(classId, status);
+  if (c == NULL) {
+    return status;
   }
 
-  Class* c = o->AsClass();
   size_t instance_field_count = c->NumInstanceFields();
   size_t static_field_count = c->NumStaticFields();
 
@@ -981,16 +1023,16 @@
     }
     expandBufAdd4BE(pReply, MangleAccessFlags(f->GetAccessFlags()));
   }
-  return true;
+  return JDWP::ERR_NONE;
 }
 
-bool Dbg::OutputDeclaredMethods(JDWP::RefTypeId refTypeId, bool with_generic, JDWP::ExpandBuf* pReply) {
-  Object* o = gRegistry->Get<Object*>(refTypeId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::OutputDeclaredMethods(JDWP::RefTypeId classId, bool with_generic, JDWP::ExpandBuf* pReply) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(classId, status);
+  if (c == NULL) {
+    return status;
   }
 
-  Class* c = o->AsClass();
   size_t direct_method_count = c->NumDirectMethods();
   size_t virtual_method_count = c->NumVirtualMethods();
 
@@ -1008,24 +1050,26 @@
     }
     expandBufAdd4BE(pReply, MangleAccessFlags(m->GetAccessFlags()));
   }
-  return true;
+  return JDWP::ERR_NONE;
 }
 
-bool Dbg::OutputDeclaredInterfaces(JDWP::RefTypeId refTypeId, JDWP::ExpandBuf* pReply) {
-  Object* o = gRegistry->Get<Object*>(refTypeId);
-  if (o == NULL || !o->IsClass()) {
-    return false;
+JDWP::JdwpError Dbg::OutputDeclaredInterfaces(JDWP::RefTypeId classId, JDWP::ExpandBuf* pReply) {
+  JDWP::JdwpError status;
+  Class* c = DecodeClass(classId, status);
+  if (c == NULL) {
+    return status;
   }
-  ClassHelper kh(o->AsClass());
+
+  ClassHelper kh(c);
   size_t interface_count = kh.NumInterfaces();
   expandBufAdd4BE(pReply, interface_count);
   for (size_t i = 0; i < interface_count; ++i) {
     expandBufAddRefTypeId(pReply, gRegistry->Add(kh.GetInterface(i)));
   }
-  return true;
+  return JDWP::ERR_NONE;
 }
 
-void Dbg::OutputLineTable(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId, JDWP::ExpandBuf* pReply) {
+void Dbg::OutputLineTable(JDWP::RefTypeId, JDWP::MethodId methodId, JDWP::ExpandBuf* pReply) {
   struct DebugCallbackContext {
     int numItems;
     JDWP::ExpandBuf* pReply;
@@ -1068,7 +1112,7 @@
   JDWP::Set4BE(expandBufGetBuffer(pReply) + numLinesOffset, context.numItems);
 }
 
-void Dbg::OutputVariableTable(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId, bool with_generic, JDWP::ExpandBuf* pReply) {
+void Dbg::OutputVariableTable(JDWP::RefTypeId, JDWP::MethodId methodId, bool with_generic, JDWP::ExpandBuf* pReply) {
   struct DebugCallbackContext {
     JDWP::ExpandBuf* pReply;
     size_t variable_count;
@@ -1201,12 +1245,12 @@
 
 JDWP::JdwpError Dbg::GetThreadGroup(JDWP::ObjectId threadId, JDWP::ExpandBuf* pReply) {
   Object* thread = gRegistry->Get<Object*>(threadId);
-  if (thread != NULL) {
+  if (thread == kInvalidObject) {
     return JDWP::ERR_INVALID_OBJECT;
   }
 
   // Okay, so it's an object, but is it actually a thread?
-  if (DecodeThread(threadId)) {
+  if (DecodeThread(threadId) == NULL) {
     return JDWP::ERR_INVALID_THREAD;
   }
 
diff --git a/src/debugger.h b/src/debugger.h
index d8b9800..2397b52 100644
--- a/src/debugger.h
+++ b/src/debugger.h
@@ -132,17 +132,17 @@
    * Class, Object, Array
    */
   static std::string GetClassName(JDWP::RefTypeId id);
-  static bool GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId& classObjectId);
+  static JDWP::JdwpError GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId& classObjectId);
   static JDWP::JdwpError GetSuperclass(JDWP::RefTypeId id, JDWP::RefTypeId& superclassId);
-  static JDWP::ObjectId GetClassLoader(JDWP::RefTypeId id);
-  static bool GetAccessFlags(JDWP::RefTypeId id, uint32_t& access_flags);
-  static bool IsInterface(JDWP::RefTypeId classId, bool& is_interface);
+  static JDWP::JdwpError GetClassLoader(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply);
+  static JDWP::JdwpError GetModifiers(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply);
+  static JDWP::JdwpError GetReflectedType(JDWP::RefTypeId classId, JDWP::ExpandBuf* pReply);
   static void GetClassList(std::vector<JDWP::RefTypeId>& classes);
-  static bool GetClassInfo(JDWP::RefTypeId classId, JDWP::JdwpTypeTag* pTypeTag, uint32_t* pStatus, std::string* pDescriptor);
+  static JDWP::JdwpError GetClassInfo(JDWP::RefTypeId classId, JDWP::JdwpTypeTag* pTypeTag, uint32_t* pStatus, std::string* pDescriptor);
   static void FindLoadedClassBySignature(const char* descriptor, std::vector<JDWP::RefTypeId>& ids);
   static JDWP::JdwpError GetReferenceType(JDWP::ObjectId objectId, JDWP::ExpandBuf* pReply);
   static JDWP::JdwpError GetSignature(JDWP::RefTypeId refTypeId, std::string& signature);
-  static bool GetSourceFile(JDWP::RefTypeId refTypeId, std::string& source_file);
+  static JDWP::JdwpError GetSourceFile(JDWP::RefTypeId refTypeId, std::string& source_file);
   static uint8_t GetObjectTag(JDWP::ObjectId objectId);
   static size_t GetTagWidth(JDWP::JdwpTag tag);
 
@@ -151,8 +151,8 @@
   static JDWP::JdwpError SetArrayElements(JDWP::ObjectId arrayId, int firstIndex, int count, const uint8_t* buf);
 
   static JDWP::ObjectId CreateString(const std::string& str);
-  static bool CreateObject(JDWP::RefTypeId classId, JDWP::ObjectId& new_object);
-  static bool CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length, JDWP::ObjectId& new_array);
+  static JDWP::JdwpError CreateObject(JDWP::RefTypeId classId, JDWP::ObjectId& new_object);
+  static JDWP::JdwpError CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length, JDWP::ObjectId& new_array);
 
   static bool MatchType(JDWP::RefTypeId instClassId, JDWP::RefTypeId classId);
 
@@ -160,9 +160,9 @@
    * Method and Field
    */
   static std::string GetMethodName(JDWP::RefTypeId refTypeId, JDWP::MethodId id);
-  static bool OutputDeclaredFields(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply);
-  static bool OutputDeclaredMethods(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply);
-  static bool OutputDeclaredInterfaces(JDWP::RefTypeId refTypeId, JDWP::ExpandBuf* pReply);
+  static JDWP::JdwpError OutputDeclaredFields(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply);
+  static JDWP::JdwpError OutputDeclaredMethods(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply);
+  static JDWP::JdwpError OutputDeclaredInterfaces(JDWP::RefTypeId refTypeId, JDWP::ExpandBuf* pReply);
   static void OutputLineTable(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId, JDWP::ExpandBuf* pReply);
   static void OutputVariableTable(JDWP::RefTypeId refTypeId, JDWP::MethodId id, bool withGeneric, JDWP::ExpandBuf* pReply);
 
diff --git a/src/dex_cache.h b/src/dex_cache.h
index d87d8de..f748e57 100644
--- a/src/dex_cache.h
+++ b/src/dex_cache.h
@@ -69,13 +69,6 @@
     return GetLength() / kMax;
   }
 
- private:
-  enum TupleIndex {
-    kCode   = 0,
-    kMethod = 1,
-    kMax    = 2,
-  };
-
   static size_t CodeIndex(uint32_t method_idx) {
     return method_idx * kMax + kCode;
   }
@@ -83,6 +76,13 @@
     return method_idx * kMax + kMethod;
   }
 
+ private:
+  enum TupleIndex {
+    kCode   = 0,
+    kMethod = 1,
+    kMax    = 2,
+  };
+
   // grant friend status to ImageWriter fixup code that needs to know internal layout
   friend class ImageWriter;
 
diff --git a/src/jdwp/jdwp_event.cc b/src/jdwp/jdwp_event.cc
index 285caf3..ddcc217 100644
--- a/src/jdwp/jdwp_event.cc
+++ b/src/jdwp/jdwp_event.cc
@@ -839,7 +839,7 @@
 
     if (match_count != 0) {
       VLOG(jdwp) << "EVENT: " << matchList[0]->eventKind << "(" << match_count << " total) "
-                   << "thread=" << (void*) basket.threadId << ")";
+                 << "thread=" << (void*) basket.threadId << ")";
 
       suspendPolicy = scanSuspendPolicy(matchList, match_count);
       VLOG(jdwp) << "  suspendPolicy=" << suspendPolicy;
@@ -932,10 +932,10 @@
     FindMatchingEvents(EK_EXCEPTION, &basket, matchList, &match_count);
     if (match_count != 0) {
       VLOG(jdwp) << "EVENT: " << matchList[0]->eventKind << "(" << match_count << " total)"
-                   << " thread=" << (void*) basket.threadId
-                   << " exceptId=" << (void*) exceptionId
-                   << " caught=" << basket.caught << ")";
-      VLOG(jdwp) << "  throw: " << *pThrowLoc;
+                 << " thread=" << (void*) basket.threadId
+                 << " exceptId=" << (void*) exceptionId
+                 << " caught=" << basket.caught << ")"
+                 << "  throw: " << *pThrowLoc;
       if (pCatchLoc->classId == 0) {
         VLOG(jdwp) << "  catch: (not caught)";
       } else {
@@ -1012,7 +1012,7 @@
     FindMatchingEvents(EK_CLASS_PREPARE, &basket, matchList, &match_count);
     if (match_count != 0) {
       VLOG(jdwp) << "EVENT: " << matchList[0]->eventKind << "(" << match_count << " total) "
-                   << "thread=" << (void*) basket.threadId << ") " << signature;
+                 << "thread=" << (void*) basket.threadId << ") " << signature;
 
       suspendPolicy = scanSuspendPolicy(matchList, match_count);
       VLOG(jdwp) << "  suspendPolicy=" << suspendPolicy;
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index 3f79601..9b5761a 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -204,15 +204,16 @@
 
   for (size_t i = 0; i < ids.size(); ++i) {
     // Get class vs. interface and status flags.
-    JDWP::JdwpTypeTag typeTag;
-    uint32_t status;
-    if (!Dbg::GetClassInfo(ids[i], &typeTag, &status, NULL)) {
-      return ERR_INVALID_CLASS;
+    JDWP::JdwpTypeTag type_tag;
+    uint32_t class_status;
+    JDWP::JdwpError status = Dbg::GetClassInfo(ids[i], &type_tag, &class_status, NULL);
+    if (status != ERR_NONE) {
+      return status;
     }
 
-    expandBufAdd1(pReply, typeTag);
+    expandBufAdd1(pReply, type_tag);
     expandBufAddRefTypeId(pReply, ids[i]);
-    expandBufAdd4BE(pReply, status);
+    expandBufAdd4BE(pReply, class_status);
   }
 
   return ERR_NONE;
@@ -419,21 +420,22 @@
 
   for (size_t i = 0; i < classes.size(); ++i) {
     static const char genericSignature[1] = "";
-    JDWP::JdwpTypeTag refTypeTag;
+    JDWP::JdwpTypeTag type_tag;
     std::string descriptor;
-    uint32_t status;
-    if (!Dbg::GetClassInfo(classes[i], &refTypeTag, &status, &descriptor)) {
-      return ERR_INVALID_CLASS;
+    uint32_t class_status;
+    JDWP::JdwpError status = Dbg::GetClassInfo(classes[i], &type_tag, &class_status, &descriptor);
+    if (status != ERR_NONE) {
+      return status;
     }
 
-    expandBufAdd1(pReply, refTypeTag);
+    expandBufAdd1(pReply, type_tag);
     expandBufAddRefTypeId(pReply, classes[i]);
     if (descriptor_and_status) {
       expandBufAddUtf8String(pReply, descriptor);
       if (generic) {
         expandBufAddUtf8String(pReply, genericSignature);
       }
-      expandBufAdd4BE(pReply, status);
+      expandBufAdd4BE(pReply, class_status);
     }
   }
 
@@ -468,17 +470,7 @@
 
 static JdwpError handleRT_Modifiers(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
-  uint32_t access_flags;
-  if (!Dbg::GetAccessFlags(refTypeId, access_flags)) {
-    return ERR_INVALID_CLASS;
-  }
-
-  // Set ACC_SUPER; dex files don't contain this flag, but all classes are supposed to have it set.
-  // Class.getModifiers doesn't return it, but JDWP does, so we set it here.
-  access_flags |= kAccSuper;
-
-  expandBufAdd4BE(pReply, access_flags);
-  return ERR_NONE;
+  return Dbg::GetModifiers(refTypeId, pReply);
 }
 
 /*
@@ -505,8 +497,9 @@
 static JdwpError handleRT_SourceFile(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   std::string source_file;
-  if (!Dbg::GetSourceFile(refTypeId, source_file)) {
-    return ERR_ABSENT_INFORMATION;
+  JdwpError status = Dbg::GetSourceFile(refTypeId, source_file);
+  if (status != ERR_NONE) {
+    return status;
   }
   expandBufAddUtf8String(pReply, source_file);
   return ERR_NONE;
@@ -517,12 +510,13 @@
  */
 static JdwpError handleRT_Status(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
-  JDWP::JdwpTypeTag typeTag;
-  uint32_t status;
-  if (!Dbg::GetClassInfo(refTypeId, &typeTag, &status, NULL)) {
-    return ERR_INVALID_CLASS;
+  JDWP::JdwpTypeTag type_tag;
+  uint32_t class_status;
+  JDWP::JdwpError status = Dbg::GetClassInfo(refTypeId, &type_tag, &class_status, NULL);
+  if (status != ERR_NONE) {
+    return status;
   }
-  expandBufAdd4BE(pReply, status);
+  expandBufAdd4BE(pReply, class_status);
   return ERR_NONE;
 }
 
@@ -532,7 +526,7 @@
 static JdwpError handleRT_Interfaces(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   VLOG(jdwp) << StringPrintf("  Req for interfaces in %llx (%s)", refTypeId, Dbg::GetClassName(refTypeId).c_str());
-  return Dbg::OutputDeclaredInterfaces(refTypeId, pReply) ? ERR_NONE : ERR_INVALID_CLASS;
+  return Dbg::OutputDeclaredInterfaces(refTypeId, pReply);
 }
 
 /*
@@ -541,8 +535,9 @@
 static JdwpError handleRT_ClassObject(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   ObjectId classObjectId;
-  if (!Dbg::GetClassObject(refTypeId, classObjectId)) {
-    return ERR_INVALID_CLASS;
+  JdwpError status = Dbg::GetClassObject(refTypeId, classObjectId);
+  if (status != ERR_NONE) {
+    return status;
   }
   VLOG(jdwp) << StringPrintf("  RefTypeId %llx -> ObjectId %llx", refTypeId, classObjectId);
   expandBufAddObjectId(pReply, classObjectId);
@@ -586,10 +581,7 @@
  */
 static JdwpError handleRT_ClassLoader(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
-
-  expandBufAddObjectId(pReply, Dbg::GetClassLoader(refTypeId));
-
-  return ERR_NONE;
+  return Dbg::GetClassLoader(refTypeId, pReply);
 }
 
 static std::string Describe(const RefTypeId& refTypeId) {
@@ -605,14 +597,14 @@
 static JdwpError handleRT_FieldsWithGeneric(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   VLOG(jdwp) << "  Req for fields in " << Describe(refTypeId);
-  return Dbg::OutputDeclaredFields(refTypeId, true, pReply) ? ERR_NONE : ERR_INVALID_CLASS;
+  return Dbg::OutputDeclaredFields(refTypeId, true, pReply);
 }
 
 // Obsolete equivalent of FieldsWithGeneric, without the generic type information.
 static JdwpError handleRT_Fields(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   VLOG(jdwp) << "  Req for fields in " << Describe(refTypeId);
-  return Dbg::OutputDeclaredFields(refTypeId, false, pReply) ? ERR_NONE : ERR_INVALID_CLASS;
+  return Dbg::OutputDeclaredFields(refTypeId, false, pReply);
 }
 
 /*
@@ -622,14 +614,14 @@
 static JdwpError handleRT_MethodsWithGeneric(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   VLOG(jdwp) << "  Req for methods in " << Describe(refTypeId);
-  return Dbg::OutputDeclaredMethods(refTypeId, true, pReply) ? ERR_NONE : ERR_INVALID_CLASS;
+  return Dbg::OutputDeclaredMethods(refTypeId, true, pReply);
 }
 
 // Obsolete equivalent of MethodsWithGeneric, without the generic type information.
 static JdwpError handleRT_Methods(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   VLOG(jdwp) << "  Req for methods in " << Describe(refTypeId);
-  return Dbg::OutputDeclaredMethods(refTypeId, false, pReply) ? ERR_NONE : ERR_INVALID_CLASS;
+  return Dbg::OutputDeclaredMethods(refTypeId, false, pReply);
 }
 
 /*
@@ -699,8 +691,9 @@
 
   VLOG(jdwp) << "Creating instance of " << Dbg::GetClassName(classId);
   ObjectId objectId;
-  if (!Dbg::CreateObject(classId, objectId)) {
-    return ERR_INVALID_CLASS;
+  JdwpError status = Dbg::CreateObject(classId, objectId);
+  if (status != ERR_NONE) {
+    return status;
   }
   if (objectId == 0) {
     return ERR_OUT_OF_MEMORY;
@@ -717,8 +710,9 @@
 
   VLOG(jdwp) << "Creating array " << Dbg::GetClassName(arrayTypeId) << "[" << length << "]";
   ObjectId objectId;
-  if (!Dbg::CreateArrayObject(arrayTypeId, length, objectId)) {
-    return ERR_INVALID_CLASS;
+  JdwpError status = Dbg::CreateArrayObject(arrayTypeId, length, objectId);
+  if (status != ERR_NONE) {
+    return status;
   }
   if (objectId == 0) {
     return ERR_OUT_OF_MEMORY;
@@ -1440,18 +1434,8 @@
  */
 static JdwpError handleCOR_ReflectedType(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId classObjectId = ReadRefTypeId(&buf);
-
   VLOG(jdwp) << StringPrintf("  Req for refTypeId for class=%llx (%s)", classObjectId, Dbg::GetClassName(classObjectId).c_str());
-
-  bool is_interface;
-  if (!Dbg::IsInterface(classObjectId, is_interface)) {
-    return ERR_INVALID_CLASS;
-  }
-
-  expandBufAdd1(pReply, is_interface ? TT_INTERFACE : TT_CLASS);
-  expandBufAddRefTypeId(pReply, classObjectId);
-
-  return ERR_NONE;
+  return Dbg::GetReflectedType(classObjectId, pReply);
 }
 
 /*
