Skip to content

Releases: jwharm/java-gi

0.10.2

07 Jul 19:03
Compare
Choose a tag to compare

This release contains small bugfixes and enhancements.

What's Changed

Fixes:

  • #104: Fixed loading native libraries built by MSVC (thanks @Kontiterit)
  • #105: Fixed the GitHub action to build Gtk Windows libraries (thanks @JFronny)
  • #103: Fixed handling of toggle references in async code (thanks @pontaoski)
  • #111 and #113: Fixed crash caused by incorrect ListModel ownership handling (thanks @JFronny, @SudoDios and @badcel)
  • Improved the toggle reference functionality to be faster and thread-safe
  • Fixed double ref of initially unowned (i.e. floating) objects
  • Removed an unused Cleaner action that was attached to all GObject instances

Improvements:

  • Functions in enumerations where the first parameter is the enumeration type itself, will now be available in Java as an instance method on that enumeration. For example, EventType.getFlags(EventType.TAG) has changed to EventType.TAG.getFlags().
    The applicable functions are auto-detected by the Java-GI bindings generator. The functions that have been changed in this release are listed here.
  • In the Javadoc of all signal connect methods (starting with "on...", like Button.onClicked()), a link has been added to the declaration of the signal handler method prototype. No more need to guess the expected callback parameters!
  • Error messages when registering a Java class as a new GType have been improved to log the relevant error cause.

This release is based on OpenJDK 22 and GNOME 46. The new release is available on Maven Central.

Full Changelog: 0.10.1...0.10.2

GTK Natives for 4.15.1

17 Jun 10:16
Compare
Choose a tag to compare
libraries

Add links to IDEs to website

0.10.1

01 Jun 21:30
0441999
Compare
Choose a tag to compare

This is a bugfix release.

What's Changed

  • Fixed bug #17 - Nested arrays are unsupported: Java-GI now supports functions returning String[][]
  • Fixed bug #101 - Gio Files aren't GObjects: The default superclass for interface instances (when not specified in the prerequisites) has been changed back to GObject
  • Testcases were added for string and array marshaling; this uncovered several bugs that are now fixed
  • An unnecessary null-check in the generated memory-address-constructors has been removed
  • GIR files were updated to the latest GNOME 46 versions

The new release is available on Maven Central.

Full Changelog: 0.10.0...0.10.1

0.10.0

13 May 20:26
Compare
Choose a tag to compare

What's Changed

Java-GI has now been upgraded to the latest version of the "Panama" Foreign Function & Memory API (JEP 454), that was released with OpenJDK 22. As a result, Java-GI doesn't depend on OpenJDK preview features any longer!

Additionally, the bindings were updated to the latest GNOME 46 release.

A number of other changes:

  • New Java classes were added for GList and GSList, that implement java.util.List so they are very easy to use.
  • Flag parameters have been changed from int constants to EnumSet. This means you pass flag parameters using Set.of(flag1, flag2, ...) instead of the custom or() and combined() methods that existed previously.
  • A number of fixes and improvements were applied to the Javadoc generator.
  • Method handles are now generated as final static fields, to allow inlining by the jit compiler, improving performance.
  • Native libraries are now loaded using the platform-native shared library loader (dlopen on Linux) so in many cases the Java library path doesn't need to be manually updated anymore.
  • Several bugs with memory management and caching were fixed. Thanks to @BwackNinja for the detailed reports.
  • Interface instances are now derived from TypeInstance instead of GObject (unless specified otherwise in the prerequisites).
  • The gircore/gir-files repository is now included as a git submodule.
  • The website was improved and uses a more modern theme.

Full Changelog: 0.9.2...0.10.0

0.9.2

04 May 20:19
Compare
Choose a tag to compare

This release contains a bugfix for Gtk composite template classes.
Special thanks to @EliasDevis for logging this issue.

This release is based on OpenJDK 21 and GNOME 45.

Full Changelog: 0.9.1...0.9.2

0.9.1

07 Apr 21:04
Compare
Choose a tag to compare

This release is still based on OpenJDK 21 and GNOME 45. It contains bugfixes and a number of improvements.

Special thanks go to @pontaoski and @Tennessene for logging issues and testing fixes.

What's Changed

Fixes:

  • Fixed image URL prefixes in generated Javadoc.
  • Fixed allocating and accessing nested record types.
  • Fixed overriding protected methods in custom GObject-derived classes.
  • Fixed issues with generating boxed types, that prevented generating bindings for spice-client-glib.
  • Gtk class CustomLayout was removed. This type is not meant to be used in language bindings.
  • Removed all "...Private" types from the generated bindings again (this was a regression in 0.9.0).

Improvements:

  • Added constructors to record types, to replace the existing allocate methods.
  • Added constructor overloads without an Arena parameter, defaulting to Arena::ofAuto.
  • Added a test method to the Bitfield base class, to test if one or more flags are set; added a better Bitfield::toString as well.
  • Alias types now have a from method to "cast" an alias from its target type.

Minor enhancements:

  • Renamed GErrorException::getGError() to ::toGError(), the old method is marked deprecated
  • Better Javadoc descriptions for packages
  • Added support for Alias<MemorySegment> parameters (like GstClockID).

Full Changelog: 0.9.0...0.9.1

Please log a GitHub issue or join java-gi:matrix.org if you encounter problems with this release.

