I would like to explain the problem with the duplicated interfaces in the introspection data with an example, let's suppose we have interfaces:
@DBusInterfaceName("com.example.HalModule")
@DBusProperty(name = "Name", type = String.class, access = Access.READ)
@DBusProperty(name = "SerialNumber", type = String.class)
public interface HalModule extends DBusInterface {
@DeprecatedOnDBus
@IntrospectionDescription("Test description")
void test();
}
@DBusInterfaceName("com.example.PowerController")
@DBusProperty(name = "UnitStatus", type = String.class, access = Access.READ)
@DBusProperty(name = "Load", type = Double.class, access = Access.READ)
public interface PowerController extends DBusInterface {
}
Both interfaces have the @DBusProperty annotations - so we can expect an object that implements HalModule or PowerController to implement Properties as well.
Forcing the Properties implementation can be accomplished with extending it by HalModule and PowerController - maybe it was not the original assumption of interfaces behavior but it allows to simplify the application logic.
So the enriched interfaces will look like this:
@DBusInterfaceName("com.example.HalModule")
@DBusProperty(name = "Name", type = String.class, access = Access.READ)
@DBusProperty(name = "SerialNumber", type = String.class)
public interface HalModule extends DBusInterface, Properties {
@DeprecatedOnDBus
@IntrospectionDescription("Test description")
void test();
}
@DBusInterfaceName("com.example.PowerController")
@DBusProperty(name = "UnitStatus", type = String.class, access = Access.READ)
@DBusProperty(name = "Load", type = Double.class, access = Access.READ)
public interface PowerController extends DBusInterface, Properties {
}
And DBus object class:
public class PowerModuleObject implements PowerController, HalModule {
//...
}
Currently this logic results in duplicated Properties interface in introspection data:
This PR:
fixes the problem with duplicated interfaces in the introspection data
adds a new DBusNamingUtil class which will be helpful for internal and external use
fixes a bug with missing DBus annotations (eg @DeprecatedOnDBus, @IntrospectionDescription) in the introspection data
I would like to explain the problem with the duplicated interfaces in the introspection data with an example, let's suppose we have interfaces:
Both interfaces have the
@DBusProperty
annotations - so we can expect an object that implementsHalModule
orPowerController
to implementProperties
as well. Forcing theProperties
implementation can be accomplished with extending it byHalModule
andPowerController
- maybe it was not the original assumption of interfaces behavior but it allows to simplify the application logic. So the enriched interfaces will look like this:And DBus object class:
Currently this logic results in duplicated
Properties
interface in introspection data:This PR:
DBusNamingUtil
class which will be helpful for internal and external use@DeprecatedOnDBus
,@IntrospectionDescription
) in the introspection data