mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-17 20:11:25 +07:00
[java-highlighting] Check if variable within pattern guard is effectively final
IDEA-301356 GitOrigin-RevId: 0b8146783be915b5a05a48801151bf64176e39d8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bfc6ad1073
commit
1c11e442b0
@@ -0,0 +1,15 @@
|
||||
// "Move 'x' into anonymous object" "true-preview"
|
||||
class Test {
|
||||
void test(Object o) {
|
||||
var ref = new Object() {
|
||||
int x = 42;
|
||||
};
|
||||
|
||||
switch (o) {
|
||||
case null -> System.out.println(0);
|
||||
case Integer i -> System.out.println(1);
|
||||
case String s when s.length() == ref.x++ -> System.out.println(2);
|
||||
default -> System.out.println(123);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Move 'x' into anonymous object" "true-preview"
|
||||
class Test {
|
||||
void test(Object o) {
|
||||
int x = 42;
|
||||
|
||||
switch (o) {
|
||||
case null -> System.out.println(0);
|
||||
case Integer i -> System.out.println(1);
|
||||
case String s when s.length() == x<caret>++ -> System.out.println(2);
|
||||
default -> System.out.println(123);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user