mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
java highlighting tests moved to community
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
public class Test {
|
||||
private static final String BAZ = "baz";
|
||||
|
||||
private void stringSwitch() {
|
||||
final String bar = "bar";
|
||||
String key = "key";
|
||||
switch (key) {
|
||||
case "": {
|
||||
System.out.println("Nothing");
|
||||
break;
|
||||
}
|
||||
case "foo": // fallthrough works as before
|
||||
case bar: // local final variables are ok
|
||||
case BAZ: { // constants are ok
|
||||
System.out.println("Matched key");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void illegalStringSwitch() {
|
||||
String foo = "foo";
|
||||
String key = "key";
|
||||
switch (key) {
|
||||
case <error>foo</error>:
|
||||
case <error>getStringValue()</error>: {
|
||||
System.out.println("illegal");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private String getStringValue() {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user