Bug 546645 - [1.8][quick assist] Wrong "convert to method reference" refactoring offered
Summary: [1.8][quick assist] Wrong "convert to method reference" refactoring offered
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.11   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-23 04:15 EDT by Lukas Eder CLA
Modified: 2023-04-21 19:55 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2019-04-23 04:15:00 EDT
Consider this program:

// -----------------------------------------------
import java.util.function.Function;

public class Test {
    public static void main(String[] args) {
        f(s -> s.m(s));
    }

    static void f(Function<X, X> f) {}

    interface X {
        X m(X x);
    }
}
// -----------------------------------------------

Now click on the lambda and choose the quick fix "convert to method reference". The following, illegal program is produced:

// -----------------------------------------------
import java.util.function.Function;

public class Test {

    public static void main(String[] args) {
        f(s::m);
    }

    static void f(Function<X, X> f) {
    }

    interface X {
        X m(X x);
    }
}
// -----------------------------------------------
Comment 1 Jay Arthanareeswaran CLA 2019-04-23 04:25:29 EDT
Moving to UI for investigation.
Comment 2 Eclipse Genie CLA 2021-04-13 00:01:15 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Eclipse Genie CLA 2023-04-21 19:55:02 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.