`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分
- マージ済み PR(30日)
- 110
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
agent-java community triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
elastic/apm-agent-java#4594 ·
メンテナーはふだん 1 日以内に返信
-
area/plugin good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
kestra-io/plugin-soda#137 ·
-
area/plugin good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
kestra-io/plugin-aws#816 ·
メンテナーはふだん 2 日以内に返信
-
area/plugin good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
kestra-io/plugin-kestra#200 ·
メンテナーはふだん 1 日以内に返信
-
bug untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
opensearch-project/search-relevance#618 ·
メンテナーはふだん 3 日以内に返信