Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

@Immutable annotation for value classes

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
tooling

Hướng nghiên cứu

Issue không nêu tệp nguồn hay đường dẫn kiểm thử nào; hãy bắt đầu bằng cách xem xét các định nghĩa annotation hiện có trong repository và các quy ước của chúng. Công việc được xem là hoàn tất khi thêm một annotation @Immutable tương đương với ngữ nghĩa bất biến được ghi lại bằng tài liệu và siêu dữ liệu phù hợp về kiểu, retention và tài liệu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi!

I am currently migrating a projeect from jsr305 to java-annotations. One of the annotations I can't really seem to find an equivalent for is @Immutable. A class being @Immutable should not have setters and possibly not even non-final fields.

The original implementation and documentation:

/**
 * The class to which this annotation is applied is immutable. This means that
 * its state cannot be seen to change by callers. Of necessity this means that
 * all public fields are final, and that all public final reference fields refer
 * to other immutable objects, and that methods do not publish references to any
 * internal state which is mutable by implementation even if not by design.
 * Immutable objects may still have internal mutable state for purposes of
 * performance optimization; some state variables may be lazily computed, so
 * long as they are computed from immutable state and that callers cannot tell
 * the difference.
 * <p>
 * Immutable objects are inherently thread-safe; they may be passed between
 * threads or published without synchronization.
 */
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface Immutable {
}
Ngôn ngữ chính
Kotlin
Star
464
Fork
74
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 JetBrains/java-annotations

Tất cả issue của JetBrains/java-annotations

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.