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

Refactor>Rename messes up javadoc comment formatting. #8233

Open
errael opened this issue Feb 11, 2025 · 7 comments · May be fixed by #8245
Open

Refactor>Rename messes up javadoc comment formatting. #8233

errael opened this issue Feb 11, 2025 · 7 comments · May be fixed by #8245
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) JavaDoc [ci] enable java/javadoc tests and build-javadoc target kind:bug Bug report or fix Regression This used to work!
Milestone

Comments

@errael
Copy link
Contributor

errael commented Feb 11, 2025

Apache NetBeans version

Apache NetBeans IDE 25-rc2

What happened

Product Version: Apache NetBeans IDE 25-rc2

Doing refactor>rename messes up javadoc comments that reference the renamed item.

Have observed

  • spaces removed after period
  • several lines are turned into a single line
  • '*' at the beginning of a line are removed for a few consecutive lines

Language / Project Type / NetBeans Component

java

How to reproduce

  1. Start NB 25-rc2 with no userdir/cachdir
  2. On startup welcome page, NewProject Maven
  3. Make file look like test-file below
  4. Click on m2 in line 20, use context menu Refactor>Rename
  5. Change m2 to someDifferentName

Observe lines 4, 9 (see below): the javadoc comments are incorrectly formatted.

  • There is no space after the initial period, ('.').
  • Multiple lines are turned into a single line.

Also fails in NB 24. Works in NB 23.

test-file

package mavenproject4;

/**
 * This is the class comment.
 * It references {@link #m1() }.
 * It also references {@link #m2() }.
 */
public class Mavenproject4 {
    /**
     * This is another example.
     * It references {@link #m2() }.
     */
    public void m1() {
    }

    /**
     * This is another example.
     * It references {@link #m1() }.
     */
    public void m2() {
    }
}

after refactor rename

package mavenproject4;

/**
 * This is the class comment.It references {@link #m1()}.
 * It also references {@link #someDifferentName() }.
 */
public class Mavenproject4 {
    /**
     * This is another example.It references {@link #someDifferentName()}.
     */
    public void m1() {
    }

    /**
     * This is another example.
     * It references {@link #m1() }.
     */
    public void someDifferentName() {
    }
}

Did this work correctly in an earlier version?

NetBeans 23

Operating System

Linux harmony 6.9.3-76060903-generic #202405300957173877096822.04~d5f7c84 SMP PREEMPT_DYNAMIC Wed F x86_64 x86_64 x86_64 GNU/Linux

JDK

Java: 23.0.1; OpenJDK 64-Bit Server VM 23.0.1+11-39 Runtime: OpenJDK Runtime Environment 23.0.1+11-39 System: Linux version 6.9.3-76060903-generic running on amd64; UTF-8; en_US (nb)

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

every time

Are you willing to submit a pull request?

No

@errael errael added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Feb 11, 2025
@errael
Copy link
Contributor Author

errael commented Feb 11, 2025

Just looked at some notes. This problem seems to occur in several situations. I'm wondering if there's an option I don't know about.

  • "move initializers to constructor" does major screwup.
  • formatting problems with update javadoc with "missing @param tag" hint

@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) JavaDoc [ci] enable java/javadoc tests and build-javadoc target labels Feb 11, 2025
@errael
Copy link
Contributor Author

errael commented Feb 11, 2025

This is a REGRESSION. It worked in NetBeans 23. (updated OP)

@mbien
Copy link
Member

mbien commented Feb 11, 2025

seems to be a side effect of #7491, reverted a few PRs and this was the only revert which changed the behavior back to NB 23.

added a slightly modified reproducer to mbien/nb-reprorepo@995e19d

@mbien mbien added Regression This used to work! and removed needs:triage Requires attention from one of the committers labels Feb 11, 2025
@mbien mbien added this to the NB26 milestone Feb 11, 2025
@mbien
Copy link
Member

mbien commented Feb 12, 2025

@lahodaj this might also affect the VSCode plugin, comment above has a reproducer with instructions.

@lahodaj
Copy link
Contributor

lahodaj commented Feb 12, 2025

Will take a look.

@neilcsmith-net
Copy link
Member

neilcsmith-net commented Feb 12, 2025

This is also reminding me of the behaviour before the fix in #6282 (Creating a comment out of extracted first sentence and body not working correctly.)

@lahodaj
Copy link
Contributor

lahodaj commented Feb 13, 2025

@neilcsmith-net , yes, I think this is about full/split body! Let see how this will work:
#8245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) JavaDoc [ci] enable java/javadoc tests and build-javadoc target kind:bug Bug report or fix Regression This used to work!
Projects
None yet
4 participants