Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341462 - [1.7][search][diamond] Search doesn't return the reference to a function when called with diamond constructor
Summary: [1.7][search][diamond] Search doesn't return the reference to a function when...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-31 07:11 EDT by Satyam Kandula CLA
Modified: 2011-08-05 02:54 EDT (History)
4 users (show)

See Also:


Attachments
Patch for the test (3.76 KB, patch)
2011-05-17 05:10 EDT, Satyam Kandula CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Satyam Kandula CLA 2011-03-31 07:11:03 EDT
In the given testcase, 
#########
public class X<T> {
		T field1;
		public X(T param) {
			field1 = param;
		}
		public static void testFunction(String param){
			System.out.println(1);
		}
		public static void testFunction(Object Param) {
			System.out.println(2);
		}
		public T getField() {
			return field1;
		}
		public static void main(String[] args) {
			X.testFunction(new X<>("hello").getField());
		}
		
}
########
Search for testFunction(String Param) doesn't return anything. However, search for testFunction(Object Param) does return the call from main, which is clearly wrong.
Comment 1 Satyam Kandula CLA 2011-03-31 11:20:13 EDT
This seems to be a problem with the compiler, probably not yet implemented. The test is actually test007 of GenericsRegressionTest_1_7. The call is getting binded to testFunction(Object) causing the unexpected behavior.
Srikanth, can you please confirm if this is yet to be done.
Comment 2 Srikanth Sankaran CLA 2011-03-31 23:53:42 EDT
(In reply to comment #1)
> This seems to be a problem with the compiler, probably not yet implemented. The

[...]

> Srikanth, can you please confirm if this is yet to be done.

Yes, this is one of the open issues still being worked on. I think the
fix in the compiler will likely automatically resolve this issue. We can
wait for bug 339478 to be resolved to retest.

(In reply to comment #0)

[...]

> Search for testFunction(String Param) doesn't return anything. However, search
> for testFunction(Object Param) does return the call from main, which is clearly
> wrong.

I have to violently disagree. It _is_ wrong, but not clearly wrong :)

The leap from inferring the unspecified type argument to be
Object to String instead requires the application of a page
long worth of dreadfully dense, highly pedantic veribiage,
(reminds me of the Arthur Eddington's repartee around understanding
relativity theory) is by no means clear.
Comment 3 Srikanth Sankaran CLA 2011-04-23 21:31:00 EDT
(In reply to comment #2)

> Yes, this is one of the open issues still being worked on. I think the
> fix in the compiler will likely automatically resolve this issue. We can
> wait for bug 339478 to be resolved to retest.

Yes, the latest patch for bug 339478  fixes this automatically.
Once that patch is released, this bug can be closed with a regression
test.
Comment 4 Satyam Kandula CLA 2011-05-17 05:10:14 EDT
Created attachment 195823 [details]
Patch for the test

Thanks Srikanth for the patch for the test.
Comment 5 Satyam Kandula CLA 2011-05-17 05:13:41 EDT
Fix for bug 339478 has fixed the problem. 
Released the test for this scenario.
Comment 6 Stephan Herrmann CLA 2011-06-28 07:11:25 EDT
Verified using patch feature 1.0.0-20110623-0900