Skip to content

Refactor>Rename messes up javadoc comment formatting. #8233

@errael

Description

@errael

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

Metadata

Metadata

Assignees

No one assigned

    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 targetRegressionThis used to work!kind:bugBug report or fix

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions