mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-196805 Warn about switch statement with single 'default'
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
} else {
|
||||
}
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
}
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
return "";
|
||||
}
|
||||
System.out.println("oops");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
for(int i=0; i<10; i++)
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
continue;
|
||||
}
|
||||
System.out.println("bar");
|
||||
System.out.println("oops");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
{
|
||||
char a, b = c;
|
||||
}
|
||||
int b;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
s<caret>witch (c) {
|
||||
default:
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
break;
|
||||
} else break;
|
||||
}
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
s<caret>witch (c) {
|
||||
default:
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
s<caret>witch (c) {
|
||||
default:
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
break;
|
||||
}
|
||||
System.out.println("oops");
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
s<caret>witch (c) {
|
||||
default:
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
for(int i=0; i<10; i++)
|
||||
s<caret>witch (c) {
|
||||
default:
|
||||
if(c == 'a') {
|
||||
System.out.println("foo");
|
||||
break;
|
||||
}
|
||||
System.out.println("bar");
|
||||
}
|
||||
System.out.println("oops");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Unwrap 'switch' statement" "false"
|
||||
class X {
|
||||
String test(char c) {
|
||||
for(int i=0; i<10; i++) {
|
||||
s<caret>witch (c){
|
||||
default:
|
||||
if (c == 'a') {
|
||||
System.out.println("foo");
|
||||
break;
|
||||
}
|
||||
System.out.println("bar");
|
||||
}
|
||||
System.out.println("oops");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
s<caret>witch (c) {
|
||||
default:
|
||||
char a, b = c;
|
||||
}
|
||||
int b;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Unwrap 'switch' statement" "true"
|
||||
class X {
|
||||
String test(char c) {
|
||||
s<caret>witch (c) {
|
||||
default:
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user