hypfvieh / dbus-java

Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
https://hypfvieh.github.io/dbus-java/
MIT License
185 stars 73 forks source link

InterfaceCodeGenerator incorrectly maps advanced types #68

Closed 4s1 closed 5 years ago

4s1 commented 5 years ago

InterfaceCodeGenerator (3.0.2) creates invalid interfaces

Mappings for advanced data types: i.e. a{sv} gets mapped as Map<CharSequence> which is not valid for a Map as it requres two type identifiers.

This is what I get from org.freedesktop.UDisks2 /org/freedesktop/UDisks2

package org.freedesktop.dbus;

import org.freedesktop.dbus.types.Variant;
import java.util.Map;
import java.util.List;
import org.freedesktop.dbus.messages.DBusSignal;

/**
 * Auto-generated class.
 */
public interface Properties {

    public Variant Get(String interface_name, String property_name);
    public Map<String> GetAll(String interface_name);
    public void Set(String interface_name, String property_name, Variant value);

    public static class PropertiesChanged extends DBusSignal {

        private final String interface_name;
        private final Map<String> changed_properties;
        private final List<String> invalidated_properties;

        public String getInterface_name() {
            return interface_name;
        }

        public Map<String> getChanged_properties() {
            return changed_properties;
        }

        public List<String> getInvalidated_properties() {
            return invalidated_properties;
        }

    }
}

Oh, and by the way, aren't those private final fields to be initialized (by a constructor)?

https://github.com/hypfvieh/dbus-java/blob/3158c47400009349fa653bcd31a18ec13cfe8b44/dbus-java-utils/src/main/java/org/freedesktop/dbus/utils/generator/TypeConverter.java#L203

hypfvieh commented 5 years ago

I fixed your mentioned issues.

Anyway, the generated ObjectManager, Properties and Peer interface are not required. These are default interfaces which all DBus compatible objects have to implement, so the mentioned interfaces are already included in dbus-java library.

cannanieltf commented 5 years ago

@hypfvieh I am running into this issue. Where is the proper place to download the updated jar? Maven central still has only 3.0.2

hypfvieh commented 5 years ago

There is no new release yet. If you need the updated version, you have clone this repo and build it yourself

cannanieltf commented 5 years ago

Ok Thanks!