`OS.beginSheetModalForWindow` is declared `void` in Java and `jlong` in the entry
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- java, objective-c
- 领域
- desktop
调研方向
对照 OS.java 中的 native 声明与 os_custom.c 中的 beginSheetModalForWindow 条目,从 DirectoryDialog、FileDialog 和 MessageBox 中的 Java wrapper 调用点入手。判断预期的返回类型,使两侧保持一致,并运行相关的 SWT Cocoa 测试或构建检查,以确认 native binding 仍可使用。
由索引模型根据 Issue 内容生成。
描述
OS.java declares:
public static native void beginSheetModalForWindow(long id, long sel, long window, long handler);
and the entry in os_custom.c declares and returns a jlong:
JNIEXPORT jlong JNICALL OS_NATIVE(beginSheetModalForWindow)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2, FunctionPointer arg3)
{
jlong rc = 0;
OS_NATIVE_ENTER(env, that, beginSheetModalForWindow_FUNC);
rc = (jlong)((jlong (*)(jlong, jlong, jlong, void (^)(jlong)))objc_msgSend)(arg0, arg1, arg2, functionToBlock(arg3));
OS_NATIVE_EXIT(env, that, beginSheetModalForWindow_FUNC);
return rc;
}
The VM binds these by name and the mangled symbol carries no return type, so nothing on either side checks that they agree: javac sees only the Java declaration, the C compiler only the definition.
I have not observed any misbehaviour from this and would not expect to. On the ABIs SWT targets the callee writes a return register that a void caller ignores, and rc is unobservable from Java in any case, since DirectoryDialog, FileDialog and MessageBox all call the wrapper as a statement. So this is a JNI signature mismatch rather than a wrong value.
It seems worth mentioning because it looks unintentional and it is isolated: comparing every native declaration in the tree against the return type its own entry declares, this is the only pair that disagrees, out of 3110 comparable pairs at one commit I checked and 2957 at another.
The fix is presumably to declare the entry void and drop rc, unless the value is meant to reach Java, in which case the Java declaration is the side to change.
Checked against master at 3e3b24b4. Found as part of a research project.
- 主要语言
- Java
- 星标
- 202
- 派生
- 206
- 平均合并
- 1 天 12 小时
- 30 天内合并 PR
- 115
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
eclipse-platform/eclipse.platform.swt 的其他 Issue
-
[Win32] Table tooltip indexes cell font with subitem -1可能已有人在做 @fdesbiens 于 13 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
eclipse-platform/eclipse.platform.swt#3752 ·
维护者通常 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 天内回复
-
HiDPI Windows
难度 3/5 1-2 天 新手友好度 54/100
eclipse-platform/eclipse.platform.swt#3777 · 1 条评论 ·
维护者通常 1 天内回复
-
bug junit
难度 3/5 1-2 天 新手友好度 55/100
eclipse-platform/eclipse.platform.swt#3762 ·
维护者通常 1 天内回复
查看 eclipse-platform/eclipse.platform.swt 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复
-
A proxy that fails to start logs a RejectedExecutionException stack trace from its shutdown hook未关闭follow-up
难度 2/5 1-3 小时 新手友好度 62/100
Sanne/incus-spawn#1953 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 66/100
Shweit/EtherealPortals#30 ·
-
难度 1/5 1 小时以内 新手友好度 70/100
checkstyle/checkstyle#22398 · 1 条评论 ·
维护者通常 1 天内回复
-
Typo in jakartaee-bom 12.0.0-SNAPSHOT with cdi可能已有人在做 @ElectLive 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 80/100
jakartaee/jakartaee-api#205 · 1 条评论 ·