Registering parsers with a narrower type of the sender type

オープン
#770 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java

調査の方向性

まず ParserRegistry#registerParser(ParserDescriptor)、ParserDescriptor、ArgumentParser から始め、sender-type の検証によって既存のエラーメッセージがどのように生成されるかを確認します。issue で説明されているサブタイプ固有の registry view を定義し、互換性のない sender に対する検証を維持しながら、unchecked cast なしで Player parser を登録できるようにします。その結果得られる API に対して Kotlin の例がコンパイルできることを確認します。

索引モデルが 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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Incendo/cloud のほかの issue

Incendo/cloud の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。