Bug 507936 - Show declaration (F3) on a method not working if followed by some lambda with { }
Summary: Show declaration (F3) on a method not working if followed by some lambda with...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 532935 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-11-22 06:27 EST by David Karnok CLA
Modified: 2022-12-02 17: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 David Karnok CLA 2016-11-22 06:27:51 EST
Eclipse Java EE IDE for Web Developers.

Version: Neon.1a Release (4.6.1)
Build id: 20161007-1200

Given the following class in a plain Java 8 project:


import java.util.function.*;

public class A {
    public static class C {
        public C m() {
            return this;
        }
   
        public s(Consumer<Object> a, Consumer<Object> b) {
        }
    }

    public static void main(String[] args) {
        new C().m().s(v -> System.out.println(v), e -> { System.out.println(e); });
    }
}

Using F3 or CTRL+Click on "m" doesn't work but works for "C", "s" or anything else in that line. If I remove the { } from the second lambda:

        new C().m().s(v -> System.out.println(v), e -> System.out.println(e));

CTRL+Click works for "m" as well.

If I add { } to the first lambda, CLTR+Click on "m" stops working again:

        new C().m().s(v ->  { System.out.println(v); }, e -> System.out.println(e));

(There are no compilation errors.)
Comment 1 David Karnok CLA 2016-11-22 06:49:45 EST
If I add a semicolon before the expression:

;

new C().m().s(v -> System.out.println(v), e -> { System.out.println(e); });


CTLR+Click works on "m"
Comment 2 Noopur Gupta CLA 2016-11-22 07:50:46 EST
It's a bug in ICodeAssist.codeSelect(..) which does not return any Java element in this case. Moving to JDT/Core.
Comment 3 Jay Arthanareeswaran CLA 2016-11-22 09:52:29 EST
Tentatively targeting 4.7.
Comment 4 Dani Megert CLA 2018-04-05 08:37:14 EDT
*** Bug 532935 has been marked as a duplicate of this bug. ***
Comment 5 Manoj N Palat CLA 2018-05-21 06:18:05 EDT
Bulk move out of 4.8
Comment 6 Eclipse Genie CLA 2020-10-16 19:33:50 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 7 Eclipse Genie CLA 2022-12-02 17:35:56 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.