Skip to content

Commit 37cada2

Browse files
committed
Add @Library and BridJ.register() call to enums as well
They can have their own methods, and these are necessary in order to be able to call them, just like in records/classes.
1 parent b572fd3 commit 37cada2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/gir2java/GirParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ private void parseEnumeration(Element root, ParsingContext context) {
422422
JDefinedClass enumClass = cm._class(enumFqcn, ClassType.ENUM);
423423
System.out.println("New enum: " + enumFqcn);
424424

425+
enumClass.init().add(cm.ref(BridJ.class).staticInvoke("register"));
426+
enumClass.annotate(Library.class).param("value", context.getLibraryName());
427+
425428
Set<String> foundTypes = (Set<String>)context.getExtra(Constants.CONTEXT_EXTRA_DEFINED_TYPES);
426429
foundTypes.add("" + context.getExtra(Constants.CONTEXT_EXTRA_NAMESPACE) + '.' + enumName);
427430

0 commit comments

Comments
 (0)