Wrap multiple values in switch expression case#558
Wrap multiple values in switch expression case#558fawind wants to merge 2 commits intogoogle:masterfrom
Conversation
|
Was it ever clear why this PR failed the Java 16 check? The logs have expired, is it possible to retrigger the checks for this PR? |
|
The failing JDK 16 and now 17 check seems to be unrelated to this change. I believe it's a general problem with the formatter as e.g. the same tests fail on master for the JDK 17 check (ref). I don't think it's in the scope of this PR to fix them. @cushon, mind taking a look when you have a spare minute? Thanks! |
|
Thanks for the fix!
Agreed: the tests aren't passing on JDK 17 at head yet. That configuration is marked as 'experimental' and won't block merging, but the UI makes it look like a failure. Also I realized we're not breaking after the return switch (e) {
case SOME_RATHER_LONG_NAME_1,
SOME_RATHER_LONG_NAME_2,
SOME_RATHER_LONG_NAME_3,
SOME_RATHER_LONG_NAME_4,
SOME_RATHER_LONG_NAME_5,
SOME_RATHER_LONG_NAME_6,
SOME_RATHER_LONG_NAME_7 ->
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff();
case SOME_RATHER_LONG_NAME_8 ->
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff();
}; |
Since the last plugin update was almost half a year ago, I thought it would be prudent to update it and resolve most of the issues regarding updating the plugin. It took around half an hour once I managed to correctly set up the module due to the gradle plugin version 1.2.1 + intellij version 2020.3 requiring java 11 to develop. All of the included annotation changes were requested by IntelliJ to add since the overrides added them as well. The change of `<? extends TextRange>` to `<TextRange>` was to resolve the syntax errors introduced by a change removing the wildcard requirement. NotificationGroup was deprecated and moved into the plugin xml file as per the SDK docs The same was required for `StdFileTypes.JAVA` being deprecated with the fix being `JavaFileType.INSTANCE` + changing the depend module to add that fix. I had to change the project SDK to JDK 11 on my end to have the gradle build work. I also tested the plugin with 1.12 and 1.10 on some test files such as from #653 and #654. Would be good to have some double checking though because I've had issues trying to get the test file reformatted in #558 working. Probably because it's locked behind an experimental flag? Fixes #688 COPYBARA_INTEGRATE_REVIEW=#688 from ze:idea-1.12.0 53f216c PiperOrigin-RevId: 426491735
Closes #540
switch (e) { - case SOME_RATHER_LONG_NAME_1, SOME_RATHER_LONG_NAME_2, SOME_RATHER_LONG_NAME_3 -> {} + case SOME_RATHER_LONG_NAME_1, + SOME_RATHER_LONG_NAME_2, + SOME_RATHER_LONG_NAME_3 -> {} }switch (e) { - case CASE_A -> { - } + case CASE_A -> {} }