When I tried to perform "introduce method" refactoring on "int b= 10;" using refactoring tool in NetBeans, it displayed a warning and failed to do the refactoring.
Language / Project Type / NetBeans Component
Java Maven Project Java Application
How to reproduce
Input Program:
public interface I1 {
int foo(int a);
}
interface I2 {
I1 i1= (a) -> {
int b= 10;
return a + b;
};
}
Expected Result: (from Refactoring tool of IntelliJ)
public interface I1 {
int foo(int a);
}
interface I2 {
I1 i1 = (a) -> {
int b = getB();
return a + b;
};
private static int getB() {
int b = 10;
return b;
}
}
Apache NetBeans version
Apache NetBeans 21
What happened
When I tried to perform "introduce method" refactoring on "int b= 10;" using refactoring tool in NetBeans, it displayed a warning and failed to do the refactoring.
Language / Project Type / NetBeans Component
Java Maven Project Java Application
How to reproduce
Input Program:
Steps: Select "int b = 10;" Refactor -> Introduce -> Method
Actual Result: a warning: "Invalid Selection."
Expected Result: (from Refactoring tool of IntelliJ)
Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows 11
JDK
22.0.1
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
It always occurs.
Are you willing to submit a pull request?
No