Switch on String shouldn't this work in GWT 2.6 / Java 7 ?

323 views
Skip to first unread message

darkflame

unread,
Jan 28, 2014, 1:54:52 PM1/28/14
to google-we...@googlegroups.com
Something like ;

switch (book) {

case "Harry Potter":
break;
case "Hitch Hikers Guide To The Galaxy":
break; 

Should now work with the latest GWT from here;
https://code.google.com/p/google-web-toolkit/downloads/list

Correct?

Because I am still getting a "   [ERROR] Line 1971: Cannot switch on a value of type String. Only convertible int values or enum constants are permitted "
error.
Screenshot;



Have I somehow setup GWT 2.6 wrongly?

Thanks,
-Thomas

Jens

unread,
Jan 28, 2014, 2:23:15 PM1/28/14
to google-we...@googlegroups.com
Have I somehow setup GWT 2.6 wrongly?

Using switch() with strings works in GWT 2.6. I guess you have to double check your setup. Maybe you have used an old run configuration that is not up-to-date? 

-- J.

Thomas Wrobel

unread,
Jan 28, 2014, 3:13:32 PM1/28/14
to google-we...@googlegroups.com
Ah, Bingo...it was either down to not clearing the cache's, or the fact a non-GWT 2.6 project was being inherited in.
Fixing both of those and it works.

*goes of to enjoy Java7*

~~~
Thomas & Bertines online review show:
http://randomreviewshow.com/index.html
Try it! You might even feel ambivalent about it :)


--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/pHHK4a2KuWc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages