Skip to content

0.7

Compare
Choose a tag to compare
@jwharm jwharm released this 15 Sep 19:26
· 605 commits to main since this release

This release brings a number of changes:

  • The project is built using Gradle, and all artifacts are now available on Maven Central. For example, to include LibAdwaita bindings and transitively Gtk, GObject etc:
repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.github.jwharm.javagi:adw:0.7'
}
  • The project has become more modular. All gir files generate one jar file. All available modules are listed here.
  • As can be seen in the example above, the adwaita module has been renamed to adw. This follows the namespace declared in the GIR file.
  • The GObject class has been extended with methods that allow to easily get and set property values.
  • When creating your own GObject subclass in Java, you can now declare and emit custom signals with a convenient syntax. The old Signal class has been renamed to SignalConnection. Example usage:
@Signal
public interface LimitReached {
    public void run(int limit);
}

public void count() {
    num++;
    if (num == limit) {
        emit("limit-reached", limit);
    }
}
  • The Java-GI GClosure implementation, JavaClosure, can now also be used to wrap anonymous lambda methods.
  • The Cairo bindings have been published separately on Maven Central. They are automatically pulled as a dependency by Gdk.
  • Marshaling of arrays and out-parameters has further improved. The Pointer classes (PointerInteger, PointerString etc) are now mostly obsolete, and have been removed. In the few cases where pointers still are exposed in the Java API, a MemorySegment is used.
  • Java-9-style modules have been removed. There is only one package in most jar files.
  • The GIR parser and code generator have received performance improvements.
  • LGPL license banners have been added to all source code files.
  • Error logging when creating GObject-derived Java classes has been improved.
  • Methods with va_list parameters are marked as deprecated, in preparation for the removal of the VaList class in Java 21.
  • Marshaling of empty Strings has been fixed.
  • More unit tests have been added

The split of the glib jar into separate modules for GLib, GObject, GIO and GModule will require some changes to your import statements:

  • import io.github.jwharm.javagi.types should become import io.github.jwharm.javagi.gobject.types
  • The ListIndexModel class has moved to io.github.jwharm.javagi.gio
  • The JavaClosure and ValueUtil class has moved to io.github.jwharm.javagi.gobject