Yes, autoboxing is done with valueOf
everywhere to take advantage of any caches. For example with Character
:
public static Character valueOf(char c) {
if (c <= 127) { // must cache
return CharacterCache.cache[(int)c];
}
return new Character(c);
}
It's a documentation oversight.