Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix signal interface generation #146

Merged
merged 2 commits into from
Aug 9, 2021

Commits on Aug 6, 2021

  1. dbus-java-utils: ClassBuilderInfo: Don't duplicate constructor arguments

    When building classes using ClassBuilderInfo, arguments to the super()
    [superArguments] are automatically added to the constructor of the newly
    generated class. These arguments are not saved to the private members of
    the class. Saving to private members in the constructor is only done for
    [arguments] only.
    To have both:
    * saving to private members for getters and setters and
    * supplying to super()
    we have to add the argument to both: superArguments and arguments. But
    this then results to duplicate arguments to the constructor.
    This commit now removes these double arguments.
    poeschel committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    7ce40a7 View commit details
    Browse the repository at this point in the history
  2. dbus-java-utils: InterfaceCodeGenerator: Fix constructor for signals

    The constructor for dbus signals was generated wrong. For example this
    introspection.xml:
    
    <node>
      <interface name="de.Example">
        <signal name="ExampleSignal">
          <arg type="s" name="newState"/>
        </signal>
      </interface>
    </node>
    
    did generate this class:
    
    public interface Example extends DBusInterface {
        public static class ExampleSignal extends DBusSignal {
    
            private final String newState;
    
            public ExampleSignal(String _path, String _interfaceName, String _newState) throws DBusException {
                super(_path, _interfaceName);
                this.newState = _newState;
            }
    
            public String getNewState() {
                return newState;
            }
        }
    }
    
    This is wrong. With this interface it is not possible to emit this
    signal using dbus-java.
    When the ExampleSignal constructor is called, this leads to the
    DBusSignal constructor to be called with _path and _interfaceName
    arguments. DBusSignal class then infers from the enclosing classes
    arguments, that there must be two string arguments ("ss") to this
    signal. It is only one.
    
    The interface constructor has to look something like this:
    
            public ExampleSignal(String _path, String _newState) throws DBusException {
                super(_path, _newState);
                this.newState = _newState;
            }
    
    This is what this commit does. It changes the interface generation to
    reflect this.
    poeschel committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    1458981 View commit details
    Browse the repository at this point in the history