Consider code like this:
---
class Test {
void t(int i) {
long local;
System.err.println(switch (i) {
case 0 -> {
String var;
int scopeHere;
yield "";
}
default -> {
String var;
int scopeHere;
yield "";
}
});
switch (i) {
case 0 -> {
String var;
int scopeHere;
}
default -> {
String var;
int scopeHere;
}
};
}
}
---
Calling the Trees.getScope for TreePath that corresponds to the "scopeHere" locations will not return correct results. The Scope will not contain variables "var" and "scopeHere".
---
class Test {
void t(int i) {
long local;
System.err.println(switch (i) {
case 0 -> {
String var;
int scopeHere;
yield "";
}
default -> {
String var;
int scopeHere;
yield "";
}
});
switch (i) {
case 0 -> {
String var;
int scopeHere;
}
default -> {
String var;
int scopeHere;
}
};
}
}
---
Calling the Trees.getScope for TreePath that corresponds to the "scopeHere" locations will not return correct results. The Scope will not contain variables "var" and "scopeHere".