Merge change 9159 into donut

* changes:
  check for null native objects, which never happens on a real subclass (we throw in that case) but can happen because we allow the callers to create the base class from java.