apache / apache/netbeans

"Push down refactoring":changes the method call relationship.

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

Description

### Apache NetBeans version

Apache NetBeans 25

### What happened

Executing pull down refactoring causes changes in code behavior.

### Language / Project Type / NetBeans Component

_No response_

### How to reproduce

Select f(), select Pull down refactoring, which changes the method call relationship. Before refactoring, call the m() method of class A, and after refactoring, call the m() method of class C.
Code before refactoring:
```java
class A {
void m(Object m) {
System.out.println("A");
}
}

class B extends A {
void k(String m) {
System.out.println("B");
}
// pull down 'f()'
void f() {
m("1");
}
}

class C extends B{

void m(String m) {
System.out.println("B");
}
}
```
Code after refactoring:
```java
class A {
void m(Object m) {
System.out.println("A");
}
}

class B extends A {
void k(String m) {
System.out.println("B");
}
}

class C extends B{

void m(String m) {
System.out.println("B");
}

// pull down 'f()'
void f() {
m("1");
}
}
```

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

No / Don't know

### Operating System

windows11

### JDK

17

### Apache NetBeans packaging

Apache NetBeans platform

### Anything else

_No response_

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

No

Contributor guide

Open the contributing guide

Research direction

Start with the Pull Down Refactoring action and reproduce the Java example from the issue on NetBeans 25 with JDK 17. Compare the method call before and after moving f() from B to C; done means the call still resolves to A.m(Object), rather than changing to C.m(String).

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.