Inherit java.lang.ref-ness from superclasses.

Otherwise the GC doesn't know to treat you specially.

Also sweep system weaks. (Though sweeping the monitors is still unimplemented.)

Change-Id: Ia89b58fd36dfd5c6c7dca70d432ddc838ca37ac5
diff --git a/src/class_linker.cc b/src/class_linker.cc
index f6cf291..b6d2357 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1927,6 +1927,12 @@
     klass->SetFinalizable();
   }
 
+  // Inherit reference flags (if any) from the superclass.
+  int reference_flags = (super->GetAccessFlags() & kAccReferenceFlagsMask);
+  if (reference_flags != 0) {
+    klass->SetAccessFlags(klass->GetAccessFlags() | reference_flags);
+  }
+
 #ifndef NDEBUG
   // Ensure super classes are fully resolved prior to resolving fields..
   while (super != NULL) {