Private class VS. enum

0 views
Skip to first unread message

Antoine

unread,
May 11, 2009, 9:02:22 AM5/11/09
to Google Web Toolkit
Hello.

I’m currently playing with GWT and there is something I don’t
understand: why do you use private classes and not enumeration. For
instance, the location of a widget in the DockPanel is using the
DockLayoutConstant and not an enumeration.

One of the biggest advantage of the enum is the switch/case
capability, otherwise you have to create a lot of "else if" with the
private class way. What’s the fastest? Do you use private classes for
a compatibility reasons when GWT was in Java 1.4? Or are there some
other reasons of doing so?

It’s just something I was wondering, thanks a lot for any lights you
might give on this issue.

Antoine.

Adam T

unread,
May 11, 2009, 1:07:17 PM5/11/09
to Google Web Toolkit
I guess it's because of earlier versions, but there are also questions
on efficiency of enums in compiled code going on at the moment. For
example:

* GWT write up on possible future optimisations for enums:
http://code.google.com/p/google-web-toolkit/wiki/EnumOptimizations

* another write up here: http://timepedia.blogspot.com/2009/04/gwts-type-system-is-more-powerful-than.html

//Adam

Antoine

unread,
May 12, 2009, 2:07:04 AM5/12/09
to Google Web Toolkit
Thanks a lot! I didn't knew that Enumerations didn't perform well. Do
you have an idea of the release target of the optimization?

On 11 mai, 19:07, Adam T <adam.t...@gmail.com> wrote:
> I guess it's because of earlier versions, but there are also questions
> on efficiency of enums in compiled code going on at the moment.  For
> example:
>
> *  GWT write up on possible future optimisations for enums:
>  http://code.google.com/p/google-web-toolkit/wiki/EnumOptimizations
>
> * another write up here:http://timepedia.blogspot.com/2009/04/gwts-type-system-is-more-powerf...
Reply all
Reply to author
Forward
0 new messages