Fixes for generating Evolution Data Server bindings #342

Merged
jwharm merged 23 commits from eds-fixes into main 2026-03-28 11:27:57 +01:00
Owner

Issue #341 reported that it was not possible to generate bindings for Evolution Data Server (EDS) and related libraries (ECal, Camel and others). This uncovered a number of bugs in the Java-GI bindings generator. This PR fixes most of them, and adds metadata for the remaining issues that are hard or impossible to handle in a generic way.

Some of the fixes required some refactoring of the handling of out-parameters and arrays with unclear or missing annotations. So the overall quality of all generated bindings will slightly improve as well.

Issue #341 reported that it was not possible to generate bindings for Evolution Data Server (EDS) and related libraries (ECal, Camel and others). This uncovered a number of bugs in the Java-GI bindings generator. This PR fixes most of them, and adds metadata for the remaining issues that are hard or impossible to handle in a generic way. Some of the fixes required some refactoring of the handling of out-parameters and arrays with unclear or missing annotations. So the overall quality of all generated bindings will slightly improve as well.
When a GIR file contains multiple (comma-separated) prefixes, default to
the first one.

Related to #341
When a gir file doesn't specify any includes, explicitly add GLib, to
ensure a dependency on the java-gi base module.
This is a new metadata rule that can be applied on methods that return void, but should return "this".

The rule is applied to ICalGLib.Attach.ref(), which overrides GObject.ref() but returns void. This is not allowed in Java.
- Treat typedefs (aliases) for primitive types that are annotated as out/inout, actually as out-parameters (except we still don't wrap them in an Out<>)
- Improve handling of missing annotations with new `isUnannotatedReference()` check
- Improve the `allocatesMemory()` check to be more precise (fewer false positives)
- Add missing `length` parameter for field accessor methods that read array data
- Use static imports for conciseness
- Add method to read array of aliased type
- Update the JDK version to 25
- Remove the explicit JSpecify dependency
jwharm merged commit db6baf3ad1 into main 2026-03-28 11:27:57 +01:00
Sign in to join this conversation.
No description provided.