summaryrefslogtreecommitdiffstats
path: root/ridljar
diff options
context:
space:
mode:
Diffstat (limited to 'ridljar')
-rw-r--r--ridljar/com/sun/star/uno/UnoRuntime.java5
-rw-r--r--ridljar/test/com/sun/star/uno/UnoRuntime_Test.java8
2 files changed, 7 insertions, 6 deletions
diff --git a/ridljar/com/sun/star/uno/UnoRuntime.java b/ridljar/com/sun/star/uno/UnoRuntime.java
index dcf7ff42b10c..28ee8fb1e2bd 100644
--- a/ridljar/com/sun/star/uno/UnoRuntime.java
+++ b/ridljar/com/sun/star/uno/UnoRuntime.java
@@ -179,8 +179,9 @@ public class UnoRuntime {
* otherwise <code>null</code>
* @see #queryInterface(Type, Object)
*/
- public static Object queryInterface(Class zInterface, Object object) {
- return queryInterface(new Type(zInterface), object);
+ @SuppressWarnings("unchecked")
+ public static <T> T queryInterface(Class<T> zInterface, Object object) {
+ return (T) queryInterface(new Type(zInterface), object);
}
/**
diff --git a/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java b/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
index 06af7828039e..a9eef19b0a64 100644
--- a/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
+++ b/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
@@ -54,7 +54,7 @@ public final class UnoRuntime_Test extends ComplexTestCase {
// Test if a delegator object has the same OID as its creator:
Test4 test4 = new Test4();
- Ifc ifc = (Ifc) UnoRuntime.queryInterface(Ifc.class, test4);
+ Ifc ifc = UnoRuntime.queryInterface(Ifc.class, test4);
assure(
"Test4",
UnoRuntime.generateOid(test4).equals(UnoRuntime.generateOid(ifc)));
@@ -64,19 +64,19 @@ public final class UnoRuntime_Test extends ComplexTestCase {
// Test if a query for an interface which is not supported returns null:
assure(
"Test1",
- (Ifc) UnoRuntime.queryInterface(Ifc.class, new Test1()) == null);
+ UnoRuntime.queryInterface(Ifc.class, new Test1()) == null);
// Test if a query for an interface which is supported through
// IQueryInterface succeeds:
assure(
"Test2",
- (Ifc) UnoRuntime.queryInterface(Ifc.class, new Test2()) != null);
+ UnoRuntime.queryInterface(Ifc.class, new Test2()) != null);
// Test if a query for an interface which is directly supported (through
// inheritance) succeeds:
assure(
"Test3",
- (Ifc) UnoRuntime.queryInterface(Ifc.class, new Test3()) != null);
+ UnoRuntime.queryInterface(Ifc.class, new Test3()) != null);
}
public void test_areSame() {