如何Optional.orElse(null)标记为org.jetbrains.annotations.NotNull
javadocorElse明确指出允许 null
* @param other the value to be returned, if no value is present.
* May be {@code null}.
Run Code Online (Sandbox Code Playgroud)
但我的代码在 SonarQube 中标记了一个“错误”。
return users.findById(userID)
.flatMap(user -> students.findByUser(user))
.map(GetAllStudentsSvc::mapToStudent)
.orElse(null);
Run Code Online (Sandbox Code Playgroud)
看代码好像没有标注。查看IDE,它似乎也没有被标记
即使将代码注释为也@Nullable无济于事。
| 归档时间: |
|
| 查看次数: |
1385 次 |
| 最近记录: |