eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
[Bug][Pull Up Refactoring] Pull up refactoring for input program contians Lambda Invoking Constructors produces uncompilable program
- 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 class CustomClass {
CustomClass() { System.out.println("Custom class constructor"); }
}
public class NestedOriginalClass extends BaseTargetClass {
void methodToBePulledUp() {
Runnable r = CustomClass::new;
r.run();
}
}
}
}
```
Left click methodToBePulledUp(), then right click -> Refactor -> Pull Up, use the default configuration shown below, click finish:

The refactoring is performed without any warning or exception. The refactored program is following, which contains syntax error:

The specific error information is : No enclosing instance of type A.OriginalClass is accessible. Must qualify the allocation with an enclosing instance of type A.OriginalClass (e.g. x.new A() where x is an instance of A.OriginalClass).
## 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
Research direction
Start by reproducing the issue through Refactor > Pull Up using the Java program in the report, focusing on methodToBePulledUp and the CustomClass::new reference. Trace the Pull Up refactoring entry point in Eclipse JDT UI and inspect the generated program; done means the refactored source compiles without the reported enclosing-instance error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100