[Fwd: info/DEV300 CWS sb113 : Java UnoRuntime.queryInterface simplification]
Stephan Bergmann <[email protected]> Wed, 19 Aug 2009 16:53:07 +0200
| Newsgroups | gmane.comp.openoffice.announce.interface |
|---|---|
| Message-ID | <[email protected]> |
As automatic mailing from EIS to interface-announce appears to be broken: -------- Original Message -------- Subject: info/DEV300 CWS sb113 : Java UnoRuntime.queryInterface simplification Date: Tue, 18 Aug 2009 10:15:29 +0200 (CEST) From: [email protected] To: [email protected], [email protected] Type: info Title: Java UnoRuntime.queryInterface simplification Posted by: [email protected] Affected: [email protected], TaskId: i102469 <http://www.openoffice.org/issues/show_bug.cgi?id=102469> Effective from: DEV300 CWS sb113 CWS: <http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300/sb113> CWS status: new *Summary* -------- com.sun.star.uno.UnoRuntime: - Object queryInterface(Class, Object) + <T extends XInterface> T queryInterface(Class<T>, Object) *Description* ------------- With the URE/OOo Java baseline lifted to Java 5, UnoRuntime.queryInterface can now make use of generics, and in a call like XFoo x = UnoRuntime.queryInterface(XFoo.class, o); it is no longer necessary to explicitly cast the return value of queryInterface to (XFoo). Strictly speaking, due to the "extends XInterface," this change is compile-time incompatible (but strictly run-time compatible). If this turns out to be a problem in practice (which I doubt), we can easily make the change strictly compile-time compatible (by simply dropping the "extends XInterface" qualification). I adapted all the relevant calls to UnoRuntime.queryInterface in the URE-related OOo code modules (in bridges, javaunohelper, jurt, ridljar, testtools, and ure), and added a note about the changed Java method to the Developer's Guide at <http://wiki.services.openoffice.org/w/index.php?title=Documentation/DevGuide/ProUNO/Java/Handling_Interfaces&oldid=137069>. Other people might want to eventually adapt further OOo code, the SDK examples, and/or the complete Developer's Guide.