Add annotation processor (java + ksp) that can execute at compile-time

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

@solonovamax がすでに取り組んでいます。

2024年2月5日 から。

評価

この issue はまだ評価されていません。

説明

enhancement

Add an implementation of the annotation processors that can be run at compile time to parse the commands into a file format that can then be loaded at runtime. the format could, perhaps, be json.

Annotation processors implementing javax.annotation.processing.Processor and com.google.devtools.ksp.processing.SymbolProcessor would be quite beneficial, as it would anyone using the cloud annotations api to avoid having to scan the classpath to register their commands using something like reflections, and is much more convenient than having to manually list all the classes with commands.

I'm going to look into doing this myself, but for some reason gh mobile doesn't let me assign myself while creating the issue.

ways it could be done:

  • simply serialize a json array of class names to run reflection on at runtime
  • run the reflection & annotation processing (eg. interpreting the value of the @Command(String) annotation, parsing the default value (if possible), etc.) at compile time instead of runtime then serialize this as a json datastructure. the format could be smth like this (not comprehensive):
    commands:
      - class: [class name]
        root: [root command name]
        permission: [permission]
        meta: [meta stuff]
        - commands: [list of nested commands]
          method: [method name]
          name: [command name]
          permission: permission
          meta: [meta stuff]
          arguments:
            - name: [argument name]
              aliases: [aliases]
              parameterName: [name of parameter]
              parameterIndex: [index of parameter] # the index can be used when the class is compiled without parameter names
              default:
                value: [default value] # if specified
                method: [name of method] # if specified
              type: [fully qualified type]
          commands: [nested subcommands]
    
主要言語
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 を短くまとめたダイジェスト。