netbeans
netbeans copied to clipboard
Introduce Constant and others not working with Interfaces in Netbeans 22
Apache NetBeans version
Apache NetBeans 22
What happened
I'm trying to select a string in my code to make it a global constant in my code using the Refactor->Introduce Constant menu item but it keeps telling me "Invalid Selection"
I highlight the full text string System.out.println("Hello World")
(Hello World for example) and then try to use the menu item and it doesn't work and gives me the error.
I also tried Introduce Variable
and that says the same thing.
I thought we could do this before with strings and select them and make them constants?
UPDATE: I'm trying to do this in an interface
and not a class
Language / Project Type / NetBeans Component
Java Maven Project
How to reproduce
Try to select a string in your code and make it a constant using the Refactor->Introduce Constant menu item.
Did this work correctly in an earlier version?
No / Don't know
Operating System
Linux
JDK
21
Apache NetBeans packaging
Apache NetBeans binary zip
Anything else
No response
Are you willing to submit a pull request?
Yes