java: make error message more clear (IDEA-254372)

GitOrigin-RevId: 5c5bf42e6b375c2611ce996ca13a8404477e1eae
This commit is contained in:
Anna Kozlova
2020-11-02 12:23:48 +01:00
committed by intellij-monorepo-bot
parent 8d60f5808e
commit ff667732f6
4 changed files with 6 additions and 6 deletions

View File

@@ -204,7 +204,7 @@ variable.already.defined=Variable ''{0}'' is already defined in the scope
break.outside.switch.or.loop=Break outside switch or loop
yield.unexpected=Yield outside of switch expression
yield.void=Expression type should not be 'void'
break.outside.switch.expr=Break outside of enclosing switch expression
break.outside.switch.expr=Break out of switch expression is not allowed
continue.outside.loop=Continue outside of loop
continue.outside.switch.expr=Continue outside of enclosing switch expression
not.loop.label=Not a loop label: ''{0}''

View File

@@ -55,7 +55,7 @@ class SwitchExpressions {
case -1: <error descr="Return outside of enclosing switch expression">return;</error>
case -2: <error descr="Continue outside of enclosing switch expression">continue lab;</error>
case -3: <error descr="Continue outside of enclosing switch expression">continue;</error>
default: <error descr="Break outside of enclosing switch expression">break lab;</error>
default: <error descr="Break out of switch expression is not allowed">break lab;</error>
});
}
}

View File

@@ -35,15 +35,15 @@ class YieldStatements {
}
case 11 -> { yield <error descr="Expression type should not be 'void'">m(0)</error>; }
case 12 -> {
switch (i) { default: <error descr="Break outside of enclosing switch expression">break out;</error>; }
switch (i) { default: <error descr="Break out of switch expression is not allowed">break out;</error>; }
}
default -> throw new RuntimeException();
});
out: while (true) {
System.out.println(switch (i) {
case 0: <error descr="Break outside of enclosing switch expression">break;</error>
default: <error descr="Break outside of enclosing switch expression">break out;</error>
case 0: <error descr="Break out of switch expression is not allowed">break;</error>
default: <error descr="Break out of switch expression is not allowed">break out;</error>
});
}
}

View File

@@ -210,7 +210,7 @@ public class SwitchExpressionsJava12 {
yield 3;
case C:
i = 3;
<error descr="Break outside of enclosing switch expression">break;</error>
<error descr="Break out of switch expression is not allowed">break;</error>
default: {
i = 10;
yield 10;/* todo one two */