Consider using all-args constructor automatically when JSpecify is enabled

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

メンテナーはふだん 1 日以内に返信

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

2025年12月1日 から。

評価

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

説明

enhancement

It would be nice to omit the default no-arg constructor and use the all-args constructor when JSpecify annotations are generated (see gh-866). This would allow linting and static analysis tools to consider the generated types fully null-safe with no warnings.

Context:

By default, a no-arg constructor is generated for all Java types. Currently, this constructor is generated as private when generating JSpecify annotations on Java types. The all-args constructor is still optional and the no-arg constructor is used in the generated builder's build() method. Static analysis and linting tools cannot see that the no-arg constructor is private, the builder's build() method validates fields, and the all-args constructor is null-safe. This issue is flagged by IntelliJ code intentions with the following message on fields of the generated type:

@NullMarked fields must be initialized 
主要言語
Kotlin
スター
220
フォーク
123
平均マージ
1日 6時間
マージ済み PR(30日)
23

環境構築

はじめの一歩

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

Netflix/dgs-codegen のほかの issue

Netflix/dgs-codegen の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

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

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