10.1.2 - Returning values of different types from a method - Point 2 Autoboxing/Unboxing
Java allows a return value to be a reference to a wrapper class if the return type is of a primitive type of the same or smaller type.
...
The reverse is also allowed:
Status:
Fixedinbuild:
1.22
Newtext:
Java allows a return value to be a reference to a wrapper class if the return type is of a primitive type of the same or smaller type.
...
The reverse is also allowed but only when the method's return type is a wrapper of the same type as the type of the primitive value being returned -