mrj760 opened a new issue, #8495: URL: https://github.com/apache/netbeans/issues/8495
### Apache NetBeans version Apache NetBeans 25 ### What happened Pretty difficult to title this one or succinctly describe it. Easier to just look at the before/after... ...But basically if you have a switch case that uses "when" and there is an instantiation within it -- if you were to refactor the class name (of the thing being instantiated) the "when" clauses get duplicated. ### Language / Project Type / NetBeans Component Maven Application ### How to reproduce Example 1. Going to refactor A->B. Before: ``` public class Test { record A() { } void method(Object o) { switch(o) { case Integer i when i == 0 -> { var r = new A(); } default -> { } } } } ``` After: ``` public class Test { record B() { } void method(Object o) { switch(o) { case Integer i when i == 0 when i == 0 -> { var r = new B(); } default -> { } } } } ``` Example 2 _(Same process, but with some more conditions in the `when`)_: Before: ``` public class Test { record A() { } void method(Object o) { switch(o) { case Integer i when i == 0 || i == 0 || i == 0 -> { var r = new A(); } default -> { } } } } ``` After: ``` public class Test { record B() { } void method(Object o) { switch(o) { case Integer i when i == 0 || i == 0 || i == 0 when i == 0 || i == 0 || i == 0 -> { var r = new B(); } default -> { } } } } ``` ### Did this work correctly in an earlier version? No / Don't know ### Operating System Win10 ### JDK OpenJDK21 ### Apache NetBeans packaging Apache NetBeans provided installer ### Anything else Just some lines from the IDE log that seemed relevant. Saw these after doing Undo for the refactor. I deleted lines that seemed irrelevant. ``` WARNING [null]: Last record repeated 2 more times. INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: org.netbeans.modules.java.editor.semantic.SemanticHighlighter@65fd803a : class org.netbeans.modules.java.editor.semantic.SemanticHighlighter ignored cancel for 102 ms. INFO [org.netbeans.modules.websvc.editor.hints.WebServicesRulesEngine]: Unknown element type: RECORD. INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@625e1119 called start multiple times INFO [null]: Last record repeated again. WARNING [null]: Last record repeated again. INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@424ae5ef called start multiple times INFO [org.netbeans.modules.websvc.editor.hints.WebServicesRulesEngine]: Unknown element type: RECORD. WARNING [null]: Last record repeated again. INFO [org.netbeans.modules.websvc.editor.hints.WebServicesRulesEngine]: Unknown element type: RECORD. WARNING [null]: Last record repeated again. INFO [org.netbeans.modules.websvc.editor.hints.WebServicesRulesEngine]: Unknown element type: RECORD. INFO [org.netbeans.modules.websvc.editor.hints.WebServicesRulesEngine]: Unknown element type: RECORD. ``` ### 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: notifications-unsubscr...@netbeans.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists