`SWT_AWT.initFrame` takes `(long, String)` in Java; the GTK native declares no `className` and the Cocoa native types it `const char *`
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 88/100
Hướng nghiên cứu
Bắt đầu với bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/library/swt_awt.c và cocoa/library/swt_awt.c, sau đó so sánh các khai báo initFrame của chúng với các khai báo Java và phần triển khai win32 tương ứng. Kiểm tra các vị trí gọi GTK và Cocoa tại SWT_AWT.java:171 và :161. Công việc hoàn tất khi cả hai chữ ký native đều nhận tham số className nhất quán và không có cảnh báo của trình biên dịch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
All three ports declare the same native:
// bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java:62
static native final Object initFrame (long handle, String className);
(cocoa SWT_AWT.java:68, win32 SWT_AWT.java:57, identical.) The win32 implementation matches
it — (JNIEnv *env, jclass that, jlong handle, jstring className). The other two do not:
// bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/library/swt_awt.c:79
JNIEXPORT jobject JNICALL Java_org_eclipse_swt_awt_SWT_1AWT_initFrame
(JNIEnv *env, jclass that, jlong handle)
// bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c:22
JNIEXPORT jobject JNICALL Java_org_eclipse_swt_awt_SWT_1AWT_initFrame
(JNIEnv *env, jclass that, jlong handle, const char *className)
The VM binds the native by its short name, which carries no argument descriptor, so javac,
the C compiler and the linker all accept both.
What it can cause
On GTK the VM passes className and the implementation does not declare it; on Cocoa the VM
passes a jstring — a JNI reference — where the implementation declares a C string. Neither
body reads className, so on the calling conventions SWT ships nothing goes wrong today: this
is a mismatch in the declarations, not an observed failure, and I am not claiming a crash. It is
worth closing because nothing in the toolchain would catch it if a body ever started using the
parameter — on Cocoa, reading it as const char * would read the reference as character data.
Called at gtk/.../SWT_AWT.java:171 and cocoa/.../SWT_AWT.java:161.
Fix
Declare jstring className in both, as the win32 port does, with (void)className; to keep the
unreferenced-parameter warning quiet. I am happy to open the PR.
- Ngôn ngữ chính
- Java
- Star
- 202
- Fork
- 206
- Merge trung bình
- 16 giờ 56 phút
- Pull request đã merge (30 ngày)
- 110
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 eclipse-platform/eclipse.platform.swt
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
eclipse-platform/eclipse.platform.swt#3546 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
eclipse-platform/eclipse.platform.swt#3428 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
eclipse-platform/eclipse.platform.swt#3336 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
eclipse-platform/eclipse.platform.swt#3718 ·
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 35/100
eclipse-platform/eclipse.platform.swt#3717 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của eclipse-platform/eclipse.platform.swt
Issue tương tự
-
Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
MinecraftForge/MinecraftForge#10902 · 1 bình luận ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
refinedmods/refinedstorage2#1421 ·
-
StepExamBenchmarkTest runs a loop and prints a timing but asserts nothingCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởjules
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
open-learning-exchange/myplanet#18199 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
wikipathways/GPML2RDF#126 ·
-
Authorization 'Artifacts' is shown under category Run instead of Job in Authorization matrixCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày