Bug 509171 - [call hierarchy] doesn't properly expand caller in lambda in "Expand with constructors"
Summary: [call hierarchy] doesn't properly expand caller in lambda in "Expand with con...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: PC Windows 7
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-12-13 12:01 EST by Markus Keller CLA
Modified: 2023-11-06 03:35 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2016-12-13 12:01:37 EST
I20161213-0600

(snippet from bug 509169, but I think the bad search results there are orthogonal to this problem)

Open a Call Hierarchy for callers of method getInput().

The calls in ccc() and in bbb() look good. The last item expands with the constructor "new Runnable() {...}", and the bbb() is found to contain a reference to that constructor.

The call in aaa() should be traceable to aaa() somehow. Currently, that match's element is the "run" method in an type that stands for the lambda expression. That structure is OK, but then the "[constructor]" node should have aaa() as a child. Currently, it has no children.

I think this is a special case that JDT UI should handle specially in the Call Hierarchy.

package xy;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Executors;

public class LambdaAnonymousTest2 {
    public void aaa() {
        Executors.callable(() -> {
            Collections.sort(
                    getInput(),
                    new Comparator<Integer>() {
                        @Override
                        public int compare(Integer a, Integer b) {
                            return diff(a, b);
                        }
                    });
        });
    }

    public void bbb() {
        Executors.callable(new Runnable() {
            @Override
            public void run() {
                Collections.sort(
                        getInput(),
                        new Comparator<Integer>() {
                            @Override
                            public int compare(Integer a, Integer b) {
                                return diff(a, b);
                            }
                        });
            }
        });
    }

    public void ccc() {
        Collections.sort(
                getInput(),
                new Comparator<Integer>() {
                    @Override
                    public int compare(Integer a, Integer b) {
                        return diff(a, b);
                    }
                });
    }

    public static List<Integer> getInput() {
        return Arrays.asList(1, 2, 4, 3);
    }

    public static int diff(Integer a, Integer b) {
        return a - b;
    }
}
Comment 1 Eclipse Genie CLA 2021-11-12 02:48:27 EST
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 2 Alain Picard CLA 2021-11-12 03:19:00 EST
(In reply to Eclipse Genie from comment #1)
> 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.

Problem is still there and getting worse as use of Lambda just keeps increasing.
Comment 3 Eclipse Genie CLA 2023-11-03 18:59:44 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 4 Manuel Steurer CLA 2023-11-06 03:35:13 EST
Problem still exists, in Eclipse 2023-09 the call hierarchy node for the aaa Lambda call shows a question mark icon and doesn't expand further.