VM_Type type = getType().peekResolvedType(); if (type == null) throw new IllegalArgumentException(); ok = ((type == actualType) || (type == VM_Type.JavaLangObjectType) || VM_Runtime.isAssignableWith(type, actualType)); if (!ok) throw new IllegalArgumentException();
try { VM_Type type = getType().resolve(); ok = ((type == actualType) || (type == VM_Type.JavaLangObjectType) || VM_Runtime.isAssignableWith(type, actualType)); } catch (ClassNotFoundException e) { ok = false; } if (!ok) throw new IllegalArgumentException("cannot assign " + ref + " to " + this + " of " + obj);
  public final void setObjectValue(Object obj, Object ref) throws IllegalArgumentException {    if (ref != null ) {      VM_Type actualType = VM_Magic.getObjectType(ref);      boolean ok = false;      VM_Type type = getType().peekResolvedType();      if (type == null) throw new IllegalArgumentException();      ok = ((type == actualType) ||	    (type == VM_Type.JavaLangObjectType) ||	    VM_Runtime.isAssignableWith(type, actualType));      if (!ok) throw new IllegalArgumentException();    }    if (isStatic()) {      if (VM_Interface.NEEDS_WRITE_BARRIER) {	VM_Interface.putstaticWriteBarrier(offset, ref);      }      VM_Statics.setSlotContents(offset>>>2, ref);    } else {      if (obj == null)	throw new NullPointerException();      if (!getDeclaringClass().getClassForType().isInstance(obj))	throw new IllegalArgumentException();      if (VM_Interface.NEEDS_WRITE_BARRIER) {	VM_Interface.putfieldWriteBarrier(obj, offset, ref);      }      VM_Magic.setObjectAtOffset(obj, offset, ref);    }  }