Open tmulle opened 1 week ago
This is not reproducible with a clean user/cache dir. Steps:
rm -r test-userdir test-cachedir
~/bin/netbeans-22/bin/netbeans --userdir test-userdir --cachedir test-cachedir
(do not import settings from previous version if asked)Mavenproject1.java
public class Mavenproject1
to public interface Mavenproject1
"Hello World!"
and select "Refactor" -> "Introduce" -> "Variable"You can check the message.log and see if something is visibile, but this is not a general problem. Please retest with a clean user+cachedir and see if it is still reproducible.
to extract a statement to a method you have to select the ;
too, otherwise its not statement and it will say invalid selection. Can't reproduce the other things either, "introduce constant" worked too.
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 aclass
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