C#: Collection<?> / Set<?> print as non-generic ICollection, which HashSet<T>, ISet<T>, ICollection<T> do not implement

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp, java, kotlin
Lĩnh vực
devtools

Hướng nghiên cứu

Start by reading the CSharpTypeName.NON_GENERIC handling and the regression commit references in the issue. Compare how collection types are represented across method parameters, fields, and constructors, then examine the listed failures in timefold and langchain4j. Done means one consistent collection representation handles those positions and resolves the reported type errors and overload ambiguity.

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

Mô tả

bug

CSharpTypeName.NON_GENERIC prints Collection<?> and Set<?> as System.Collections.ICollection. Of C#'s generic collections only List<T> and arrays implement it; HashSet<T>, ISet<T>, ICollection<T>, IReadOnlyList<T> and JavaLinkedHashSet<T> do not, so passing them is CS1503 (timefold: ConfigUtils.isEmptyCollection, JoinerType.containsAny, AbstractSingleConstraintAssertion, ~6 errors).

Tried in 281a5a054, reverted in a8ddda9af: capturing a method's Collection<?> / Set<?> parameter as ICollection<TE> (as program types' wildcards are captured). timefold 406 -> 401, but langchain4j 155 -> 163:

  • a Collection<?> field or constructor parameter stays non-generic ICollection, and goes into no ICollection<TE> (CS0411, IsIn -> NumberComparator.containsAsBigDecimals);
  • a captured parameter passed into a constructor's non-generic ICollection is CS1503 (MetadataFilterBuilder.isIn);
  • beside an Object[] overload the generic method makes the call ambiguous (CS0121, Utils.isNullOrEmpty).

A fix has to treat all positions alike: e.g. a compatibility-library read-only view type that every collection converts to, or IEnumerable plus extension members for size/isEmpty/contains.

Ngôn ngữ chính
Java
Star
1
Fork
1
Merge trung bình
48 phút
Pull request đã merge (30 ngày)
2

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 CodeLaser/maddi

Tất cả issue của CodeLaser/maddi

Issue tương tự

Thêm issue về Java

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.