eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
[Bug][Inline Method Refactoring] Inline Method refactoring for input program contians Lambda with Method Reference in Super Call produces uncompilable program
- Dominant language
- Java
- Stars
- 59
- Forks
- 127
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 35
Description
## Steps to reproduce
1. Create a class named A:
```
import java.util.function.Consumer;
public class A {
void baseMethod(Consumer consumer) {
consumer.accept("Test");
}
}
```
2. Then, create a class named B:
```
public class B extends A {
void derivedMethod() {
super.baseMethod(System.out::println);
}
static void staticContextMethod(B obj) {
obj.derivedMethod(); // Inline call to derivedMethod()
}
}
```
3. Left click `derivedMethod()` in `obj.derivedMethod();` like I comment in class B. Then, right click -> Refactor -> Inline. Use default configuration to inline this method like following, click ok:

The program is successfully refactored without any warning or exception. The refactored program is following, which contains syntax error:
```
import java.util.function.Consumer;
public class A {
void baseMethod(Consumer consumer) {
consumer.accept("Test");
}
}
public class B extends A {
void derivedMethod() {
super.baseMethod(System.out::println);
}
static void staticContextMethod(B obj) {
super.baseMethod(System.out::println); // syntax error
}
}
```
## 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
Reproduce the issue in Eclipse using the supplied A and B classes and the Inline Method action on derivedMethod(). Trace the Inline Method refactoring entry point and verify that the transformed program remains compilable, especially when a lambda method reference appears in a super call; add or update regression coverage if the project provides a suitable location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100