Skip to content

Unable to create HashTable with org.gnome.secret.SchemaAttributeType as value #297

@Nyeksenn

Description

@Nyeksenn

If I want to create a schema using the libsecret bindings the following has to be done:

var table = new HashTable<>(GLib::strHash, GLib::strEqual,
        (address) -> address.getString(0),
        (address) -> SchemaAttributeType.of(address.getAtIndex(ValueLayout.JAVA_INT, 0)));
table.insert("user", SchemaAttributeType.STRING);
var schema = new Schema("MySchema", SchemaFlags.NONE, table);

However, this is currently not possible because inserting into the table fails with an assertion error:

Exception in thread "main" java.lang.AssertionError: java.lang.IllegalArgumentException: Not a MemorySegment, String, primitive or Proxy
	at org.gnome.glib.HashTable.insert(HashTable.java:570)
	at io.github.Nyeksenn.grooveboat.Main.main(Main.java:54)
Caused by: java.lang.IllegalArgumentException: Not a MemorySegment, String, primitive or Proxy
Caused by: java.lang.IllegalArgumentException: Not a MemorySegment, String, primitive or Proxy

	at org.javagi.interop.Interop.getAddress(Interop.java:626)
	at org.gnome.glib.HashTable.insert(HashTable.java:568)
	... 1 more

Java-GI version: 0.13.0-RC1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions