As a regular user of GWT for projects both commercially and personally since 2006 I have been yearning for Java 5 support. It’s finally here, albeit in the form of a release candidate. Candidate or not, I thought it best to take it for a test drive. Here is what I found.
The testdrive: Upgrade my current GWT 1.4 work-in-progress project s3swap into a GWT 1.5 project.
My project has a couple of nasty little hacks in it (don’t they all?) , one of which caused a compile error in the new RC1. The error was caused because I had created my own version of
NamedFrame so that I could better control the size of it. Apparently in the new GWT the
setElement() is no longer used, and instead
replaceElement() is called. However the
replaceElement() method is package private so I cannot call it from my own
NamedFrame. The fix – just don’t fiddle with frame sizes (for now).
Next came the1.5 code changes. Converting the GWT code to 1.5 was relatively easy because everytime I code complete a Collection I get the type parameter syntax completed for me by Eclipse. All I have been doing is block commenting out that syntax.
For example: The structure for
List<String> gets inserted by Eclipse and I duly fill in the blanks. Then afterwards I just Ctrl+Shift+/ the type parameter to look like this
List/*<String>*/. Converting the clunky for loops into nice ‘foreach’ loops after the typeparameters were in was easy too – thanks to Eclipse’s code generation.
Next step – I can get rid of the clunky
new Integer("").intValue() code that is now handled by autoboxing. That’s not so important though, it really just cleans up the code in a few places.