nmatt opened a new issue, #9160:
URL: https://github.com/apache/netbeans/issues/9160
### Apache NetBeans version
Apache NetBeans 28
### What happened
When used as case labels in switch statements, enum constants don't need to
be imported. However, copy-pasting such a switch statements has NetBeans
unnecessarily trigger the "Import Classes" dialog, and creating unnecessary
(and possibly conflicting) imports for the copied enum constants when the
dialog is acknoledged with "OK".
### Language / Project Type / NetBeans Component
Java, Editor, Refactoring
### How to reproduce
Example
```java
switch (Thread.currentThread().getState())
{
case NEW: System.out.println("new"); break;
case BLOCKED: System.out.println("blocked"); break;
// etc.
}
```
Copy the switch statement and paste it into the same or a differen Java
source file.
=> The "Import Classes" dialog appears, unnecessarily wanting to add imports
for the enum constants.
The same happens for arrow-style (`->`) case statements.
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Windows
### JDK
JDK 21
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
NetBeans should IMO recognize when an enum constant occurs within a `case`
construct in the copy-pasted code, and for such occurrence not regard the
constants as being in need of imports.
### Are you willing to submit a pull request?
No
--
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