Bug 41018

Summary: Method reference with member type parameter(s) not found
Product: [Eclipse Project] JDT Reporter: Knut Radloff <knut_radloff>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Knut Radloff CLA 2003-07-31 11:46:32 EDT
build 20030730

I have a class (in a source folder) with a private methodA. methodA is called 
in another method in the same class as follows:

protected anotherMethod(ClassA var, ClassB arg1)
if (someBoolean) {
    var.m1(arg1,
        methodA(
            arg1,
            ((ClassB.InnerClass) arg1).m1(),
            null),
        false);
    return arg1.m2();
}

When I search for references to methodA I get no hits.
Comment 1 Dani Megert CLA 2003-07-31 11:54:39 EDT
Finding the results is JDT Core.
Comment 2 Jerome Lanneluc CLA 2003-08-26 12:49:38 EDT
This works for me using the following cu:
public class A {
	protected Object anotherMethod(ClassA var, ClassB arg1) {
		if (true) {
		    var.m1(
		    	arg1,
		        methodA(
		            arg1,
		            ((ClassB.InnerClass) arg1).m1(),
		            null),
		        false);
		    return arg1.m2();
		}
		return null;
	}
	Object methodA(ClassB arg1, Object arg2, Object arg3) {
		return null;
	}
}
class ClassA {
	void m1(ClassB arg1, Object arg2, boolean arg3) {
	}
}
class ClassB {
	class InnerClass extends ClassB {
	}
	Object m1() {
		return null;
	}
	Object m2() {
		return null;
	}
}

Do you have more details?
Comment 3 Knut Radloff CLA 2003-08-26 14:40:19 EDT
The key is that the last argument to methodA is of type ClassB.InnerInterface. 
Where ClassB implements Interface and interface Interface { interface 
InnnerInterface {}}

Here's a simplified snippet that demonstrates the problem:

public class A {
	protected void anotherMethod() {
		methodA(null);
	}
	private Object methodA(ClassB.InnerInterface arg3) {
		return null;
	}
}
class ClassB implements InterfaceB {
}
interface InterfaceB {
	interface InnerInterface {
	}
}
Comment 4 Jerome Lanneluc CLA 2003-08-27 06:32:43 EDT
Confirmed. Workaround is to define methodA as follows:

    private Object methodA(InterfaceB.InnerInterface arg3) {
        return null;
    }
Comment 5 Frederic Fusier CLA 2004-07-21 11:47:55 EDT
Fixed and released in HEAD.

Search now find method reference in this peculiar case.

[jdt-core-internal]
Changes done in MethodLocator.matchMethod(MethodBinding)
Test case added in JavaSearchTests
Comment 6 David Audel CLA 2004-09-23 12:18:00 EDT
Verified in I200409230100.