Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing imports deletes a comment line #7964

Open
JoachimRohde opened this issue Nov 14, 2024 · 1 comment
Open

Fixing imports deletes a comment line #7964

JoachimRohde opened this issue Nov 14, 2024 · 1 comment
Labels
hints Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix

Comments

@JoachimRohde
Copy link

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

@JoachimRohde JoachimRohde added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Nov 14, 2024
@matthiasblaesing matthiasblaesing removed the needs:triage Requires attention from one of the committers label Nov 14, 2024
@matthiasblaesing
Copy link
Contributor

Reproducible.

@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) hints labels Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hints Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix
Projects
None yet
Development

No branches or pull requests

3 participants