Java 7 - Diamond Operator

727 views
Skip to first unread message

Albert Attard

unread,
Jun 14, 2012, 6:49:55 AM6/14/12
to google-we...@googlegroups.com
Hi everyone,

The following error is returned when compiling code using the diamond operator (part of project coin in Java 7).

Syntax error on token "<", ? expected after this token

I am using the GWT 2.40 (Plugin - com.google.gwt.eclipse.sdkbundle_2.4.0.v201205091048-rel-r37).

The following fragment is a simple example of the diamond operator:

List<String> names = new ArrayList<>();


Question:
  1. Does GWT support Java 7 features?  
  2. What changed do I need to perform in order to have the Java 7 code working without having to change the source?
  3. What other features from the latest Java 7 GWT does not support?

Thank you in advance for any input.
Albert Attard

Thomas Broyer

unread,
Jun 14, 2012, 6:57:36 AM6/14/12
to google-we...@googlegroups.com


On Thursday, June 14, 2012 12:49:55 PM UTC+2, Albert Attard wrote:
Question:
  1. Does GWT support Java 7 features?  
No.
Not yet. Though it will likely take some time.
 
  1. What changed do I need to perform in order to have the Java 7 code working without having to change the source?
In terms of what should be done within GWT to make it support Java 7?
Well, first and foremost upgrade ECJ to a version that supports Java 7. Hopefully that would be enough to support the diamond operator, and possibly all other Java 7 features. "Switch on strings" would hwoever greatly benefit from a specific handling in GWT, to compile it to an equivalent switch in JS.

  1. What other features from the latest Java 7 GWT does not support?
No single one. GWT uses a Java 6 parser, so it only supports Java 6.

Albert Attard

unread,
Jun 14, 2012, 7:09:41 AM6/14/12
to google-we...@googlegroups.com
Thanks for your reply.
Albert

Albert Attard

unread,
Jun 14, 2012, 7:41:04 AM6/14/12
to google-we...@googlegroups.com
The page (https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsCompatibility) only mentions support for Java 1.5.  Sorry for the trouble, I missed it before.

I was looking for diamond operator before and found nothing, where my search criteria had to be different :(.  There are plenty of posts about this.

Thanks again,
Albert Attard


On Thursday, June 14, 2012 12:57:36 PM UTC+2, Thomas Broyer wrote:
Reply all
Reply to author
Forward
0 new messages