Bug 577539 - [quick fix] "Add missing method" on instance method reference adds to wrong class
Summary: [quick fix] "Add missing method" on instance method reference adds to wrong c...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.22   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-30 14:49 EST by Fabian Pfaff CLA
Modified: 2023-11-21 09:49 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Pfaff CLA 2021-11-30 14:49:14 EST
package example;
public class A {

}

package example;
import java.util.Arrays;
import java.util.List;

public class B {
	
	public void delete() {
		A a = new A();
		List<String> list = Arrays.asList("foo", "bar");
		list.forEach(a::delete|);
	}

}

|: cursor position

Error message: "The type A does not define delete(String) that is applicable here"

Quick fix: "Add missing method 'delete' to class 'B'"

Class B after quick fix:

package com;
import java.util.Arrays;
import java.util.List;

public class B {
	
	public void delete() {
		A a = new A();
		List<String> list = Arrays.asList("foo", "bar");
		list.forEach(a::delete);
	}

	private void delete(String string1) {
	}

}

Expected: Add the missing method to class A.
Comment 1 Fabian Pfaff CLA 2021-11-30 14:56:07 EST
https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/167022 looks like the intention was to not offer a quick fix option for this case?
Comment 2 Eclipse Genie CLA 2023-11-21 09:49:32 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.