自动拆箱有可能产生NPE 提示 bug
- Dominant language
- Kotlin
- Stars
- 30.8k
- Forks
- 8k
- PR merge metrics
- No merged PRs in 30d
Description
## Rule content
返回类型为基本数据类型【long】,return包装数据类型的对象【Long】时,自动拆箱有可能产生NPE
## Problem description
IntelliJ IDEA 2020.2.1 (Ultimate Edition) Build #IU-202.6948.69, built on August 25, 2020
Alibaba Java Coding Guidelines Plugin Version: 2.1.0

`return` 之前已经做了非空校验,为何还会提示 NPE 警告?
## Advice
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the warning with IntelliJ IDEA 2020.2.1 and Alibaba Java Coding Guidelines Plugin 2.1.0, using a method that returns long, returns a Long, and performs a non-null check first. Trace the rule that reports the possible NPE and verify that the warning is no longer produced when the check makes unboxing safe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100