Replace the nullable annotations with guava's Optional class.
还没有人认领这个 Issue。
评估
调研方向
从 com.sk89q.intake.argument.Namespace 开始,结合链接的 Guava Optional 文档检查其 get(Object) 和 get(Class) 方法。在项目中搜索 nullable 注解,并确定哪些 API 需要替换;当 nullable 注解已一致地替换为使用 Optional,且受影响的行为仍由现有测试覆盖时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
What's the point of Guava's Optional class?
Probably the single biggest disadvantage of null is that it's not obvious what it should mean in any given context: it doesn't have an illustrative name. It's not always obvious that null means "no value for this parameter" -- heck, as a return value, sometimes it means "error", or even "success" (!!), or simply "the correct answer is nothing". Optional is frequently the concept you actually mean when you make a variable nullable, but not always.
more: http://stackoverflow.com/questions/9561295/whats-the-point-of-guavas-optional-class
Optional class: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Optional.html
Example in com.sk89q.intake.argument.Namespace
/**
* Returns the value specified by the given key.
*
* @param key The key
* @return The value, which may be null, including when the key doesn't exist
*/
public Optional<Object> get(Object key) {
if (!locals.containsKey(key)) Optional.absent();
return Optional.of(locals.get(key));
}
/**
* Get an object whose key will be the object's class.
*
* @param key The key
* @param <T> The type of object
* @return The value
*/
@SuppressWarnings("unchecked")
public <T> Optional<T> get(Class<T> key) {
if (!locals.containsKey(key)) Optional.absent();
return Optional.of((T)locals.get(key));
}
- 主要语言
- Java
- 星标
- 102
- 派生
- 18
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
EngineHub/Intake 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 5/5 一周以上 新手友好度 25/100
相似的 Issue
-
certification
难度 1/5 1 小时以内 新手友好度 80/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's 未关闭bug ecr
难度 2/5 1-3 小时 新手友好度 75/100
-
Needs: Triage Type: Feature request
难度 2/5 1-3 小时 新手友好度 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 65/100
github/copilot-sdk#2760 ·