Java: Support switch expressions in '.switch' template (IDEA-204010)

This commit is contained in:
Pavel Dolgov
2019-02-06 15:43:29 +03:00
parent 1d51f2ce2f
commit ddfaf087ee
22 changed files with 314 additions and 7 deletions
@@ -0,0 +1,6 @@
public class Foo {
void f(byte x) {
String s;
s = x.switch<caret>
}
}
@@ -0,0 +1,8 @@
public class Foo {
void f(byte x) {
String s;
s = switch (x) {
<caret>
}
}
}
@@ -0,0 +1,5 @@
public class Foo {
void f(byte x) {
String s = x.switch<caret>
}
}
@@ -0,0 +1,7 @@
public class Foo {
void f(byte x) {
String s = switch (x) {
<caret>
}
}
}
@@ -0,0 +1,6 @@
public class Foo {
void m() {
int i;
i = 42 + 42.switch<caret>
}
}
@@ -0,0 +1,8 @@
public class Foo {
void m() {
int i;
i = switch (42 + 42) {
<caret>
}
}
}
@@ -0,0 +1,5 @@
public class Foo {
void m() {
int i = 42 + 42.switch<caret>
}
}
@@ -0,0 +1,7 @@
public class Foo {
void m() {
int i = switch (42 + 42) {
<caret>
}
}
}
@@ -0,0 +1,8 @@
public enum Foo {
A, B, C;
void f() {
Foo foo;
foo = Foo.values()[0].switch<caret>
}
}
@@ -0,0 +1,10 @@
public enum Foo {
A, B, C;
void f() {
Foo foo;
foo = switch (Foo.values()[0]) {
<caret>
}
}
}
@@ -0,0 +1,7 @@
public enum Foo {
A, B, C;
void f() {
Foo foo = Foo.values()[0].switch<caret>
}
}
@@ -0,0 +1,9 @@
public enum Foo {
A, B, C;
void f() {
Foo foo = switch (Foo.values()[0]) {
<caret>
}
}
}
@@ -0,0 +1,6 @@
public class Foo {
int f(int x) {
int i;
i *= x.switch<caret>
}
}
@@ -0,0 +1,8 @@
public class Foo {
int f(int x) {
int i;
i *= switch (x) {
<caret>
}
}
}
@@ -0,0 +1,5 @@
public class Foo {
int f(int x) {
int i = x.switch<caret>
}
}
@@ -0,0 +1,7 @@
public class Foo {
int f(int x) {
int i = switch (x) {
<caret>
}
}
}
@@ -0,0 +1,6 @@
public class Foo {
void f() {
String s;
s += "abc".switch<caret>
}
}
@@ -0,0 +1,8 @@
public class Foo {
void f() {
String s;
s += switch ("abc") {
<caret>
}
}
}
@@ -0,0 +1,5 @@
public class Foo {
void f() {
String s = "abc".switch<caret>
}
}
@@ -0,0 +1,7 @@
public class Foo {
void f() {
String s = switch ("abc") {
<caret>
}
}
}