为什么自动拳击标记为警告? [英] Why auto-boxing marked as a warning?

查看:130
本文介绍了为什么自动拳击标记为警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明白,自动取消打包应该小心,因为未装箱的引用可以为空。为什么自动装箱也被标记为警告?我在这里遇到一些陷阱吗?

I understand that auto un-boxing should be done with care because the reference that is being un-boxed can be null. Why is auto-boxing marked as warning as well? Are there some pitfalls I am missing here?

推荐答案

如果您不期望性能问题(在微型优化方面)您可以安全地禁用此警告。这只是一个迹象,如果你不知道自动拳击在这里发生。在具有I / O开销(由于DB事务或光盘访问)的业务逻辑代码中,自动打包从来不是一个问题。

If you don't expect performance issues (in terms of micro-optimization) you can safely disable this warning. It is just an indication in case you're not aware that auto-boxing happends here. In business-logic code where you have I/O overhead (due to DB transactions or disc access) auto-boxing is never an issue.

这篇关于为什么自动拳击标记为警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