[PATCH] fix some java deprecation warnings in qadevOOo module

Stephan Bergmann sbergman at redhat.com
Thu Jun 21 09:00:13 PDT 2012


On 06/21/2012 05:43 PM, Noel Grandin wrote:
> Perhaps you can tell me - there are some deprecated methods like this one:
>
> package com.sun.star.wizards.common;
> public class NumberFormatter
> {
> public static XNumberFormatter
> createNumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier
> _xNumberFormatsSupplier) throws Exception
>
> that are used in various places, but I can't find a replacement - there
> doesn't seem to be a NumberFormatter factory class with a create method
> taking an XComponentContext parameter, like I would expect.
> Any ideas?

That factory would be a new-style com.sun.star.util.NumberFormatter 
service.  ;)

It is a little unclear to me why that method is marked @deprecated. 
Assuming that it is so because it uses the obsolete 
XMultiServceFactory.createInstance approach (rather than 
XMultiComponentFactory.createInstanceWithContext), you could either 
rewrite it (and its callers) to use 
XComponentContext/XMultiComponentFactory instead (which might become a 
bit of a painful avalanche if the callers themselves also only have the 
XMultiServiceFactory around, but not the XComponentContext; there is no 
equivalent of the C++ comphelper::getProcessComponentContext in Java). 
Or you could remove the "@" from "@deprecated" so that it no longer 
generates noise.  (Given that writing new code based on this is rare, 
the chance that somebody unintentionally uses this method instead of a 
better counter part in new code is negligible.)

Stephan


More information about the LibreOffice mailing list