Bug 527672 - [move method] Moving methods uses in method references introduces compilation error
Summary: [move method] Moving methods uses in method references introduces compilation...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.8   Edit
Hardware: PC Mac OS X
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-23 07:28 EST by Andreas Sewe CLA
Modified: 2022-10-04 09:56 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2017-11-23 07:28:26 EST
Same scenario as Bug 527670 (originally I wanted to report this bug, bug stumbled Bug 527670 when using a Java 9 JRE for my minimal test case :-).

Consider the following class First:

  package org.example;

  import java.util.Arrays;

  public class First {

    public static void main(String[] args) {
Arrays.asList(args).stream().map(First::transform).forEach(System.err::println);;
    }

    public static String transform(String s) {
      return s.toLowerCase();
    }
  }

Select the declaration of "transform" and do a Refactor > Move to another type "org.example.Second".

Under Photon.M3 this breaks the code, i.e., it introduces a compilation error:

public class First {

  public static void main(String[] args) {
    Arrays.asList(args).stream().map(First::Second.transform).forEach(System.err::println);;
  }
}

The First::Second.transform part is broken.
Comment 1 Eclipse Genie CLA 2021-03-08 16:39:36 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 Dmitry Katsubo CLA 2022-10-04 09:56:47 EDT
I have tested on Eclipse v4.25.0.v20220831-1800 – the problem is still there.