Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 522012

Summary: [search] Search references missing a Java 8 method reference in anonymous class method in private method
Product: [Eclipse Project] JDT Reporter: Benjamin DeLillo <ben>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: ben
Version: 4.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
After searching (broken case)
none
After searching (working case) none

Description Benjamin DeLillo CLA 2017-09-07 15:09:58 EDT
Created attachment 270116 [details]
After searching (broken case)

STR:
In a project containing the class below, Ctrl-Shift-G/Search->References->Workspace on the declaration of broken()

Observed Behavior:
Search shows 0 results

Expected Behavior:
Search shows 1 result for the line `someFuture.thenRun(Main.this::broken);`

Additional info:
If the commented line assigning a runnable instance from the method reference is uncommented, then
the search correctly shows 2 results.


package com.example;

import java.util.concurrent.CompletableFuture;

public class Main
{
    CompletableFuture<Void> someFuture = new CompletableFuture<Void>();
    
    public void run()
    {
        // If the following line is uncommented the search correctly show 2 results.
        //Runnable working =  Main.this::broken;
        
        new Runnable()
        {
            @Override
            public void run()
            {
                someFuture.thenRun(Main.this::broken);
                someFuture.complete(null);
            }
        }.run();
    }
    
    // Search references on broken() shows 0 results, but should show 1
    public void broken()
    {
        System.out.println("broken");
    }
    
    public static void main(String... args)
    {
        new Main().run();
    }
}
Comment 1 Benjamin DeLillo CLA 2017-09-07 15:10:48 EDT
Created attachment 270117 [details]
After searching (working case)
Comment 2 Eclipse Genie CLA 2019-10-29 01:29:27 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 Benjamin DeLillo CLA 2019-10-31 11:56:03 EDT
The problem still occurs as of Eclipse 2019-03 (4.11.0)