Java warning when calling DBusConnection.addSigHander in Java
binding
Tim Moloney
t.moloney at verizon.net
Wed Apr 26 15:03:33 PDT 2006
Matthew Johnson wrote:
> On Tue, 25 Apr 2006, Tim Moloney wrote:
>
>> I get a couple of warnings when compiling the following line of Java
>> code inside Eclipse.
>>
>> this.connection.addSigHandler(Player.playingUriChanged.class, this);
>>
>> The warnings are:
>> - Type safety: The expression of type RhythmboxDbusProxy needs
>> unchecked conversion to conform to DBusSigHandler<T>
>> - Type safety: Unchecked invocation addSigHandler(Class,
>> DBusSigHandler) of the generic method addSigHandler(Class<T>,
>> DBusSigHandler<T>) of type DBusConnection
>>
>> "Player" is the Java class generated by the CreateInterface
>> application (which extends DBusSignal) and "this" refers to an
>> instance of my RhythmboxDbusProxy class that implements DBusSigHandler.
>
> Can you give me the implements line of RythmboxDBusProxy, it probably
> needs to be declared as implements
> DBusSigHandler<Player.playingUriChanged>
>
> Matt
>
The orignal line was
public class RhythmboxDbusProxy implements DBusSigHandler { ... }
which I changed to
public class RhythmboxDbusProxy implements
DBusSigHandler<Player.playingUriChanged> { ... }
and that gets rid of the warning.
However, I has to comment out the other three signals that
RhythmboxDbusProxy handles. If I used
public class RhythmboxDbusProxy implements
DBusSigHandler<Player.playingChanged>,
DBusSignHandler<Player.playingUriChanged>,
DBusSigHandler<Player.elapsedChanged>,
DBusSigHandler<Shell.visibilityChanged> { ... }
I get the following error messages.
The interface DBusSigHandler cannot be implemented more than once with
different arguments:
DBusSigHandler<Player.playingUriChanged> and
DBusSigHandler<Player.playingChanged>
The interface DBusSigHandler cannot be implemented more than once with
different arguments:
DBusSigHandler<Playing.elapsedChanged> and
DBusSigHandler<Player.playingChanged>
The interface DBusSigHandler cannot be implemented more than once with
different arguments:
DBusSigHandler<Shell.visibilityChanged> and
DBusSigHandler<Player.playingChanged>
I understand this to mean that I have to create a separate class that
implements DBusSignal<signal> for each D-Bus signal that I want to
handle. That seems a bit much. I hope that I'm wrong.
Tim Moloney
More information about the dbus
mailing list