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

migrate to Java 17 switch semantics #570

Merged
merged 1 commit into from Apr 11, 2023

Conversation

gireeshpunathil
Copy link
Contributor

replace legacy switch block with java 17 semantics in eclipse.pde.internal.ui package, wherever relevant.

replace legacy switch block
with java 17 semantics in
eclipse.pde.internal.ui package,
wherever possible.
@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Test Results

     240 files  +       6       240 suites  +6   53m 38s ⏱️ + 11m 51s
  3 278 tests  -        1    3 253 ✔️ ±       0  24 💤 ±  0  0  - 1  1 🔥 ±0 
10 131 runs  +2 721  10 058 ✔️ +2 698  72 💤 +24  0  - 1  1 🔥 ±0 

For more details on these errors, see this check.

Results for commit 17a384b. ± Comparison against base commit 9cddd29.

This pull request removes 1 test.
AllPDEMinimalTests org.eclipse.pde.ui.tests.launcher.AllLauncherTests org.eclipse.pde.ui.tests.launcher.FeatureBasedLaunchTest ‑ Unknown test

@mickaelistria mickaelistria merged commit 6f1f297 into eclipse-pde:master Apr 11, 2023
7 of 9 checks passed
@mickaelistria
Copy link
Contributor

Thank you!

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @gireeshpunathil for this clean up, this is much appreciated.

Sorry for the late reply. I just have to minor remarks below, in case you want to address them in a follow up.

case T_OR -> OP_OR;
case T_EQ -> OP_EQ;
case T_NEQ -> OP_NEQ;
default -> opcode;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default could be zero and the swtich expression could be assigned to the opcode variable during initialization already.

}


boolean accept = true & switch (mWidthType) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leading true is not necessary here.

And the parenthesis in the following cases can probably be deleted too.

@vogella
Copy link
Contributor

vogella commented Apr 12, 2023

Very nice to see code cleanup activities in PDE.

@gireeshpunathil I hope to see more of these in the future!

gireeshpunathil added a commit to gireeshpunathil/eclipse.pde that referenced this pull request Apr 13, 2023
replace legacy switch block with java 17 semantics:
1. short-circuit initialization in the switch expression
2. default case match with the original initialization
3. reduce complex boolean expression to an elegant form

Refs: eclipse-pde#570 (review)
HannesWell pushed a commit that referenced this pull request Apr 13, 2023
* migrate to Java 17 switch semantics: extras

replace legacy switch block with java 17 semantics:
1. short-circuit initialization in the switch expression
2. default case match with the original initialization
3. reduce complex boolean expression to an elegant form

Refs: #570 (review)
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.

None yet

4 participants