Skip to content

Hyphenated property names generate invalid Java identifiers #302

Closed

Description

@zugaldia

When generating Java code with InterfaceCodeGenerator version 5.2.0 on the https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.portal.PowerProfileMonitor.xml file, the following property produces incorrect code:

<property name="power-saver-enabled" type="b" access="read"/>

Problematic generated code:

@DBusBoundProperty
boolean ispower-saver-enabled();

Build error:

Execution failed for task ':sdk:compileJava'.
> Compilation failed; see the compiler output below.
  /[redacted]/stargate/sdk/src/main/generated/org/freedesktop/portal/PowerProfileMonitor.java:14: error: = expected
      boolean ispower-saver-enabled();
                     ^

The exact setup can be seen here (Stargate is a Kotlin library that provides JVM applications with access to XDG Desktop Portals on Linux).

I've seen other generation errors with other XDG Portals related XML files. I'll open separate tickets for easier tracking.

Activity

  1. zugaldia commented on Mar 15, 2026

    @zugaldia
    Author

    Fixed in the latest 6.0.0 snapshot, see #304 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions