summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Johnson <mjj29@qadesh.matthew.ath.cx>2009-03-25 22:43:30 +0000
committerMatthew Johnson <mjj29@qadesh.matthew.ath.cx>2009-03-25 22:43:30 +0000
commit6f55d0977bf650932925f37c389a2540bbef2148 (patch)
tree64c7783d7e2250c568dacb30767ac0c202e1591d
parentb0dd5f87391202759eae6a598fa2ad3e3e837d39 (diff)
fix Path returns from implicit variants
-rw-r--r--org/freedesktop/dbus/Marshalling.java6
-rw-r--r--org/freedesktop/dbus/test/test.java15
2 files changed, 17 insertions, 4 deletions
diff --git a/org/freedesktop/dbus/Marshalling.java b/org/freedesktop/dbus/Marshalling.java
index 7116248..7f6797c 100644
--- a/org/freedesktop/dbus/Marshalling.java
+++ b/org/freedesktop/dbus/Marshalling.java
@@ -424,12 +424,12 @@ public class Marshalling
// its an object path, get/create the proxy
if (parameter instanceof ObjectPath) {
- if (type instanceof Class && Path.class.equals((Class) type))
- parameter = new Path(((ObjectPath) parameter).path);
- else
+ if (type instanceof Class && DBusInterface.class.isAssignableFrom((Class) type))
parameter = conn.getExportedObject(
((ObjectPath) parameter).source,
((ObjectPath) parameter).path);
+ else
+ parameter = new Path(((ObjectPath) parameter).path);
}
// it should be a struct. create it
diff --git a/org/freedesktop/dbus/test/test.java b/org/freedesktop/dbus/test/test.java
index 5333723..36853c8 100644
--- a/org/freedesktop/dbus/test/test.java
+++ b/org/freedesktop/dbus/test/test.java
@@ -44,6 +44,7 @@ import org.freedesktop.DBus.Error.ServiceUnknown;
import org.freedesktop.DBus.Error.UnknownObject;
import org.freedesktop.DBus.Peer;
import org.freedesktop.DBus.Introspectable;
+import org.freedesktop.DBus.Properties;
class testnewclass implements TestNewInterface
{
@@ -54,7 +55,7 @@ class testnewclass implements TestNewInterface
}
}
-class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignalInterface, TestSignalInterface2
+class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignalInterface, TestSignalInterface2, Properties
{
private DBusConnection conn;
public testclass(DBusConnection conn)
@@ -299,6 +300,14 @@ class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignal
for (int i = 0; i < as.length; i++)
if (as[i] != bs[i]) test.fail("didn't receive identical byte arrays");
}
+ @SuppressWarnings("unchecked")
+ public <A> A Get (String interface_name, String property_name)
+ {
+ return (A) new Path("/nonexistant/path");
+ }
+ public <A> void Set (String interface_name, String property_name, A value) {}
+ public Map<String, Variant> GetAll (String interface_name) { return new HashMap<String,Variant>(); }
+
}
/**
@@ -648,6 +657,10 @@ public class test
System.out.println("Got Fallback Name: "+tri.getName());
System.out.println("Fallback Introspection Data: \n"+intro.Introspect());
+ System.out.println("Testing Properties returning Paths");
+ Properties prop = clientconn.getRemoteObject("foo.bar.Test", "/Test", Properties.class);
+ Path path = (Path) prop.Get("foo.bar", "foo");
+ System.out.println("Got path "+path);
System.out.println("Calling Method7--9");
/** This gets a remote object matching our bus name and exported object path. */
TestRemoteInterface2 tri2 = clientconn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface2.class);