jwharm / java-gi

GObject-Introspection bindings generator for Java
GNU Lesser General Public License v2.1
84 stars 7 forks source link

Shorter constructor names #80

Closed jwharm closed 10 months ago

jwharm commented 10 months ago

Named constructors in GObject classes conventionally start with new_. This prefix is superfluous in the Java language bindings. For example, Button.newWithLabel() can more concisely be written as Button.withLabel(). Therefore, the Java-GI bindings has been changed to strip the new prefix from the name of the static factory methods for named constructors.

This is not a brand new idea; Gtk-rs also has this in a number of cases (including Button.with_label()).