eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

[Bug][Pull Up Refactoring] Pull up refactoring for Multiple Anonymous Classes produces confusing warning message

Open
#1,774 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
23h 30m
Merged PRs (30d)
35

Description

## Steps to reproduce
The input program is following:
```
public class A {
public class BaseTargetClass {}

public class OriginalClass {
public int memberVariable = 40;

public void memberMethod() {
new BaseTargetClass() {
void methodToBePulledUp() {
System.out.println("First anonymous class: ");
}
};
new BaseTargetClass() {
void methodToBePulledUp() {
System.out.println("Second anonymous class: ");
}
};
}
}
}
```
Left click the first or the second methodToBePulledUp(), then right click -> Refactor -> Pull Up, a confusing warning message is shown:

![image](https://github.com/user-attachments/assets/cceb0c0d-bcf3-4519-8236-20e73e0873ad)

## Environment
### OS Version
Windows 10, 64-bit Operating System, x64-based processor
### Eclipse Version
Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components)
Version: 2024-09 (4.33.0)
Build id: 20240905-0614
### JDK Version
java version "22.0.1" 2024-04-16
Java(TM) SE Runtime Environment (build 22.0.1+8-16)
Java HotSpot(TM) 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in Eclipse 2024-09 with the Java program and the Pull Up refactoring on either anonymous-class method. Trace the warning produced for multiple anonymous classes and update it so the message is no longer confusing; done means the warning clearly describes the situation for both selections.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.