alibaba / alibaba/Alibaba-Java-Coding-Guidelines

Question for using wrapper class at POJO

未关闭
#16 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
没有语言数据
星标
1.1k
派生
246
PR 合并指标
30 天内没有已合并 PR

描述

Sorry, I don't know where is a suitable place to discuss the question, so I just open an issue here to ask my question.

I have a question about the 8th point of [OOP rules](https://github.com/alibaba/Alibaba-Java-Coding-Guidelines#oop-rules).
> 8. [Mandatory] Rules for using primitive data types and wrapper classes:
  1) Members of a POJO class must be wrapper classes.
  2) The return value and arguments of a RPC method must be wrapper classes.
  3) [Recommended] Local variables should be primitive data types.

Based on this rule, it will only allow us to use the primitive type in local variables. Then, we need to use wrapper classes in all other places.

The thing is that most of the suggestions I saw at the Internet is we should avoid wrapper classes as much as possible.
The reasons are
- performance
- memory footprint

So could anybody explain the reason behind this rule? Thanks. 🙏

贡献指南

这个仓库没有索引到贡献指南

调研方向

从链接的 OOP 规则开始,尤其是规则 8 及其关于 primitive 类型和 wrapper 类型的指导。一个有用的成果是得到 maintainer 批准的规则解释或澄清,但 issue 没有指出要更新的文档文件或测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
documentation
Issue 类型
文档
难度
1/5
预计耗时
1 小时以内
活跃度
停滞
描述清晰度
需要澄清
新手友好度
20/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。