2009-03-17

GWT and reflection

I've decided to use GWT in some of my more recent projects. It's been an awesome tool to have, except for one thing. It doesn't support java reflection. This makes coding pluggable applications really hard.

Google's excuse is that it would be too hard to do reflection, what with trying to find the .js file that holds the class. In my opinion, this is a wimpy excuse. Why not allow reflection for classes within the module itself? I can definitely see the issue with accessing classes not compiled with the module, which is what their excuse covers, but I really can't see any issues with accessing classes compiled with the module.

Granted, the code is currently obfuscated. That throws a wrench in the works, but it's only a minor one. A module could be compiled with support for reflection, which could build a list that maps real class names to obfuscated class names. This would cut down on security, assuming that a developer is using obfuscation to protect intellectual property, but then at least reflection would work.

GWT developers, please add reflection. I know there are libraries out there that can help with it, but it would be really nice to have it just built in to GWT.

1 comment:

Eduard said...

I agree too,
I think it is a pitty GWT cannot make use of reflection!
Eduard