dbalek commented on PR #8312:
URL: https://github.com/apache/netbeans/pull/8312#issuecomment-6368377030
Consider the following code snippet:
```
public static void main(String[] args) {
String str = switch (args.length) {
case 0 -> {
if (true) {
String j = "";
yield j;
}
yield "";
}
default -> "";
};
}
```
Select these lines:
```
if (true) {
String j = "";
yield j;
}
```
Introduce Method leads to uncompilable source code, where `j` remains inside
the extracted method:
```
public static void main(String[] args) {
String str = switch (args.length) {
case 0 -> {
if (method()) yield j;
yield "";
}
default -> "";
};
}
private static boolean method() {
if (true) {
String j = "";
return true;
}
return false;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists