lahodaj opened a new pull request, #8312:
URL: https://github.com/apache/netbeans/pull/8312
Consider code like:
```
package javaapplication1;
public class JavaApplication1 {
public static void main(String[] args) {
String str = switch (args.length) {
case 0 -> {
System.err.println("3");
yield "";
}
default -> "";
};
}
}
```
Select these lines:
```
System.err.println("3");
yield "";
```
In the Alt-Enter popup, choose `Introduce Method...`. This leads to:
```
public static void main(String[] args) {
String s = "GTK-test";
String str = switch (args.length) {
case 0 -> {
method();
}
default -> "";
};
}
private static void method() {
System.err.println("3");
yield "";
}
```
which is obviously wrong - it should be something like:
```
public static void main(String[] args) {
String s = "GTK-test";
String str = switch (args.length) {
case 0 -> {
yield method();
}
default -> "";
};
}
private static String method() {
System.err.println("3");
return "";
}
```
This patch attempts to change the introduce hint to do the correct
transformation.
closes 8278
---
### PR approval and merge checklist:
1. [ ] Was this PR [correctly
labeled](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=240884239#PRsandYouAreviewerGuide-PRtriggeredCIJobs(conditionalCIpipeline)),
did the right tests run? When did they run?
2. [ ] Is this PR
[squashed](https://cwiki.apache.org/confluence/display/NETBEANS/git%3A+squash+and+merge)?
3. [ ] Are author name / email address correct? Are
[co-authors](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line)
correctly listed? Do the commit messages need updates?
3. [ ] Does the PR title and description still fit after the Nth iteration?
Is the description sufficient to appear in the release notes?
--
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