Open
Description
Apache NetBeans version
Apache NetBeans 24 release candidate
What happened
In the following code the first comment line gets deleted when CTRL+SHIFT+I is pressed to fix imports:
package com.mycompany.fiximportdeletescommentdemo;
import java.util.List;
// https://github.com/toby1984/swing-autocomplete
// xxx
// https://github.com/toby1984/swing-autocomplete/blob/master/src/test/java/de/codesourcery/swing/autocomplete/Demo.java
public class FixImportDeletesCommentDemo {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
I could reproduce this behaviour with NetBeans 22 and NetBeans 24-rc3. It only occurs if all imports are about to be removed and the code does not contain any unresolved imports. If those criterias are met the issue is always reproduceable.
A trivial Maven project to demonstrate this issue: FixImportDeletesCommentDemo.zip
Language / Project Type / NetBeans Component
Java editor
How to reproduce
See text above and attached project.
Did this work correctly in an earlier version?
No / Don't know
Operating System
Linux Mint 21.3 Cinnamon
JDK
17.0.12; OpenJDK 64-Bit Server VM 17.0.12+7-Ubuntu-1ubuntu222.04
Apache NetBeans packaging
Apache NetBeans binary zip
Anything else
No response
Are you willing to submit a pull request?
No