Registering parsers with a narrower type of the sender type
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
从 ParserRegistry#registerParser(ParserDescriptor)、ParserDescriptor 和 ArgumentParser 开始,然后检查 sender-type 验证如何生成现有的错误消息。定义 issue 中描述的特定子类型 registry view,使 Player parser 可以在不使用 unchecked cast 的情况下注册,同时保留对不兼容 sender 的验证;确认 Kotlin 示例能够针对生成的 API 编译通过。
由索引模型根据 Issue 内容生成。
描述
Making a custom parser that accepts a subtype of your sender type (in my case org.bukkit.entity.Player of org.bukkit.command.CommandSender) is very useful as to automatically utilize existing error infrastructure (specifically the TerminalConsoleCommandSender is not allowed to execute that command. Must be of type Player message).
Currently, the existing ParserRegistry#registerParser(ParserDescriptor) method does not allow type narrowing and requires an unchecked cast to allow it to compile.
Example in Kotlin:
manager.parserRegistry().registerParser(ParserDescriptor.of(MineParser() as ArgumentParser<CommandSender, Mine>, Mine::class.java))
I was told by @jpenilla that there could be a method added that gives a view of the parser registry for subtypes specifically, so that this can be validated correctly. Here is the Discord message where this was mentioned.
- 主要语言
- Java
- 星标
- 546
- 派生
- 61
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Incendo/cloud 的其他 Issue
-
难度 2/5 半天 新手友好度 76/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 50/100
-
难度 4/5 3-5 天 新手友好度 30/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 92/100
erkamyaman/rust-anything#963 ·
维护者通常 1 天内回复
-
Deferred
难度 2/5 1-3 小时 新手友好度 78/100
Sanne/incus-spawn#2768 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
[BUG] Spring SDK returns null for successful plain-text String responses可能已有人在做 @Chrisp12138 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复