Exclude broken bindings for GLib functions #365

Merged
jwharm merged 1 commit from glib-metadata into main 2026-05-15 21:57:33 +02:00
Owner

GLib offers a lot of C convenience functionality that is included in the GIR file, but is broken or unusable from Java. This PR adds metadata to exclude all broken/unusable functions that I'm aware of:

  • g_atomic_int (raw pointers)
  • atomic_rc_box_release_full and rc_box_release_full (DestroyNotify parameter is unusable)
  • atomic_ref_count and ref_count (unusable, broken)
  • base64_decode_step (useless: re-allocates the buffers on every call)
  • base64_encode_step and base64_encode_close (the out-buffer is leaked and is not read)
  • clear_list and clear_slist (raw MemorySegment element-type, and will cause a double-free)
  • keyed data lists (GData and Dataset) (very hard to use from bindings)
  • idle_remove_by_data (unusable)
  • intern_static_string (broken)
  • quark_from_static_string (broken)
  • the refcount type (broken)
  • all ref_string functions (broken)
  • return_if_fail_warning and warn_message (macro related)
  • all slice functions (deprecated in GLib)
  • several C string-related functions such as snprintf, strup, strdup (broken)
  • spawn_check_exit_status (deprecated in GLib)
  • unicode_canonical_decomposition (deprecated in GLib, and broken)
  • all utf8 functions (there are probably better ways to do this in Java directly)
  • utime (broken)
  • win32_get_system_data_dirs_for_module (broken)
  • Everything related to the GLib test functionality (currently broken)

Excluding these functions is technically an API change, but the Java bindings for almost all of these were broken or unusable in various ways.

There are still many GLib functions in the Java bindings that should not be used, because there are better ways to do the same thing in Java itself, but I don't want to add more manual overrides than necessary, so I tried to only remove things for which the bindings do not work or should really not be used.

GLib offers a lot of C convenience functionality that is included in the GIR file, but is broken or unusable from Java. This PR adds metadata to exclude all broken/unusable functions that I'm aware of: - `g_atomic_int` (raw pointers) - `atomic_rc_box_release_full` and `rc_box_release_full` (DestroyNotify parameter is unusable) - `atomic_ref_count` and `ref_count` (unusable, broken) - `base64_decode_step` (useless: re-allocates the buffers on every call) - `base64_encode_step` and `base64_encode_close` (the out-buffer is leaked and is not read) - `clear_list` and `clear_slist` (raw MemorySegment element-type, and will cause a double-free) - keyed data lists (`GData` and `Dataset`) (very hard to use from bindings) - `idle_remove_by_data` (unusable) - `intern_static_string` (broken) - `quark_from_static_string` (broken) - the `refcount` type (broken) - all `ref_string` functions (broken) - `return_if_fail_warning` and `warn_message` (macro related) - all `slice` functions (deprecated in GLib) - several C string-related functions such as `snprintf`, `strup`, `strdup` (broken) - `spawn_check_exit_status` (deprecated in GLib) - `unicode_canonical_decomposition` (deprecated in GLib, and broken) - all `utf8` functions (there are probably better ways to do this in Java directly) - `utime` (broken) - `win32_get_system_data_dirs_for_module` (broken) - Everything related to the GLib test functionality (currently broken) Excluding these functions is technically an API change, but the Java bindings for almost all of these were broken or unusable in various ways. There are still many GLib functions in the Java bindings that should not be used, because there are better ways to do the same thing in Java itself, but I don't want to add more manual overrides than necessary, so I tried to only remove things for which the bindings do not work or should really not be used.
jwharm merged commit 02bbb6ee44 into main 2026-05-15 21:57:33 +02:00
jwharm deleted branch glib-metadata 2026-05-15 21:57:35 +02:00
Sign in to join this conversation.
No description provided.