Why can't the compiler/JVM just make autoboxing “just work”?

前端 未结 6 1438
广开言路
广开言路 2020-12-31 07:40

Autoboxing is rather scary. While I fully understand the difference between == and .equals I can\'t but help have the follow bug the hell out of m

6条回答
  •  滥情空心
    2020-12-31 08:26

    Can you imagine how bad performance would be if every Integer carried overhead for internment? Also does not work for new Integer.

    The Java language (not a JVM issue) cannot always auto unbox because code designed for pre-1.5 Java should still work.

提交回复
热议问题