Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Java 12 Switch Expressions #3259

Merged
merged 10 commits into from
Feb 24, 2020
Merged

Feature: Java 12 Switch Expressions #3259

merged 10 commits into from
Feb 24, 2020

Conversation

Egor18
Copy link
Contributor

@Egor18 Egor18 commented Feb 19, 2020

Fix #3011
This PR is to support Java 12 Switch Expressions preview feature and new syntax.
More info:
https://openjdk.java.net/jeps/325
https://openjdk.java.net/jeps/354
https://docs.oracle.com/en/java/javase/13/language/switch-expressions.html

Roadmap:

  1. Update eclipse JDT [DONE]
  2. Support new arrow syntax (case 1 -> x = 1;) in switch [DONE]
  3. Support multiple expressions (case 1, 2, 3 -> x = 1;) in case [DONE]
  4. Support switch expression (int x = switch(i) {...};) [DONE]

Moreover, Java 13 introduced yield keyword to replace break in switch. We should probably add this one later as well.

Note: Right now Switch Expressions are a preview feature, but I believe it will be in standard Java 14.

@monperrus
Copy link
Collaborator

monperrus commented Feb 19, 2020 via email

@Egor18
Copy link
Contributor Author

Egor18 commented Feb 22, 2020

Well, I think Java 12 is here.
Code review or additional unit tests are welcome!

@Egor18 Egor18 changed the title WIP: Java 12 Switch Expressions Feature: Java 12 Switch Expressions Feb 22, 2020
@monperrus
Copy link
Collaborator

Hi @Egor18

Thanks a lot for this very important PR.

Reviewed it, looks great. Plus 263 of 285 new or added lines in 24 files covered. (92.28%), perfect!

LGTM.

@nharrand
Copy link
Collaborator

LGTM as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add support for java 12
3 participants