Merge "Disable some tests in heap_verification_test when running with ASan."
diff --git a/cmdline/cmdline_parser_test.cc b/cmdline/cmdline_parser_test.cc
index 42c6a5f..97daafa 100644
--- a/cmdline/cmdline_parser_test.cc
+++ b/cmdline/cmdline_parser_test.cc
@@ -131,7 +131,7 @@
     art::InitLogging(nullptr, art::Runtime::Abort);  // argv = null
   }
 
-  virtual void SetUp() {
+  void SetUp() override {
     parser_ = ParsedOptions::MakeParser(false);  // do not ignore unrecognized options
   }
 
diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc
index fd17364..80c0a68 100644
--- a/compiler/exception_test.cc
+++ b/compiler/exception_test.cc
@@ -50,7 +50,7 @@
   // which always points to the first source statement.
   static constexpr const uint32_t kDexPc = 0;
 
-  virtual void SetUp() {
+  void SetUp() override {
     CommonRuntimeTest::SetUp();
 
     ScopedObjectAccess soa(Thread::Current());
diff --git a/compiler/optimizing/constructor_fence_redundancy_elimination.cc b/compiler/optimizing/constructor_fence_redundancy_elimination.cc
index 3cb8bf2..3a1a9e0 100644
--- a/compiler/optimizing/constructor_fence_redundancy_elimination.cc
+++ b/compiler/optimizing/constructor_fence_redundancy_elimination.cc
@@ -78,7 +78,7 @@
     VisitSetLocation(instruction, value);
   }
 
-  void VisitDeoptimize(HDeoptimize* instruction ATTRIBUTE_UNUSED) {
+  void VisitDeoptimize(HDeoptimize* instruction ATTRIBUTE_UNUSED) override {
     // Pessimize: Merge all fences.
     MergeCandidateFences();
   }
diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc
index 7f71745..b33d0f4 100644
--- a/compiler/optimizing/load_store_elimination.cc
+++ b/compiler/optimizing/load_store_elimination.cc
@@ -692,7 +692,7 @@
     VisitSetLocation(instruction, idx, instruction->InputAt(2));
   }
 
-  void VisitDeoptimize(HDeoptimize* instruction) {
+  void VisitDeoptimize(HDeoptimize* instruction) override {
     const ScopedArenaVector<HInstruction*>& heap_values =
         heap_values_for_[instruction->GetBlock()->GetBlockId()];
     for (HInstruction* heap_value : heap_values) {
diff --git a/compiler/optimizing/optimizing_cfi_test.cc b/compiler/optimizing/optimizing_cfi_test.cc
index be1f7ea..a52031c 100644
--- a/compiler/optimizing/optimizing_cfi_test.cc
+++ b/compiler/optimizing/optimizing_cfi_test.cc
@@ -128,7 +128,7 @@
    public:
     InternalCodeAllocator() {}
 
-    virtual uint8_t* Allocate(size_t size) {
+    uint8_t* Allocate(size_t size) override {
       memory_.resize(size);
       return memory_.data();
     }
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 0a74705..ff1207a 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -79,7 +79,7 @@
   explicit CodeVectorAllocator(ArenaAllocator* allocator)
       : memory_(allocator->Adapter(kArenaAllocCodeBuffer)) {}
 
-  virtual uint8_t* Allocate(size_t size) {
+  uint8_t* Allocate(size_t size) override {
     memory_.resize(size);
     return &memory_[0];
   }
diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc
index a9d5902..9079658 100644
--- a/compiler/optimizing/reference_type_propagation.cc
+++ b/compiler/optimizing/reference_type_propagation.cc
@@ -114,9 +114,9 @@
   void VisitCheckCast(HCheckCast* instr) override;
   void VisitBoundType(HBoundType* instr) override;
   void VisitNullCheck(HNullCheck* instr) override;
-  void VisitPhi(HPhi* phi);
+  void VisitPhi(HPhi* phi) override;
 
-  void VisitBasicBlock(HBasicBlock* block);
+  void VisitBasicBlock(HBasicBlock* block) override;
   void ProcessWorklist();
 
  private:
diff --git a/compiler/utils/mips/assembler_mips32r5_test.cc b/compiler/utils/mips/assembler_mips32r5_test.cc
index f9919f5..bd73c12 100644
--- a/compiler/utils/mips/assembler_mips32r5_test.cc
+++ b/compiler/utils/mips/assembler_mips32r5_test.cc
@@ -229,7 +229,7 @@
     STLDeleteElements(&vec_registers_);
   }
 
-  std::vector<mips::MipsLabel> GetAddresses() {
+  std::vector<mips::MipsLabel> GetAddresses() override {
     UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
     UNREACHABLE();
   }
diff --git a/compiler/utils/mips/assembler_mips32r6_test.cc b/compiler/utils/mips/assembler_mips32r6_test.cc
index 1ec7a6a..9637c25 100644
--- a/compiler/utils/mips/assembler_mips32r6_test.cc
+++ b/compiler/utils/mips/assembler_mips32r6_test.cc
@@ -242,7 +242,7 @@
     STLDeleteElements(&vec_registers_);
   }
 
-  std::vector<mips::MipsLabel> GetAddresses() {
+  std::vector<mips::MipsLabel> GetAddresses() override {
     UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
     UNREACHABLE();
   }
diff --git a/compiler/utils/mips/assembler_mips_test.cc b/compiler/utils/mips/assembler_mips_test.cc
index 9527fa6..f137c60 100644
--- a/compiler/utils/mips/assembler_mips_test.cc
+++ b/compiler/utils/mips/assembler_mips_test.cc
@@ -176,7 +176,7 @@
     STLDeleteElements(&fp_registers_);
   }
 
-  std::vector<mips::MipsLabel> GetAddresses() {
+  std::vector<mips::MipsLabel> GetAddresses() override {
     UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
     UNREACHABLE();
   }
diff --git a/compiler/utils/mips64/assembler_mips64_test.cc b/compiler/utils/mips64/assembler_mips64_test.cc
index 4ceb356..3218ae3 100644
--- a/compiler/utils/mips64/assembler_mips64_test.cc
+++ b/compiler/utils/mips64/assembler_mips64_test.cc
@@ -240,7 +240,7 @@
     STLDeleteElements(&vec_registers_);
   }
 
-  std::vector<mips64::Mips64Label> GetAddresses() {
+  std::vector<mips64::Mips64Label> GetAddresses() override {
     UNIMPLEMENTED(FATAL) << "Feature not implemented yet";
     UNREACHABLE();
   }
diff --git a/compiler/utils/x86_64/assembler_x86_64_test.cc b/compiler/utils/x86_64/assembler_x86_64_test.cc
index e1de1f1..65711e0 100644
--- a/compiler/utils/x86_64/assembler_x86_64_test.cc
+++ b/compiler/utils/x86_64/assembler_x86_64_test.cc
@@ -297,7 +297,7 @@
     STLDeleteElements(&fp_registers_);
   }
 
-  std::vector<x86_64::Address> GetAddresses() {
+  std::vector<x86_64::Address> GetAddresses() override {
     return addresses_;
   }
 
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index 81932a9..523c90b 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -52,7 +52,7 @@
   bool IsRelocationPossible() override { return false; }
 
   verifier::VerifierDeps* GetVerifierDeps() const override { return deps_; }
-  void SetVerifierDeps(verifier::VerifierDeps* deps) { deps_ = deps; }
+  void SetVerifierDeps(verifier::VerifierDeps* deps) override { deps_ = deps; }
 
  private:
   verifier::VerifierDeps* deps_;
@@ -60,7 +60,7 @@
 
 class VerifierDepsTest : public CommonCompilerTest {
  public:
-  void SetUpRuntimeOptions(RuntimeOptions* options) {
+  void SetUpRuntimeOptions(RuntimeOptions* options) override {
     CommonCompilerTest::SetUpRuntimeOptions(options);
     callbacks_.reset(new VerifierDepsCompilerCallbacks());
   }
diff --git a/dex2oat/linker/elf_writer_quick.cc b/dex2oat/linker/elf_writer_quick.cc
index 852293b..9a7f93d 100644
--- a/dex2oat/linker/elf_writer_quick.cc
+++ b/dex2oat/linker/elf_writer_quick.cc
@@ -68,7 +68,7 @@
         debug_info_(debug_info) {
   }
 
-  void Run(Thread*) {
+  void Run(Thread*) override {
     result_ = debug::MakeMiniDebugInfo(isa_,
                                        instruction_set_features_,
                                        text_section_address_,
diff --git a/dex2oat/linker/elf_writer_test.cc b/dex2oat/linker/elf_writer_test.cc
index 40495f3..ef85fd1 100644
--- a/dex2oat/linker/elf_writer_test.cc
+++ b/dex2oat/linker/elf_writer_test.cc
@@ -34,7 +34,7 @@
 
 class ElfWriterTest : public CommonCompilerTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     ReserveImageSpace();
     CommonCompilerTest::SetUp();
   }
diff --git a/dex2oat/linker/multi_oat_relative_patcher_test.cc b/dex2oat/linker/multi_oat_relative_patcher_test.cc
index a5831b6..2610561 100644
--- a/dex2oat/linker/multi_oat_relative_patcher_test.cc
+++ b/dex2oat/linker/multi_oat_relative_patcher_test.cc
@@ -96,12 +96,12 @@
 
     void PatchBakerReadBarrierBranch(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
                                      const LinkerPatch& patch ATTRIBUTE_UNUSED,
-                                     uint32_t patch_offset ATTRIBUTE_UNUSED) {
+                                     uint32_t patch_offset ATTRIBUTE_UNUSED) override {
       LOG(FATAL) << "UNIMPLEMENTED";
     }
 
     std::vector<debug::MethodDebugInfo> GenerateThunkDebugInfo(
-        uint32_t executable_offset ATTRIBUTE_UNUSED) {
+        uint32_t executable_offset ATTRIBUTE_UNUSED) override {
       LOG(FATAL) << "UNIMPLEMENTED";
       UNREACHABLE();
     }
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index f88d8d4..e2db11f 100644
--- a/dex2oat/linker/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -1671,7 +1671,7 @@
     }
   }
 
-  virtual bool VisitComplete() {
+  bool VisitComplete() override {
     offset_ = writer_->relative_patcher_->WriteThunks(out_, offset_);
     if (UNLIKELY(offset_ == 0u)) {
       PLOG(ERROR) << "Failed to write final relative call thunks";
diff --git a/dex2oat/linker/relative_patcher.cc b/dex2oat/linker/relative_patcher.cc
index 564cf30..45a4a22 100644
--- a/dex2oat/linker/relative_patcher.cc
+++ b/dex2oat/linker/relative_patcher.cc
@@ -79,7 +79,7 @@
 
     void PatchBakerReadBarrierBranch(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
                                      const LinkerPatch& patch ATTRIBUTE_UNUSED,
-                                     uint32_t patch_offset ATTRIBUTE_UNUSED) {
+                                     uint32_t patch_offset ATTRIBUTE_UNUSED) override {
       LOG(FATAL) << "Unexpected baker read barrier branch patch.";
     }
 
diff --git a/dexdump/dexdump_test.cc b/dexdump/dexdump_test.cc
index 3a2d38d..bb6d4a4 100644
--- a/dexdump/dexdump_test.cc
+++ b/dexdump/dexdump_test.cc
@@ -31,7 +31,7 @@
 
 class DexDumpTest : public CommonRuntimeTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     CommonRuntimeTest::SetUp();
     // Dogfood our own lib core dex file.
     dex_file_ = GetLibCoreDexFileNames()[0];
diff --git a/dexlayout/dexdiag_test.cc b/dexlayout/dexdiag_test.cc
index 60dd7e4..f936ff9 100644
--- a/dexlayout/dexdiag_test.cc
+++ b/dexlayout/dexdiag_test.cc
@@ -34,7 +34,7 @@
 
 class DexDiagTest : public CommonRuntimeTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     CommonRuntimeTest::SetUp();
   }
 
diff --git a/dexlist/dexlist_test.cc b/dexlist/dexlist_test.cc
index 68e6713..39e5f8c 100644
--- a/dexlist/dexlist_test.cc
+++ b/dexlist/dexlist_test.cc
@@ -33,7 +33,7 @@
 
 class DexListTest : public CommonRuntimeTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     CommonRuntimeTest::SetUp();
     // Dogfood our own lib core dex file.
     dex_file_ = GetLibCoreDexFileNames()[0];
diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc
index 6ecf901..51b3d75 100644
--- a/imgdiag/imgdiag.cc
+++ b/imgdiag/imgdiag.cc
@@ -1731,7 +1731,7 @@
     return kParseOk;
   }
 
-  virtual std::string GetUsage() const {
+  std::string GetUsage() const override {
     std::string usage;
 
     usage +=
@@ -1761,7 +1761,7 @@
 };
 
 struct ImgDiagMain : public CmdlineMain<ImgDiagArgs> {
-  virtual bool ExecuteWithRuntime(Runtime* runtime) {
+  bool ExecuteWithRuntime(Runtime* runtime) override {
     CHECK(args_ != nullptr);
 
     return DumpImage(runtime,
diff --git a/imgdiag/imgdiag_test.cc b/imgdiag/imgdiag_test.cc
index cb40c7d..73df2a2 100644
--- a/imgdiag/imgdiag_test.cc
+++ b/imgdiag/imgdiag_test.cc
@@ -47,7 +47,7 @@
 
 class ImgDiagTest : public CommonRuntimeTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     CommonRuntimeTest::SetUp();
 
     // We loaded the runtime with an explicit image. Therefore the image space must exist.
diff --git a/libartbase/base/allocator.cc b/libartbase/base/allocator.cc
index 1bcfe87..6393672 100644
--- a/libartbase/base/allocator.cc
+++ b/libartbase/base/allocator.cc
@@ -30,11 +30,11 @@
   MallocAllocator() {}
   ~MallocAllocator() {}
 
-  void* Alloc(size_t size) {
+  void* Alloc(size_t size) override {
     return calloc(sizeof(uint8_t), size);
   }
 
-  void Free(void* p) {
+  void Free(void* p) override {
     free(p);
   }
 
@@ -49,12 +49,12 @@
   NoopAllocator() {}
   ~NoopAllocator() {}
 
-  void* Alloc(size_t size ATTRIBUTE_UNUSED) {
+  void* Alloc(size_t size ATTRIBUTE_UNUSED) override {
     LOG(FATAL) << "NoopAllocator::Alloc should not be called";
     UNREACHABLE();
   }
 
-  void Free(void* p ATTRIBUTE_UNUSED) {
+  void Free(void* p ATTRIBUTE_UNUSED) override {
     // Noop.
   }
 
diff --git a/libartbase/base/arena_bit_vector.cc b/libartbase/base/arena_bit_vector.cc
index c6d8993..138a5df 100644
--- a/libartbase/base/arena_bit_vector.cc
+++ b/libartbase/base/arena_bit_vector.cc
@@ -62,11 +62,11 @@
     UNREACHABLE();
   }
 
-  virtual void* Alloc(size_t size) {
+  void* Alloc(size_t size) override {
     return allocator_->Alloc(size, this->Kind());
   }
 
-  virtual void Free(void*) {}  // Nop.
+  void Free(void*) override {}  // Nop.
 
  private:
   ArenaBitVectorAllocator(ArenaAlloc* allocator, ArenaAllocKind kind)
diff --git a/libartbase/base/unix_file/fd_file_test.cc b/libartbase/base/unix_file/fd_file_test.cc
index 298b2d7..9c39bb5 100644
--- a/libartbase/base/unix_file/fd_file_test.cc
+++ b/libartbase/base/unix_file/fd_file_test.cc
@@ -23,7 +23,7 @@
 
 class FdFileTest : public RandomAccessFileTest {
  protected:
-  virtual RandomAccessFile* MakeTestFile() {
+  RandomAccessFile* MakeTestFile() override {
     FILE* tmp = tmpfile();
     int fd = dup(fileno(tmp));
     fclose(tmp);
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index ac9ece7..51abaf4 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -3424,7 +3424,7 @@
     return kParseOk;
   }
 
-  virtual std::string GetUsage() const {
+  std::string GetUsage() const override {
     std::string usage;
 
     usage +=
@@ -3578,7 +3578,7 @@
     }
   }
 
-  virtual bool ExecuteWithRuntime(Runtime* runtime) {
+  bool ExecuteWithRuntime(Runtime* runtime) override {
     CHECK(args_ != nullptr);
 
     if (!args_->imt_dump_.empty() || args_->imt_stat_dump_) {
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index f1d6fb0..1ed615b 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -267,7 +267,8 @@
     }
   }
 
-  void ClassLoad(art::Handle<art::mirror::Class> klass) REQUIRES_SHARED(art::Locks::mutator_lock_) {
+  void ClassLoad(art::Handle<art::mirror::Class> klass) override
+      REQUIRES_SHARED(art::Locks::mutator_lock_) {
     if (event_handler->IsEventEnabledAnywhere(ArtJvmtiEvent::kClassLoad)) {
       art::Thread* thread = art::Thread::Current();
       ScopedLocalRef<jclass> jklass(thread->GetJniEnv(),
@@ -289,7 +290,7 @@
 
   void ClassPrepare(art::Handle<art::mirror::Class> temp_klass,
                     art::Handle<art::mirror::Class> klass)
-      REQUIRES_SHARED(art::Locks::mutator_lock_) {
+      override REQUIRES_SHARED(art::Locks::mutator_lock_) {
     if (event_handler->IsEventEnabledAnywhere(ArtJvmtiEvent::kClassPrepare)) {
       art::Thread* thread = art::Thread::Current();
       if (temp_klass.Get() != klass.Get()) {
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 1588df4..6764538 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -689,7 +689,7 @@
         val_(val),
         obj_val_(nullptr) {}
 
-  virtual jvmtiError GetResult() REQUIRES_SHARED(art::Locks::mutator_lock_) {
+  jvmtiError GetResult() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
     if (result_ == OK && type_ == art::Primitive::kPrimNot) {
       val_->l = obj_val_.IsNull()
           ? nullptr
diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index 6d3a37e..df29098 100644
--- a/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
@@ -370,7 +370,7 @@
    public:
     GetContendedMonitorClosure() : out_(nullptr) {}
 
-    void Run(art::Thread* target_thread) REQUIRES_SHARED(art::Locks::mutator_lock_) {
+    void Run(art::Thread* target_thread) override REQUIRES_SHARED(art::Locks::mutator_lock_) {
       art::ScopedAssertNoThreadSuspension sants("GetContendedMonitorClosure::Run");
       switch (target_thread->GetState()) {
         // These three we are actually currently waiting on a monitor and have sent the appropriate
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index b6969af..e2b98b3 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -79,7 +79,7 @@
   GetStackTraceVisitor(const GetStackTraceVisitor&) = default;
   GetStackTraceVisitor(GetStackTraceVisitor&&) = default;
 
-  bool VisitFrame() REQUIRES_SHARED(art::Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
     art::ArtMethod* m = GetMethod();
     if (m->IsRuntimeMethod()) {
       return true;
@@ -662,7 +662,7 @@
       : art::StackVisitor(thread, nullptr, art::StackVisitor::StackWalkKind::kIncludeInlinedFrames),
         count(0) {}
 
-  bool VisitFrame() REQUIRES_SHARED(art::Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
     art::ArtMethod* m = GetMethod();
     const bool do_count = !(m == nullptr || m->IsRuntimeMethod());
     if (do_count) {
@@ -734,7 +734,7 @@
         caller(nullptr),
         caller_dex_pc(0) {}
 
-  bool VisitFrame() REQUIRES_SHARED(art::Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) {
     art::ArtMethod* m = GetMethod();
     const bool do_count = !(m == nullptr || m->IsRuntimeMethod());
     if (do_count) {
diff --git a/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc
index e533094..41ef6c2 100644
--- a/openjdkjvmti/ti_thread.cc
+++ b/openjdkjvmti/ti_thread.cc
@@ -1110,7 +1110,7 @@
    public:
     explicit StopThreadClosure(art::Handle<art::mirror::Throwable> except) : exception_(except) { }
 
-    void Run(art::Thread* me) REQUIRES_SHARED(art::Locks::mutator_lock_) {
+    void Run(art::Thread* me) override REQUIRES_SHARED(art::Locks::mutator_lock_) {
       // Make sure the thread is prepared to notice the exception.
       art::Runtime::Current()->GetInstrumentation()->InstrumentThreadStack(me);
       me->SetAsyncException(exception_.Get());
diff --git a/patchoat/patchoat_test.cc b/patchoat/patchoat_test.cc
index 08bf31c..6492b96 100644
--- a/patchoat/patchoat_test.cc
+++ b/patchoat/patchoat_test.cc
@@ -529,7 +529,7 @@
     ASSERT_EQ(rel_shortened_basenames, relocated_image_shortened_basenames);
   }
 
-  virtual void TearDown() {
+  void TearDown() override {
     if (!dex2oat_orig_dir_.empty()) {
       ClearDirectory(dex2oat_orig_dir_.c_str(), /*recursive*/ true);
       rmdir(dex2oat_orig_dir_.c_str());
diff --git a/runtime/barrier_test.cc b/runtime/barrier_test.cc
index 88075ba..5ec24bc 100644
--- a/runtime/barrier_test.cc
+++ b/runtime/barrier_test.cc
@@ -32,7 +32,7 @@
         count1_(count1),
         count2_(count2) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     LOG(INFO) << "Before barrier" << *self;
     ++*count1_;
     barrier_->Wait(self);
@@ -40,7 +40,7 @@
     LOG(INFO) << "After barrier" << *self;
   }
 
-  virtual void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
@@ -91,7 +91,7 @@
         count_(count),
         subtasks_(subtasks) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     for (size_t i = 0; i < subtasks_; ++i) {
       ++*count_;
       // Pass through to next subtask.
@@ -99,7 +99,7 @@
     }
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
  private:
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 511d468..b014e52 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1157,7 +1157,7 @@
   VerifyDeclaringClassVisitor() REQUIRES_SHARED(Locks::mutator_lock_, Locks::heap_bitmap_lock_)
       : live_bitmap_(Runtime::Current()->GetHeap()->GetLiveBitmap()) {}
 
-  virtual void Visit(ArtMethod* method)
+  void Visit(ArtMethod* method) override
       REQUIRES_SHARED(Locks::mutator_lock_, Locks::heap_bitmap_lock_) {
     ObjPtr<mirror::Class> klass = method->GetDeclaringClassUnchecked();
     if (klass != nullptr) {
@@ -1557,7 +1557,7 @@
      public:
       explicit VerifyClassInTableArtMethodVisitor(ClassTable* table) : table_(table) {}
 
-      virtual void Visit(ArtMethod* method)
+      void Visit(ArtMethod* method) override
           REQUIRES_SHARED(Locks::mutator_lock_, Locks::classlinker_classes_lock_) {
         ObjPtr<mirror::Class> klass = method->GetDeclaringClass();
         if (klass != nullptr && !Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(klass)) {
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 366b5ec..7103214 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -897,7 +897,7 @@
 
     // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses
     // annotalysis.
-    bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS {
+    bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS {
       if (!GetMethod()->IsRuntimeMethod()) {
         Monitor::VisitLocks(this, AppendOwnedMonitors, this);
         ++current_stack_depth;
@@ -2406,7 +2406,7 @@
 
     // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses
     // annotalysis.
-    bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS {
+    bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS {
       if (!GetMethod()->IsRuntimeMethod()) {
         ++depth;
       }
@@ -2576,7 +2576,7 @@
 
   // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses
   // annotalysis.
-  virtual bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS {
+  bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS {
     if (frame_id != GetFrameId()) {
       return true;  // continue
     } else {
@@ -2618,7 +2618,7 @@
 
   // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses
   // annotalysis.
-  bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS {
+  bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS {
     if (GetFrameId() != frame_id_) {
       return true;  // Not our frame, carry on.
     }
@@ -3831,7 +3831,7 @@
 
     // TODO: Enable annotalysis. We know lock is held in constructor, but abstraction confuses
     // annotalysis.
-    bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS {
+    bool VisitFrame() override NO_THREAD_SAFETY_ANALYSIS {
       ArtMethod* m = GetMethod();
       if (!m->IsRuntimeMethod()) {
         ++stack_depth;
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index eede5a5..d91cc24 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -423,7 +423,7 @@
 
   void VisitRoots(mirror::Object*** roots,
                   size_t count,
-                  const RootInfo& info ATTRIBUTE_UNUSED)
+                  const RootInfo& info ATTRIBUTE_UNUSED) override
       REQUIRES_SHARED(Locks::mutator_lock_) {
     Thread* self = Thread::Current();
     for (size_t i = 0; i < count; ++i) {
@@ -440,7 +440,7 @@
 
   void VisitRoots(mirror::CompressedReference<mirror::Object>** roots,
                   size_t count,
-                  const RootInfo& info ATTRIBUTE_UNUSED)
+                  const RootInfo& info ATTRIBUTE_UNUSED) override
       REQUIRES_SHARED(Locks::mutator_lock_) {
     Thread* self = Thread::Current();
     for (size_t i = 0; i < count; ++i) {
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 23b2719..5f44a72 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -789,12 +789,12 @@
     mark_stack_[mark_stack_pos_++].Assign(obj);
   }
 
-  virtual void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
   // Scans all of the objects
-  virtual void Run(Thread* self ATTRIBUTE_UNUSED)
+  void Run(Thread* self ATTRIBUTE_UNUSED) override
       REQUIRES(Locks::heap_bitmap_lock_)
       REQUIRES_SHARED(Locks::mutator_lock_) {
     ScanObjectParallelVisitor visitor(this);
@@ -852,11 +852,11 @@
   const uint8_t minimum_age_;
   const bool clear_card_;
 
-  virtual void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
-  virtual void Run(Thread* self) NO_THREAD_SAFETY_ANALYSIS {
+  void Run(Thread* self) override NO_THREAD_SAFETY_ANALYSIS {
     ScanObjectParallelVisitor visitor(this);
     accounting::CardTable* card_table = mark_sweep_->GetHeap()->GetCardTable();
     size_t cards_scanned = clear_card_
@@ -1009,12 +1009,12 @@
   const uintptr_t begin_;
   const uintptr_t end_;
 
-  virtual void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
   // Scans all of the objects
-  virtual void Run(Thread* self) NO_THREAD_SAFETY_ANALYSIS {
+  void Run(Thread* self) override NO_THREAD_SAFETY_ANALYSIS {
     ScanObjectParallelVisitor visitor(this);
     bitmap_->VisitMarkedRange(begin_, end_, visitor);
     // Finish by emptying our local mark stack.
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index e76d35d..b6610b7 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -2280,13 +2280,13 @@
     }
   }
 
-  virtual bool ShouldSweepSpace(space::ContinuousSpace* space ATTRIBUTE_UNUSED) const {
+  bool ShouldSweepSpace(space::ContinuousSpace* space ATTRIBUTE_UNUSED) const override {
     // Don't sweep any spaces since we probably blasted the internal accounting of the free list
     // allocator.
     return false;
   }
 
-  virtual mirror::Object* MarkNonForwardedObject(mirror::Object* obj)
+  mirror::Object* MarkNonForwardedObject(mirror::Object* obj) override
       REQUIRES(Locks::heap_bitmap_lock_, Locks::mutator_lock_) {
     size_t obj_size = obj->SizeOf<kDefaultVerifyFlags>();
     size_t alloc_size = RoundUp(obj_size, kObjectAlignment);
diff --git a/runtime/gc/heap_test.cc b/runtime/gc/heap_test.cc
index 7cbad3b..05a04f2 100644
--- a/runtime/gc/heap_test.cc
+++ b/runtime/gc/heap_test.cc
@@ -96,7 +96,7 @@
 }
 
 class ZygoteHeapTest : public CommonRuntimeTest {
-  void SetUpRuntimeOptions(RuntimeOptions* options) {
+  void SetUpRuntimeOptions(RuntimeOptions* options) override {
     CommonRuntimeTest::SetUpRuntimeOptions(options);
     options->push_back(std::make_pair("-Xzygote", nullptr));
   }
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc
index fe4124d..c212bad 100644
--- a/runtime/gc/reference_processor.cc
+++ b/runtime/gc/reference_processor.cc
@@ -276,7 +276,7 @@
   explicit ClearedReferenceTask(jobject cleared_references)
       : HeapTask(NanoTime()), cleared_references_(cleared_references) {
   }
-  virtual void Run(Thread* thread) {
+  void Run(Thread* thread) override {
     ScopedObjectAccess soa(thread);
     jvalue args[1];
     args[0].l = cleared_references_;
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 3999e27..b9c8e15 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -1099,7 +1099,7 @@
           fixup_heap_objects_(fixup_heap_objects),
           pointer_size_(pointer_size) {}
 
-    virtual void Visit(ArtMethod* method) NO_THREAD_SAFETY_ANALYSIS {
+    void Visit(ArtMethod* method) override NO_THREAD_SAFETY_ANALYSIS {
       // TODO: Separate visitor for runtime vs normal methods.
       if (UNLIKELY(method->IsRuntimeMethod())) {
         ImtConflictTable* table = method->GetImtConflictTable(pointer_size_);
@@ -1132,7 +1132,7 @@
     template<typename... Args>
     explicit FixupArtFieldVisitor(Args... args) : FixupVisitor(args...) {}
 
-    virtual void Visit(ArtField* field) NO_THREAD_SAFETY_ANALYSIS {
+    void Visit(ArtField* field) override NO_THREAD_SAFETY_ANALYSIS {
       field->UpdateObjects(ForwardObjectAdapter(this));
     }
   };
diff --git a/runtime/gc/space/large_object_space_test.cc b/runtime/gc/space/large_object_space_test.cc
index 9baa016..d55ccd6 100644
--- a/runtime/gc/space/large_object_space_test.cc
+++ b/runtime/gc/space/large_object_space_test.cc
@@ -128,7 +128,7 @@
   AllocRaceTask(size_t id, size_t iterations, size_t size, LargeObjectSpace* los) :
     id_(id), iterations_(iterations), size_(size), los_(los) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     for (size_t i = 0; i < iterations_ ; ++i) {
       size_t alloc_size, bytes_tl_bulk_allocated;
       mirror::Object* ptr = los_->Alloc(self, size_, &alloc_size, nullptr,
@@ -140,7 +140,7 @@
     }
   }
 
-  virtual void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index b42433c..03fd964 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -1385,7 +1385,7 @@
       : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
         shorty('V') {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     if (m != nullptr && !m->IsRuntimeMethod()) {
       // The first Java method.
diff --git a/runtime/jdwp/jdwp_adb.cc b/runtime/jdwp/jdwp_adb.cc
index 481aff9..e6043c6 100644
--- a/runtime/jdwp/jdwp_adb.cc
+++ b/runtime/jdwp/jdwp_adb.cc
@@ -87,13 +87,13 @@
     }
   }
 
-  virtual bool Accept() REQUIRES(!state_lock_);
+  bool Accept() override REQUIRES(!state_lock_);
 
-  virtual bool Establish(const JdwpOptions*) {
+  bool Establish(const JdwpOptions*) override {
     return false;
   }
 
-  virtual void Shutdown() REQUIRES(!state_lock_) {
+  void Shutdown() override REQUIRES(!state_lock_) {
     int control_sock;
     int local_clientSock;
     {
@@ -116,7 +116,7 @@
     WakePipe();
   }
 
-  virtual bool ProcessIncoming() REQUIRES(!state_lock_);
+  bool ProcessIncoming() override REQUIRES(!state_lock_);
 
  private:
   int ReceiveClientFd() REQUIRES(!state_lock_);
diff --git a/runtime/jdwp/jdwp_socket.cc b/runtime/jdwp/jdwp_socket.cc
index 673a942..29fa160 100644
--- a/runtime/jdwp/jdwp_socket.cc
+++ b/runtime/jdwp/jdwp_socket.cc
@@ -54,10 +54,10 @@
         remote_port_(0U) {
   }
 
-  virtual bool Accept();
-  virtual bool Establish(const JdwpOptions*);
-  virtual void Shutdown();
-  virtual bool ProcessIncoming();
+  bool Accept() override;
+  bool Establish(const JdwpOptions*) override;
+  void Shutdown() override;
+  bool ProcessIncoming() override;
 
  private:
   in_addr remote_addr_;
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index d9ef922..9043f26 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -274,7 +274,7 @@
       : profile_boot_class_path_(profile_boot_class_path),
         out_(out) {}
 
-  virtual bool operator()(ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool operator()(ObjPtr<mirror::Class> klass) override REQUIRES_SHARED(Locks::mutator_lock_) {
     if (klass->IsProxyClass() ||
         klass->IsArrayClass() ||
         klass->IsPrimitive() ||
diff --git a/runtime/jni/java_vm_ext_test.cc b/runtime/jni/java_vm_ext_test.cc
index 4049c6e..dfe50cf 100644
--- a/runtime/jni/java_vm_ext_test.cc
+++ b/runtime/jni/java_vm_ext_test.cc
@@ -27,7 +27,7 @@
 
 class JavaVmExtTest : public CommonRuntimeTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     CommonRuntimeTest::SetUp();
 
     vm_ = Runtime::Current()->GetJavaVM();
diff --git a/runtime/jni/jni_internal_test.cc b/runtime/jni/jni_internal_test.cc
index 3040b90..4ad4c14 100644
--- a/runtime/jni/jni_internal_test.cc
+++ b/runtime/jni/jni_internal_test.cc
@@ -34,7 +34,7 @@
 // TODO: Convert to CommonRuntimeTest. Currently MakeExecutable is used.
 class JniInternalTest : public CommonCompilerTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     CommonCompilerTest::SetUp();
 
     vm_ = Runtime::Current()->GetJavaVM();
diff --git a/runtime/monitor_test.cc b/runtime/monitor_test.cc
index c88748f..0b168f8 100644
--- a/runtime/monitor_test.cc
+++ b/runtime/monitor_test.cc
@@ -62,7 +62,7 @@
       monitor_test_(monitor_test), initial_sleep_(initial_sleep), millis_(millis),
       expected_(expected) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     {
       ScopedObjectAccess soa(self);
 
@@ -118,7 +118,7 @@
     }
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
@@ -136,7 +136,7 @@
       monitor_test_(monitor_test), initial_sleep_(initial_sleep), millis_(millis),
       expected_(expected) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     monitor_test_->barrier_->Wait(self);  // Wait for the other thread to set up the monitor.
 
     {
@@ -158,7 +158,7 @@
     monitor_test_->complete_barrier_->Wait(self);  // Wait for test completion.
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
@@ -174,7 +174,7 @@
   InterruptTask(MonitorTest* monitor_test, uint64_t initial_sleep, uint64_t millis) :
       monitor_test_(monitor_test), initial_sleep_(initial_sleep), millis_(millis) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     monitor_test_->barrier_->Wait(self);  // Wait for the other thread to set up the monitor.
 
     {
@@ -202,7 +202,7 @@
     monitor_test_->complete_barrier_->Wait(self);  // Wait for test completion.
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
@@ -216,7 +216,7 @@
  public:
   explicit WatchdogTask(MonitorTest* monitor_test) : monitor_test_(monitor_test) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     ScopedObjectAccess soa(self);
 
     monitor_test_->watchdog_object_.Get()->MonitorEnter(self);        // Lock the object.
@@ -231,7 +231,7 @@
     }
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
@@ -326,14 +326,14 @@
  public:
   explicit TryLockTask(Handle<mirror::Object> obj) : obj_(obj) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     ScopedObjectAccess soa(self);
     // Lock is held by other thread, try lock should fail.
     ObjectTryLock<mirror::Object> lock(self, obj_);
     EXPECT_FALSE(lock.Acquired());
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc
index 3919227..e3932df 100644
--- a/runtime/native/dalvik_system_VMStack.cc
+++ b/runtime/native/dalvik_system_VMStack.cc
@@ -113,7 +113,7 @@
       : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
         class_loader(nullptr) {}
 
-    bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+    bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
       DCHECK(class_loader == nullptr);
       ObjPtr<mirror::Class> c = GetMethod()->GetDeclaringClass();
       // c is null for runtime methods.
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 5a5fb16..f5039d1 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -62,7 +62,7 @@
           caller(nullptr) {
     }
 
-    bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+    bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
       ArtMethod *m = GetMethod();
       if (m == nullptr) {
         // Attached native thread. Assume this is *not* boot class path.
diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc
index efdefb1..3a974df 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -1148,7 +1148,7 @@
         loaded_oat_file_(nullptr)
   {}
 
-  void Run(Thread* self ATTRIBUTE_UNUSED) {
+  void Run(Thread* self ATTRIBUTE_UNUSED) override {
     // Load the dex files, and save a pointer to the loaded oat file, so that
     // we can verify only one oat file was loaded for the dex location.
     std::vector<std::unique_ptr<const DexFile>> dex_files;
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 7b92151..e882e73 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -165,7 +165,7 @@
     CHECK_NE(frame_depth_, kInvalidFrameDepth);
   }
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     size_t current_frame_depth = GetFrameDepth();
     if (current_frame_depth < frame_depth_) {
       CHECK(GetMethod() != nullptr);
diff --git a/runtime/reflection_test.cc b/runtime/reflection_test.cc
index 424ee06..00e298e 100644
--- a/runtime/reflection_test.cc
+++ b/runtime/reflection_test.cc
@@ -33,7 +33,7 @@
 // TODO: Convert to CommonRuntimeTest. Currently MakeExecutable is used.
 class ReflectionTest : public CommonCompilerTest {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     CommonCompilerTest::SetUp();
 
     vm_ = Runtime::Current()->GetJavaVM();
@@ -73,7 +73,7 @@
     }
   }
 
-  virtual void TearDown() {
+  void TearDown() override {
     CleanUpJniEnv();
     CommonCompilerTest::TearDown();
   }
diff --git a/runtime/runtime_callbacks_test.cc b/runtime/runtime_callbacks_test.cc
index aaedb23..89f3124 100644
--- a/runtime/runtime_callbacks_test.cc
+++ b/runtime/runtime_callbacks_test.cc
@@ -458,20 +458,20 @@
       ref_ = { &k->GetDexFile(), k->GetDexClassDefIndex() };
     }
 
-    void MonitorContendedLocking(Monitor* mon ATTRIBUTE_UNUSED)
+    void MonitorContendedLocking(Monitor* mon ATTRIBUTE_UNUSED) override
         REQUIRES_SHARED(Locks::mutator_lock_) { }
 
-    void MonitorContendedLocked(Monitor* mon ATTRIBUTE_UNUSED)
+    void MonitorContendedLocked(Monitor* mon ATTRIBUTE_UNUSED) override
         REQUIRES_SHARED(Locks::mutator_lock_) { }
 
-    void ObjectWaitStart(Handle<mirror::Object> obj, int64_t millis ATTRIBUTE_UNUSED)
+    void ObjectWaitStart(Handle<mirror::Object> obj, int64_t millis ATTRIBUTE_UNUSED) override
         REQUIRES_SHARED(Locks::mutator_lock_) {
       if (IsInterestingObject(obj.Get())) {
         saw_wait_start_ = true;
       }
     }
 
-    void MonitorWaitFinished(Monitor* m, bool timed_out ATTRIBUTE_UNUSED)
+    void MonitorWaitFinished(Monitor* m, bool timed_out ATTRIBUTE_UNUSED) override
         REQUIRES_SHARED(Locks::mutator_lock_) {
       if (IsInterestingObject(m->GetObject())) {
         saw_wait_finished_ = true;
diff --git a/runtime/subtype_check_info_test.cc b/runtime/subtype_check_info_test.cc
index e40bca5..5323093 100644
--- a/runtime/subtype_check_info_test.cc
+++ b/runtime/subtype_check_info_test.cc
@@ -86,11 +86,11 @@
 
 struct SubtypeCheckInfoTest : public ::testing::Test {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     android::base::InitLogging(/*argv*/nullptr);
   }
 
-  virtual void TearDown() {
+  void TearDown() override {
   }
 
   static SubtypeCheckInfo MakeSubtypeCheckInfo(BitString path_to_root = {},
diff --git a/runtime/subtype_check_test.cc b/runtime/subtype_check_test.cc
index 666bf81..9aa3032 100644
--- a/runtime/subtype_check_test.cc
+++ b/runtime/subtype_check_test.cc
@@ -301,13 +301,13 @@
 
 struct SubtypeCheckTest : public ::testing::Test {
  protected:
-  virtual void SetUp() {
+  void SetUp() override {
     android::base::InitLogging(/*argv*/nullptr);
 
     CreateRootedTree(BitString::kCapacity + 2u, BitString::kCapacity + 2u);
   }
 
-  virtual void TearDown() {
+  void TearDown() override {
   }
 
   void CreateRootedTree(size_t width, size_t height) {
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 19fe4ea..8a8f537 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2515,7 +2515,7 @@
         saved_frames_(saved_frames),
         max_saved_frames_(max_saved_frames) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     // We want to skip frames up to and including the exception's constructor.
     // Note we also skip the frame if it doesn't have a method (namely the callee
     // save frame)
@@ -2603,7 +2603,7 @@
     self_->EndAssertNoThreadSuspension(nullptr);
   }
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     if (trace_ == nullptr) {
       return true;  // We're probably trying to fillInStackTrace for an OutOfMemoryError.
     }
@@ -3520,7 +3520,7 @@
       : StackVisitor(thread, context, StackVisitor::StackWalkKind::kSkipInlinedFrames),
         visitor_(visitor) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     if (false) {
       LOG(INFO) << "Visiting stack roots in " << ArtMethod::PrettyMethod(GetMethod())
                 << StringPrintf("@ PC:%04x", GetDexPc());
diff --git a/runtime/thread_pool_test.cc b/runtime/thread_pool_test.cc
index d784200..2600f55 100644
--- a/runtime/thread_pool_test.cc
+++ b/runtime/thread_pool_test.cc
@@ -29,7 +29,7 @@
  public:
   explicit CountTask(AtomicInteger* count) : count_(count), verbose_(false) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     if (verbose_) {
       LOG(INFO) << "Running: " << *self;
     }
@@ -39,7 +39,7 @@
     ++*count_;
   }
 
-  void Finalize() {
+  void Finalize() override {
     if (verbose_) {
       LOG(INFO) << "Finalizing: " << *Thread::Current();
     }
@@ -129,7 +129,7 @@
         count_(count),
         depth_(depth) {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     if (depth_ > 1) {
       thread_pool_->AddTask(self, new TreeTask(thread_pool_, count_, depth_ - 1));
       thread_pool_->AddTask(self, new TreeTask(thread_pool_, count_, depth_ - 1));
@@ -138,7 +138,7 @@
     ++*count_;
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 
@@ -164,12 +164,12 @@
  public:
   PeerTask() {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     ScopedObjectAccess soa(self);
     CHECK(self->GetPeer() != nullptr);
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 };
@@ -178,12 +178,12 @@
  public:
   NoPeerTask() {}
 
-  void Run(Thread* self) {
+  void Run(Thread* self) override {
     ScopedObjectAccess soa(self);
     CHECK(self->GetPeer() == nullptr);
   }
 
-  void Finalize() {
+  void Finalize() override {
     delete this;
   }
 };
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 949fabe..7e48bae 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -64,7 +64,7 @@
       : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
         method_trace_(Trace::AllocStackTrace()) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     // Ignore runtime frames (in particular callee save).
     if (!m->IsRuntimeMethod()) {
diff --git a/test/004-ReferenceMap/stack_walk_refmap_jni.cc b/test/004-ReferenceMap/stack_walk_refmap_jni.cc
index 1ce20e2..4c344a3 100644
--- a/test/004-ReferenceMap/stack_walk_refmap_jni.cc
+++ b/test/004-ReferenceMap/stack_walk_refmap_jni.cc
@@ -37,7 +37,7 @@
   explicit ReferenceMap2Visitor(Thread* thread) REQUIRES_SHARED(Locks::mutator_lock_)
       : CheckReferenceMapVisitor(thread) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     if (CheckReferenceMapVisitor::VisitFrame()) {
       return true;
     }
diff --git a/test/004-StackWalk/stack_walk_jni.cc b/test/004-StackWalk/stack_walk_jni.cc
index 53e0dae..81c27ec 100644
--- a/test/004-StackWalk/stack_walk_jni.cc
+++ b/test/004-StackWalk/stack_walk_jni.cc
@@ -33,7 +33,7 @@
   explicit TestReferenceMapVisitor(Thread* thread) REQUIRES_SHARED(Locks::mutator_lock_)
       : CheckReferenceMapVisitor(thread) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     if (CheckReferenceMapVisitor::VisitFrame()) {
       return true;
     }
diff --git a/test/454-get-vreg/get_vreg_jni.cc b/test/454-get-vreg/get_vreg_jni.cc
index 5fc5464..eb81f3b 100644
--- a/test/454-get-vreg/get_vreg_jni.cc
+++ b/test/454-get-vreg/get_vreg_jni.cc
@@ -34,7 +34,7 @@
         this_value_(this_value),
         found_method_index_(0) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
diff --git a/test/457-regs/regs_jni.cc b/test/457-regs/regs_jni.cc
index f867bdf..80abb3b 100644
--- a/test/457-regs/regs_jni.cc
+++ b/test/457-regs/regs_jni.cc
@@ -32,7 +32,7 @@
       REQUIRES_SHARED(Locks::mutator_lock_)
       : StackVisitor(thread, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
diff --git a/test/461-get-reference-vreg/get_reference_vreg_jni.cc b/test/461-get-reference-vreg/get_reference_vreg_jni.cc
index 7eb3fe5..ddc86df 100644
--- a/test/461-get-reference-vreg/get_reference_vreg_jni.cc
+++ b/test/461-get-reference-vreg/get_reference_vreg_jni.cc
@@ -33,7 +33,7 @@
         this_value_(this_value),
         found_method_index_(0) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
diff --git a/test/466-get-live-vreg/get_live_vreg_jni.cc b/test/466-get-live-vreg/get_live_vreg_jni.cc
index 58ffe04..905d8e6 100644
--- a/test/466-get-live-vreg/get_live_vreg_jni.cc
+++ b/test/466-get-live-vreg/get_live_vreg_jni.cc
@@ -32,7 +32,7 @@
   TestVisitor(Thread* thread, Context* context) REQUIRES_SHARED(Locks::mutator_lock_)
       : StackVisitor(thread, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
diff --git a/test/543-env-long-ref/env_long_ref.cc b/test/543-env-long-ref/env_long_ref.cc
index ce5602f..165f5bf 100644
--- a/test/543-env-long-ref/env_long_ref.cc
+++ b/test/543-env-long-ref/env_long_ref.cc
@@ -34,7 +34,7 @@
         found_(false),
         soa_(soa) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
diff --git a/test/570-checker-osr/osr.cc b/test/570-checker-osr/osr.cc
index faec3c3..7b88842 100644
--- a/test/570-checker-osr/osr.cc
+++ b/test/570-checker-osr/osr.cc
@@ -35,7 +35,7 @@
         in_osr_method_(false),
         in_interpreter_(false) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
@@ -95,7 +95,7 @@
       : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
         method_name_(method_name) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
@@ -129,7 +129,7 @@
       : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
         method_name_(method_name) {}
 
-  bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
+  bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
     ArtMethod* m = GetMethod();
     std::string m_name(m->GetName());
 
diff --git a/test/980-redefine-object/redef_object.cc b/test/980-redefine-object/redef_object.cc
index b4d82ad..a8393dc 100644
--- a/test/980-redefine-object/redef_object.cc
+++ b/test/980-redefine-object/redef_object.cc
@@ -80,13 +80,13 @@
    public:
     explicit JvmtiAllocator(jvmtiEnv* jvmti) : jvmti_(jvmti) {}
 
-    void* Allocate(size_t size) {
+    void* Allocate(size_t size) override {
       unsigned char* res = nullptr;
       jvmti_->Allocate(size, &res);
       return res;
     }
 
-    void Free(void* ptr) {
+    void Free(void* ptr) override {
       jvmti_->Deallocate(reinterpret_cast<unsigned char*>(ptr));
     }
 
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 05c9aa9..768bc79 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -697,9 +697,14 @@
         "description": ["Tests that depend on input-vdex are not supported with compact dex"]
     },
     {
-        "tests": ["661-oat-writer-layout", "004-StackWalk"],
+        "tests": ["661-oat-writer-layout"],
         "variant": "interp-ac | interpreter | jit | no-prebuild | no-image | trace | redefine-stress | jvmti-stress",
-        "description": ["Tests are designed to only check --optimizing"]
+        "description": ["Test is designed to only check --optimizing"]
+    },
+    {
+        "tests": ["004-StackWalk"],
+        "variant": "interp-ac | interpreter | jit | no-prebuild | no-image | trace | redefine-stress | jvmti-stress | debuggable",
+        "description": ["Test is designed to only check --optimizing"]
     },
     {
         "tests": "674-HelloWorld-Dm",
diff --git a/test/ti-stress/stress.cc b/test/ti-stress/stress.cc
index bd320c6..e123e9f 100644
--- a/test/ti-stress/stress.cc
+++ b/test/ti-stress/stress.cc
@@ -92,7 +92,7 @@
 
   struct Allocator : public dex::Writer::Allocator {
     explicit Allocator(jvmtiEnv* jvmti_env) : jvmti_env_(jvmti_env) {}
-    virtual void* Allocate(size_t size) {
+    void* Allocate(size_t size) override {
       unsigned char* out = nullptr;
       if (JVMTI_ERROR_NONE != jvmti_env_->Allocate(size, &out)) {
         return nullptr;
@@ -100,7 +100,7 @@
         return out;
       }
     }
-    virtual void Free(void* ptr) {
+    void Free(void* ptr) override {
       jvmti_env_->Deallocate(reinterpret_cast<unsigned char*>(ptr));
     }
    private:
diff --git a/tools/amm/Android.bp b/tools/amm/Android.bp
new file mode 100644
index 0000000..e6f6ff7
--- /dev/null
+++ b/tools/amm/Android.bp
@@ -0,0 +1,25 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// --- ammtestjni.so -------------
+
+cc_library_shared {
+    name: "libammtestjni",
+
+    srcs: [
+        "AmmTest/jni/ammtest.c",
+    ],
+
+    sdk_version: "current",
+}
diff --git a/tools/amm/Android.mk b/tools/amm/Android.mk
index 47030c5..fa4ca44 100644
--- a/tools/amm/Android.mk
+++ b/tools/amm/Android.mk
@@ -14,13 +14,6 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# --- ammtestjni.so -------------
-include $(CLEAR_VARS)
-LOCAL_MODULE := libammtestjni
-LOCAL_SRC_FILES := $(call all-c-files-under, AmmTest/jni)
-LOCAL_SDK_VERSION := current
-include $(BUILD_SHARED_LIBRARY)
-
 # --- AmmTest.apk --------------
 include $(CLEAR_VARS)
 LOCAL_PACKAGE_NAME := AmmTest
@@ -31,4 +24,3 @@
 LOCAL_JAVA_RESOURCE_FILES := $(LOCAL_PATH)/AmmTest/aahat.png
 LOCAL_MANIFEST_FILE := AmmTest/AndroidManifest.xml
 include $(BUILD_PACKAGE)
-
diff --git a/tools/art_verifier/art_verifier.cc b/tools/art_verifier/art_verifier.cc
index 8f412bf..45c1a33 100644
--- a/tools/art_verifier/art_verifier.cc
+++ b/tools/art_verifier/art_verifier.cc
@@ -137,7 +137,7 @@
     return kParseOk;
   }
 
-  virtual std::string GetUsage() const {
+  std::string GetUsage() const override {
     std::string usage;
 
     usage +=
diff --git a/tools/class2greylist/src/com/android/class2greylist/Class2Greylist.java b/tools/class2greylist/src/com/android/class2greylist/Class2Greylist.java
index 9262076..53157a3 100644
--- a/tools/class2greylist/src/com/android/class2greylist/Class2Greylist.java
+++ b/tools/class2greylist/src/com/android/class2greylist/Class2Greylist.java
@@ -33,10 +33,12 @@
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.Charset;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -71,9 +73,10 @@
                 .hasArgs()
                 .withDescription(
                         "Specify file to write greylist to. Can be specified multiple times. " +
-                        "Format is either just a filename, or \"int:filename\". If an integer is " +
-                        "given, members with a matching maxTargetSdk are written to the file; if " +
-                        "no integer is given, members with no maxTargetSdk are written.")
+                        "Format is either just a filename, or \"int[,int,...]:filename\". If " +
+                        "integers are given, members with matching maxTargetSdk values are " +
+                        "written to the file; if no integer or \"none\" is given, members with " +
+                        "no maxTargetSdk are written.")
                 .create("g"));
         options.addOption(OptionBuilder
                 .withLongOpt("write-whitelist")
@@ -204,15 +207,22 @@
     static Map<Integer, String> readGreylistMap(Status status, String[] argValues) {
         Map<Integer, String> map = new HashMap<>();
         for (String sdkFile : argValues) {
-            Integer maxTargetSdk = null;
+            List<Integer> maxTargetSdks = new ArrayList<>();
             String filename;
             int colonPos = sdkFile.indexOf(':');
             if (colonPos != -1) {
-                try {
-                    maxTargetSdk = Integer.valueOf(sdkFile.substring(0, colonPos));
-                } catch (NumberFormatException nfe) {
-                    status.error("Not a valid integer: %s from argument value '%s'",
-                            sdkFile.substring(0, colonPos), sdkFile);
+                String[] targets = sdkFile.substring(0, colonPos).split(",");
+                for (String target : targets) {
+                    if ("none".equals(target)) {
+                        maxTargetSdks.add(null);
+                    } else {
+                        try {
+                            maxTargetSdks.add(Integer.valueOf(target));
+                        } catch (NumberFormatException nfe) {
+                            status.error("Not a valid integer: %s from argument value '%s'",
+                                    sdkFile.substring(0, colonPos), sdkFile);
+                        }
+                    }
                 }
                 filename = sdkFile.substring(colonPos + 1);
                 if (filename.length() == 0) {
@@ -220,13 +230,16 @@
                             filename, sdkFile);
                 }
             } else {
-                maxTargetSdk = null;
+                maxTargetSdks.add(null);
                 filename = sdkFile;
             }
-            if (map.containsKey(maxTargetSdk)) {
-                status.error("Multiple output files for maxTargetSdk %s", maxTargetSdk);
-            } else {
-                map.put(maxTargetSdk, filename);
+            for (Integer maxTargetSdk : maxTargetSdks) {
+                if (map.containsKey(maxTargetSdk)) {
+                    status.error("Multiple output files for maxTargetSdk %s",
+                            maxTargetSdk == null ? "none" : maxTargetSdk);
+                } else {
+                    map.put(maxTargetSdk, filename);
+                }
             }
         }
         return map;
diff --git a/tools/class2greylist/src/com/android/class2greylist/FileWritingGreylistConsumer.java b/tools/class2greylist/src/com/android/class2greylist/FileWritingGreylistConsumer.java
index 9f33467..bfd2310 100644
--- a/tools/class2greylist/src/com/android/class2greylist/FileWritingGreylistConsumer.java
+++ b/tools/class2greylist/src/com/android/class2greylist/FileWritingGreylistConsumer.java
@@ -1,5 +1,7 @@
 package com.android.class2greylist;
 
+import com.google.common.annotations.VisibleForTesting;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -20,11 +22,16 @@
         return new PrintStream(new FileOutputStream(new File(filename)));
     }
 
-    private static Map<Integer, PrintStream> openFiles(
+    @VisibleForTesting
+    public static Map<Integer, PrintStream> openFiles(
             Map<Integer, String> filenames) throws FileNotFoundException {
+        Map<String, PrintStream> streamsByName = new HashMap<>();
         Map<Integer, PrintStream> streams = new HashMap<>();
         for (Map.Entry<Integer, String> entry : filenames.entrySet()) {
-            streams.put(entry.getKey(), openFile(entry.getValue()));
+            if (!streamsByName.containsKey(entry.getValue())) {
+                streamsByName.put(entry.getValue(), openFile(entry.getValue()));
+            }
+            streams.put(entry.getKey(), streamsByName.get(entry.getValue()));
         }
         return streams;
     }
diff --git a/tools/class2greylist/test/src/com/android/class2greylist/Class2GreylistTest.java b/tools/class2greylist/test/src/com/android/class2greylist/Class2GreylistTest.java
index cb75dd3..b87a5b1 100644
--- a/tools/class2greylist/test/src/com/android/class2greylist/Class2GreylistTest.java
+++ b/tools/class2greylist/test/src/com/android/class2greylist/Class2GreylistTest.java
@@ -56,6 +56,31 @@
     }
 
     @Test
+    public void testReadGreylistMapNone() throws IOException {
+        Map<Integer, String> map = Class2Greylist.readGreylistMap(mStatus,
+                new String[]{"none:noApi"});
+        verifyZeroInteractions(mStatus);
+        assertThat(map).containsExactly(null, "noApi");
+    }
+
+    @Test
+    public void testReadGreylistMapMulti() throws IOException {
+        Map<Integer, String> map = Class2Greylist.readGreylistMap(mStatus,
+                new String[]{"1,none:noOr1Api", "3:apiThree"});
+        verifyZeroInteractions(mStatus);
+        assertThat(map).containsExactly(null, "noOr1Api", 1, "noOr1Api", 3, "apiThree");
+    }
+
+    @Test
+    public void testReadGreylistMapMulti2() throws IOException {
+        Map<Integer, String> map = Class2Greylist.readGreylistMap(mStatus,
+                new String[]{"1,none,2,3,4:allApi"});
+        verifyZeroInteractions(mStatus);
+        assertThat(map).containsExactly(
+                null, "allApi", 1, "allApi", 2, "allApi", 3, "allApi", 4, "allApi");
+    }
+
+    @Test
     public void testReadGreylistMapDuplicate() throws IOException {
         Class2Greylist.readGreylistMap(mStatus,
                 new String[]{"noApi", "1:apiOne", "1:anotherOne"});
diff --git a/tools/class2greylist/test/src/com/android/class2greylist/FileWritingGreylistConsumerTest.java b/tools/class2greylist/test/src/com/android/class2greylist/FileWritingGreylistConsumerTest.java
new file mode 100644
index 0000000..1e1b1df
--- /dev/null
+++ b/tools/class2greylist/test/src/com/android/class2greylist/FileWritingGreylistConsumerTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.class2greylist;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import com.google.common.collect.ImmutableMap;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.mockito.Mock;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+public class FileWritingGreylistConsumerTest {
+
+    @Mock
+    Status mStatus;
+    @Rule
+    public TestName mTestName = new TestName();
+    private int mFileNameSeq = 0;
+    private final List<String> mTempFiles = new ArrayList<>();
+
+    @Before
+    public void setup() throws IOException {
+        System.out.println(String.format("\n============== STARTING TEST: %s ==============\n",
+                mTestName.getMethodName()));
+        initMocks(this);
+    }
+
+    @After
+    public void removeTempFiles() {
+        for (String name : mTempFiles) {
+            new File(name).delete();
+        }
+    }
+
+    private String tempFileName() {
+        String name = String.format(Locale.US, "/tmp/test-%s-%d",
+                mTestName.getMethodName(), mFileNameSeq++);
+        mTempFiles.add(name);
+        return name;
+    }
+
+    @Test
+    public void testSimpleMap() throws FileNotFoundException {
+        Map<Integer, PrintStream> streams = FileWritingGreylistConsumer.openFiles(
+                ImmutableMap.of(1, tempFileName(), 2, tempFileName()));
+        assertThat(streams.keySet()).containsExactly(1, 2);
+        assertThat(streams.get(1)).isNotNull();
+        assertThat(streams.get(2)).isNotNull();
+        assertThat(streams.get(2)).isNotSameAs(streams.get(1));
+    }
+
+    @Test
+    public void testCommonMappings() throws FileNotFoundException {
+        String name = tempFileName();
+        Map<Integer, PrintStream> streams = FileWritingGreylistConsumer.openFiles(
+                ImmutableMap.of(1, name, 2, name));
+        assertThat(streams.keySet()).containsExactly(1, 2);
+        assertThat(streams.get(1)).isNotNull();
+        assertThat(streams.get(2)).isSameAs(streams.get(1));
+    }
+}
diff --git a/tools/field-null-percent/check-null-fields.py b/tools/field-null-percent/check-null-fields.py
new file mode 100755
index 0000000..c11d51a
--- /dev/null
+++ b/tools/field-null-percent/check-null-fields.py
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Retrieves the counts of how many objects have a particular field null on all running processes.
+
+Prints a json map from pid -> (log-tag, field-name, null-count, total-count).
+"""
+
+
+import adb
+import argparse
+import concurrent.futures
+import itertools
+import json
+import logging
+import os
+import os.path
+import signal
+import subprocess
+import time
+
+def main():
+  parser = argparse.ArgumentParser(description="Get counts of null fields from a device.")
+  parser.add_argument("-S", "--serial", metavar="SERIAL", type=str,
+                      required=False,
+                      default=os.environ.get("ANDROID_SERIAL", None),
+                      help="Android serial to use. Defaults to ANDROID_SERIAL")
+  parser.add_argument("-p", "--pid", required=False,
+                      default=[], action="append",
+                      help="Specific pids to check. By default checks all running dalvik processes")
+  has_out = "OUT" in os.environ
+  def_32 = os.path.join(os.environ.get("OUT", ""), "system", "lib", "libfieldnull.so")
+  def_64 = os.path.join(os.environ.get("OUT", ""), "system", "lib64", "libfieldnull.so")
+  has_32 = has_out and os.path.exists(def_32)
+  has_64 = has_out and os.path.exists(def_64)
+  def pushable_lib(name):
+    if os.path.isfile(name):
+      return name
+    else:
+      raise argparse.ArgumentTypeError(name + " is not a file!")
+  parser.add_argument('--lib32', type=pushable_lib,
+                      required=not has_32,
+                      action='store',
+                      default=def_32,
+                      help="Location of 32 bit agent to push")
+  parser.add_argument('--lib64', type=pushable_lib,
+                      required=not has_64,
+                      action='store',
+                      default=def_64 if has_64 else None,
+                      help="Location of 64 bit agent to push")
+  parser.add_argument("fields", nargs="+",
+                      help="fields to check")
+
+  out = parser.parse_args()
+
+  device = adb.device.get_device(out.serial)
+  print("getting root")
+  device.root()
+
+  print("Disabling selinux")
+  device.shell("setenforce 0".split())
+
+  print("Pushing libraries")
+  lib32 = device.shell("mktemp".split())[0].strip()
+  lib64 = device.shell("mktemp".split())[0].strip()
+
+  print(out.lib32 + " -> " + lib32)
+  device.push(out.lib32, lib32)
+
+  print(out.lib64 + " -> " + lib64)
+  device.push(out.lib64, lib64)
+
+  cmd32 = "'{}={}'".format(lib32, ','.join(out.fields))
+  cmd64 = "'{}={}'".format(lib64, ','.join(out.fields))
+
+  if len(out.pid) == 0:
+    print("Getting jdwp pids")
+    new_env = dict(os.environ)
+    new_env["ANDROID_SERIAL"] = device.serial
+    p = subprocess.Popen([device.adb_path, "jdwp"], env=new_env, stdout=subprocess.PIPE)
+    # ADB jdwp doesn't ever exit so just kill it after 1 second to get a list of pids.
+    with concurrent.futures.ProcessPoolExecutor() as ppe:
+      ppe.submit(kill_it, p.pid).result()
+    out.pid = p.communicate()[0].strip().split()
+    p.wait()
+    print(out.pid)
+  print("Clearing logcat")
+  device.shell("logcat -c".split())
+  final = {}
+  print("Getting info from every process dumped to logcat")
+  for p in out.pid:
+    res = check_single_process(p, device, cmd32, cmd64);
+    if res is not None:
+      final[p] = res
+  device.shell('rm {}'.format(lib32).split())
+  device.shell('rm {}'.format(lib64).split())
+  print(json.dumps(final, indent=2))
+
+def kill_it(p):
+  time.sleep(1)
+  os.kill(p, signal.SIGINT)
+
+def check_single_process(pid, device, bit32, bit64):
+  try:
+    # Just try attaching both 32 and 64 bit. Wrong one will fail silently.
+    device.shell(['am', 'attach-agent', str(pid), bit32])
+    device.shell(['am', 'attach-agent', str(pid), bit64])
+    time.sleep(0.5)
+    device.shell('kill -3 {}'.format(pid).split())
+    time.sleep(0.5)
+    out = []
+    all_fields = []
+    lc_cmd = "logcat -d -b main --pid={} -e '^\\t.*\\t[0-9]*\\t[0-9]*$'".format(pid).split(' ')
+    for l in device.shell(lc_cmd)[0].strip().split('\n'):
+      # first 4 are just date and other useless data.
+      data = l.strip().split()[5:]
+      if len(data) < 4:
+        continue
+      # If we run multiple times many copies of the agent will be attached. Just choose one of any
+      # copies for each field.
+      field = data[1]
+      if field not in all_fields:
+        out.append((str(data[0]), str(data[1]), int(data[2]), int(data[3])))
+        all_fields.append(field)
+    if len(out) != 0:
+      print("pid: " + pid + " -> " + str(out))
+      return out
+    else:
+      return None
+  except adb.device.ShellError as e:
+    print("failed on pid " + repr(pid) + " because " + repr(e))
+    return None
+
+if __name__ == '__main__':
+  main()
diff --git a/tools/titrace/instruction_decoder.cc b/tools/titrace/instruction_decoder.cc
index d8fb713..7f8b296 100644
--- a/tools/titrace/instruction_decoder.cc
+++ b/tools/titrace/instruction_decoder.cc
@@ -32,7 +32,7 @@
     return Bytecode::ToString(op);
   }
 
-  virtual size_t LocationToOffset(size_t j_location) {
+  size_t LocationToOffset(size_t j_location) override {
     return j_location;
   }
 
@@ -474,7 +474,7 @@
     return Bytecode::ToString(op);
   }
 
-  virtual size_t LocationToOffset(size_t j_location) {
+  size_t LocationToOffset(size_t j_location) override {
     // dex pc is uint16_t*, but offset needs to be in bytes.
     return j_location * (sizeof(uint16_t) / sizeof(uint8_t));
   }