0.9.0

28 Feb 21:18
Compare
Choose a tag to compare

This release has been built with a completely rebuilt code generator, based on JavaPoet. The output should be the same as the previous version, save for some bugfixes that were done during testing. The only API changes are:

  • Any changes to the GIR files in the gir-core repository since Java-GI 0.8.1 was released. These changes should be really minor, because the GIR files were not updated beyond the supported point-releases listed in the README.
  • the deprecated builder setter syntax has been removed
  • the deprecated struct allocate() methods that default to an "auto" allocator have been removed
  • the deprecated static factory methods with new prefixes have been removed

These removals were all announced, and explained, in the Java-GI 0.8.0 release notes.

Even though I tried to test this release as well as I could, there can be bugs/regressions compared to previous releases. Please log any issues you encounter. As a fallback, it's possible to keep using release 0.8.1.

Full Changelog: 0.8.1...0.9.0

As always, the release is available on Maven Central.

0.8.1

25 Nov 10:01
Compare
Choose a tag to compare

This is a bugfix release. In specific cases (specifically when Java-GI patches a method return type), it was impossible to chain up from a derived class to a method in a superclass. This has now been resolved. Details in PR #81.

Full Changelog: 0.8.0...0.8.1

0.8.0

19 Nov 21:31
Compare
Choose a tag to compare

This release upgrades the Java bindings to OpenJDK 21! This is an incompatible change from Java-GI 0.7.x, because the Panama FFI API changed significantly since JDK 20. The JDK 21 version (JEP 442) is the last preview version though; in JDK 22 the API will be final!

Kotlin users must upgrade to Kotlin 1.9.20 or newer if they want to use Java-GI 0.8.0, because older Kotlin releases are incompatible with JDK 21.

Notable changes:

GNOME 45

All libraries have been upgraded to the versions of the GNOME 45 SDK and Freedesktop SDK 23.08. See the README.md for the exact version numbers.

Allocate structs with an Arena

The Panama FFI in its current form heavily uses memory arenas to manage allocation lifetimes. Users can choose between different arenas, depending on your use case. Therefore, the allocate() methods generated by Java-GI for record (struct) and union types now expect an Arena as the first parameter.

Example:

try (var arena = Arena.ofConfined()) {
    var red = RGBA.allocate(arena, 1.0, 0.0, 0.0, 0.0);
    // memory is now allocated
}
// memory is now deallocated

var blue = RGBA.allocate(Arena.ofAuto(), 0.0, 0.0, 1.0, 0.0);
// memory will be deallocated when the variable is garbage collected

var green = RGBA.allocate(Arena.global(), 0.0, 1.0, 0.0, 0.0);
// memory will be allocated during the entire application runtime

Read the Arena documentation for more information.

To ease the transition, the old allocate() methods without an Arena parameter are still available. These methods use an Arena.ofAuto() behind the scenes. Dealing with native memory deallocations during GC is rather ugly, so I don't want users to think this is the default option. Therefore, these methods have been marked as deprecated, and will be removed in the next Java-GI release.

Property names will be inferred by default

In a GObject-derived class, you can define custom properties with a @Property annotation on the getter and setter methods. With Java-GI 0.8.0, the name parameter of the annotation has become optional. If you don't specify a name, it will be inferred from the getter and setter method name (converting setMyProperty to my-property).

Builder syntax has changed

The setter methods in the Builder classes now start with a set... prefix. This allows the builders to be used as Java Beans, allowing a much nicer property assignment syntax in Kotlin. The old setters are still available, but deprecated, and will be removed in the next Java-GI release.

Shorter constructor names

The new prefix in named constructors doesn't really serve a purpose in Java, and has been removed. As an example, gtk_button_new_with_label() will no longer be available as Button.newWithLabel(), but Button.withLabel(). As with the other API changes, the old syntax (Button.newWithLabel()) is still available, but deprecated, and will be removed in the next Java-GI release.

Improved HarfBuzz type names

HarfBuzz types have a "_t" postfix in C, which was previously mapped to Java classes like FontT. The trailing "T" is now gone.

Improved handling of callback memory allocations

The Panama FFI needs an explicit memory allocation to a expose Java callback method to native code. These are now deallocated automatically, as specified in scope attribute in GObject-Introspection.

Improved binding of virtual methods

In previous versions, Java-GI mapped virtual methods to regular public Java methods. This is incorrect; virtual methods are not designed as an API, but can be used to "chain up" when implementing a derived class. This is why in PyGObject for example, virtual methods have a do_ prefix to prevent confusion with regular methods. In Java-GI 0.8.0, virtual methods are now exposed with protected visibility. You can "chain up" using the asParent() API that was implemented in Java-GI 0.7.0.

Upgraded and improved Cairo bindings

Not part of Java-GI, but related: The manually developed cairo bindings have also been upgraded to JDK 21, and now also support user-defined fonts.

More details in the PRs:

Full Changelog: 0.7.2...0.8.0

0.7.2

03 Oct 19:38
Compare
Choose a tag to compare

This release fixes an issue with out-parameter handling in callback methods.
Furthermore, a toString() method has been added to the org.gnome.gobject.Value class to simplify debugging of GValues.

The release is available on Maven Central.

Full Changelog: 0.7.1...0.7.2