Java 7 switch statement with strings not working

拈花ヽ惹草 提交于 2019-12-05 01:23:08

While it is true that the JDT team has implemented the Switch on String feature, the support for Java 7 won't be before Eclipse 3.7.1:

See bug 288548:

Due to late availability of JSR-292 (Invoke Dynamic) and JSR-334 (Project Coin) and due to the official release date (July 28, 2011) of Java 7 being after 3.7 ships we had to defer the Java 7 support to 3.7.1. It has not yet been decided whether this will be available as part of the 3.7.1 downloads or as separate feature update.

The work for the Java 7 features is currently in progress in the 'BETA_JAVA7' branch and we will deliver separate updates for the stable builds in order to provide early access to the Java 7 features for interested parties.

Eclipse doesn't support yet compilation on JDK 7, for try the new feature you need to use NetBeans 7 or compile with standard javac compiler in the bundle of the JDK 7 by hand or with the help of an ant script.

Use Eclipse 3.8 (first milestone came some days ago). Don't forget to set the compiler settings to Java 7.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!