`SWT_AWT.initFrame` takes `(long, String)` in Java; the GTK native declares no `className` and the Cocoa native types it `const char *`
维护者通常 1 天内回复
评估
调研方向
从 bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/library/swt_awt.c 和 cocoa/library/swt_awt.c 开始,然后将其中的 initFrame 声明与 Java 声明以及对应的 win32 实现进行比较。检查 SWT_AWT.java:171 和 :161 处的 GTK 和 Cocoa 调用点。完成标准是两个本机签名都一致地接受 className 参数,且没有编译器警告。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Java
- 星标
- 202
- 派生
- 206
- 平均合并
- 16 小时 56 分钟
- 30 天内合并 PR
- 110
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
eclipse-platform/eclipse.platform.swt 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
eclipse-platform/eclipse.platform.swt#3546 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
eclipse-platform/eclipse.platform.swt#3428 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 75/100
eclipse-platform/eclipse.platform.swt#3336 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 30/100
eclipse-platform/eclipse.platform.swt#3718 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
eclipse-platform/eclipse.platform.swt#3717 ·
维护者通常 1 天内回复
查看 eclipse-platform/eclipse.platform.swt 的全部 Issue
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 62/100
devops-thiago/ThrillhouseBot#1132 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
approved bug
难度 2/5 1-3 小时 新手友好度 70/100
checkstyle/checkstyle#21981 · 1 条评论 ·
维护者通常 1 天内回复
-
Build: the CUDA backend fails without cuDNN instead of skipping the cuDNN shim (as the cuDF shim does)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
beehive-lab/TornadoVM#1248 ·
维护者通常 1 天内回复
-
good first issue help wanted ready-for-human
难度 2/5 半天 新手友好度 64/100
维护者通常 1 天内回复