Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace this deprecated method call?

Tags:

deprecated

gwt

I'm going through the GWT Tutorials and after entering this line, my IDE complains that the call to DateTimeFormat.getMediumDateTimeFormat() is deprecated:

lastUpdatedLabel.setText("Last update: " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));

How do I have to replace the call?

like image 282
helpermethod Avatar asked Jan 21 '11 16:01

helpermethod


People also ask

What happens when a method is deprecated?

Similarly, when a class or method is deprecated, it means that the class or method is no longer considered important. It is so unimportant, in fact, that it should no longer be used at all, as it might well cease to exist in the future. The need for deprecation comes about because as a class evolves, its API changes.

Is it OK to use deprecated methods?

You can still use deprecated code without performance being changed, but the whole point of deprecating a method/class is to let users know there's now a better way of using it, and that in a future release the deprecated code is likely to be removed.

Can deprecated code still be used?

It can still be used, but eventually it will not work with other things because it is no longer being supported.

How do you use deprecated in Java?

Using the @Deprecated Annotation To use it, you simply precede the class, method, or member declaration with "@Deprecated." Using the @Deprecated annotation to deprecate a class, method, or field ensures that all compilers will issue warnings when code uses that program element.


1 Answers

According to this documentation, you need to use getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM)

like image 68
Kevin Lacquement Avatar answered Sep 21 '22 13:09

Kevin Lacquement