VM_Type valueType = VM_ObjectModel.getObjectType(value); VM_Type fieldType; try { fieldType = type.resolve(); } catch (NoClassDefFoundError e) { throw new IllegalArgumentException("field type mismatch"); } if (fieldType != valueType && !VM_Runtime.isAssignableWith(fieldType, valueType)) { throw new IllegalArgumentException("field type mismatch");
if (value != null) { VM_Type valueType = VM_ObjectModel.getObjectType(value); VM_Type fieldType; try { fieldType = type.resolve(); } catch (NoClassDefFoundError e) { throw new IllegalArgumentException("field type mismatch"); } if (fieldType != valueType && !VM_Runtime.isAssignableWith(fieldType, valueType)) { throw new IllegalArgumentException("field type mismatch"); }
  public void set(Object object, Object value)     throws IllegalAccessException, IllegalArgumentException     {    checkWriteAccess(object);    VM_TypeReference type = field.getType();    if (type.isReferenceType()) {      VM_Type valueType = VM_ObjectModel.getObjectType(value);      VM_Type fieldType;      try {	fieldType = type.resolve();      } catch (NoClassDefFoundError e) {	throw new IllegalArgumentException("field type mismatch");      }      if (fieldType != valueType 	  && !VM_Runtime.isAssignableWith(fieldType, valueType))      {	throw new IllegalArgumentException("field type mismatch");      }      field.setObjectValueUnchecked(object, value);    } else if (value instanceof Character) {      setCharInternal(object, ((Character)value).charValue());    } else if (value instanceof Double) {      setDoubleInternal(object, ((Double)value).doubleValue());    } else if (value instanceof Float) {      setFloatInternal(object, ((Float)value).floatValue());    } else if (value instanceof Long) {      setLongInternal(object, ((Long)value).longValue());    } else if (value instanceof Integer) {      setIntInternal(object, ((Integer)value).intValue());    } else if (value instanceof Short) {      setShortInternal(object, ((Short)value).shortValue());    } else if (value instanceof Byte) {      setByteInternal(object, ((Byte)value).byteValue());    } else if (value instanceof Boolean) {      setBooleanInternal(object, ((Boolean)value).booleanValue());    } else {      throw new IllegalArgumentException("field type mismatch");    }  }