Class Overview | Class Members | This Package | All Packages
The operation proceeds as follows:
If the underlying field is static, the object argument is ignored; it may be null.
Otherwise the underlying field is an instance field. If the specified object argument is null, the method throws a NullPointerException. If the specified object argument is not an instance of the class or interface declaring the underlying field, the method throws an IllegalArgumentException.
If this Field object enforces Java language access control, and the underlying field is inaccessible, the method throws an IllegalAccessException.
If the underlying field is final, the method throws an IllegalAccessException.
If the underlying field is of a primitive type, an unwrapping conversion is attempted to convert the new value to a value of a primitive type. If this attempt fails, the method throws an IllegalArgumentException.
If, after possible unwrapping, the new value cannot be converted to the type of the underlying field by an identity or widening conversion, the method throws an IllegalArgumentException.
The field is set to the possibly unwrapped and widened new value.