On Jun 10, 6:31 am, Thomas Broyer <t.bro...@gmail.com> wrote: > On 8 juin, 16:29, Eric <erjab...@gmail.com> wrote:
> > Sadly, the best method is to use GWT's DateTimeFormat: > > > private static final DateTimeFormat YEAR_FORMAT = > > DateTimeFormat.getFormat("yyyy"); > > public static int year(final Date date) { > > return Integer.parseInt(YEAR_FORMAT.format(date)); > > > } > > Do you really think GWT won't use a Date#getYear() to output the > "yyyy" formatted string? How then parsing it back into an int would be > better than just calling getYear() and adding a @SuppressWarning on > your method? I've come to the conclusion that you're right. I dislike suppressing warnings; I work on projects where people deprecate their own code but never refactor the old code away. Suppressing warnings lets those people hide their malpractice from themselves. But in this case, the deprecation is Sun's problem. My problem is that I'm a programming prig prig. Go ahead--use the anotation, and save yourself many lines of useless code. If it weren't too much trouble to set up, I'd suggest using a JSNI function to do the work. However, the invocation and the creation of that are both ugly. I surrender. Respectfully, Eric Jablow -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.