Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`SWT_AWT.initFrame` takes `(long, String)` in Java; the GTK native declares no `className` and the Cocoa native types it `const char *`

Abierto Apto para principiantes
#3,665 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@GreenFuze ya está trabajando en esto.

Desde el 12/10/2026.

  • #3719 de @GreenFuze — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
88/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
c, java
Área
desktop

Línea de trabajo

Empieza por bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/library/swt_awt.c y cocoa/library/swt_awt.c, y luego compara sus declaraciones de initFrame con las declaraciones de Java y la implementación correspondiente de win32. Comprueba los puntos de llamada de GTK y Cocoa en SWT_AWT.java:171 y :161. El trabajo está terminado cuando ambas firmas nativas aceptan el parámetro className de forma coherente y no hay advertencias del compilador.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
202
Forks
206
Merge medio
14 h 7 min
PR fusionados (30 d)
103

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eclipse-platform/eclipse.platform.swt

Todos los issues de eclipse-platform/eclipse.platform.swt

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.