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?
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.
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.
It can still be used, but eventually it will not work with other things because it is no longer being supported.
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.
According to this documentation, you need to use getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With