static <A> A unstructAndCast(Class<A> c, S struct) {
  O o = unstruct(struct);
  if (o == null || isInstance(c, o))
    ret (A) o;
  throw badCastException(o, c);
}