jextract/jni: Inherited protocol requirements can be renamed inconsistently when a child adds an overload
Maintainer thường phản hồi trong vòng 1 ngày
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
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend-api-design, devtools
Hướng nghiên cứu
Start by reading the jextract/jni code that generates Java interfaces, box methods, and JNI thunks for protocol requirements; the issue does not name specific files or tests. Trace how the parent and child overloads in the NamingParent/NamingChild example get their Java names, then check whether both operations dispatch to the correct Swift requirement and the child box implements the parent interface. Done means Java compilation succeeds and both overloads call the intended Swift method.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
When a child protocol adds an overload of an inherited requirement, the generated Java box can rename the inherited method based on the child's overload set. The parent Java interface still declares the method under its original name, so the child box does not implement the parent interface and Java compilation fails.
Example
public protocol NamingParent {
var id: Int64 { get }
func value(number: Int64) -> Int64
}
public protocol NamingChild: NamingParent {
var tag: Int64 { get }
func value(text: Int64) -> Int64
}
struct NamingValue: NamingChild {
var id: Int64 { 1 }
var tag: Int64 { 2 }
func value(number: Int64) -> Int64 { number + 10 }
func value(text: Int64) -> Int64 { text + 20 }
}
public func makeNamingChild() -> any NamingChild {
NamingValue()
}
Swift argument labels distinguish the two requirements, but Java cannot represent both as value(long) on the child interface.
The parent interface exposes value(number:) as value(long). However, the generated child box can emit valueNumber(long) for that inherited requirement after considering the child's overload. This does not implement the parent's value(long) method.
The inherited requirement should keep the name declared by the parent interface. For example, the generated bindings could use value(long) for value(number:) and valueText(long) for value(text:). The Java interfaces, box methods, and JNI thunks should use consistent names so that both operations dispatch to the correct Swift requirement.
Reference workaround implementation: https://github.com/qoncept/swift-java/pull/3
- Ngôn ngữ chính
- Swift
- Star
- 1.3k
- Fork
- 127
- Merge trung bình
- 1 giờ 6 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của swiftlang/swift-java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
swiftlang/swift-java#955 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
wrap-java: Optional convenience methods can fail to compile when a parameter shadows the method nameĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
swiftlang/swift-java#945 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
swiftlang/swift-java#663 · 4 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
swiftlang/swift-java#949 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
swiftlang/swift-java#948 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của swiftlang/swift-java
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
JWhite212/SignalLadder#215 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Notch: show the playing trackĐang mởenhancement mac
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
-
feat: 앱 정보에 개인정보처리방침과 고객지원 연결Có thể đã có người làm @xrpjwk8 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
DeveloperAcademy-POSTECH/2026-C6-A13-Hear-I-am#120 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add a Light view to SurfUIĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
michaelnisi/hanstholm#246 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:shell order:4 status:ready type:chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
krystianslowik/arkt#739 ·
Maintainer thường phản hồi trong vòng 1 ngày