apache / apache/netbeans

In-place renaming of private-class method does not rename overrides

Open
#8,788 0 comments 0 reactions 0 assignees View on GitHub
Java kind:bug
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 27

### What happened

When renaming a non-inherited method of a private class with Ctrl+R, NetBeans correctly recognizes that it can be renamed in-place (because the class being private means that method can only be referenced from within the current source file), but doesn't rename any overrides of the method.

### Language / Project Type / NetBeans Component

_No response_

### How to reproduce

Example:
```java
class Example
{
private enum Enum
{
CONSTANT { @Override void renameMe() { } };

abstract void renameMe(); // rename here
}


private interface Interface
{
static Interface INSTANCE = new Interface() { @Override public void renameMe() { } };

void renameMe(); // rename here
}


private static abstract class Class
{
static final Class INSTANCE = new Class() { @Override void renameMe() { } };

void method() { new Class() { @Override void renameMe() { } }; }

abstract void renameMe(); // rename here
}
}
```
Renaming the method with Ctrl+R on the lines indicated by "rename here" will only rename that occurrence, and not any of the overrides.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows

### JDK

JDK 17

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

_No response_

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Reproduce the Ctrl+R rename in the Java example, focusing on the private enum, interface, and abstract class cases. Trace the in-place rename path and how overrides are discovered; done means renaming each indicated declaration also renames all of its overrides without changing unrelated methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.