Consider using all-args constructor automatically when JSpecify is enabled

Đang mở
#884 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@sjohnr đang làm issue này rồi.

Từ ngày 1/12/2025.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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 
Ngôn ngữ chính
Kotlin
Star
220
Fork
123
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
23

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Netflix/dgs-codegen

Tất cả issue của Netflix/dgs-codegen

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.