Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319603 - [1.5][compiler] eclipse fails with 2 generics methods with the same name while javac succeeds
Summary: [1.5][compiler] eclipse fails with 2 generics methods with the same name whil...
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.6.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-12 11:58 EDT by Missing name CLA
Modified: 2010-08-26 09:23 EDT (History)
2 users (show)

See Also:
Olivier_Thomann: review+


Attachments
ant build.xml (554 bytes, text/xml)
2010-07-12 11:59 EDT, Missing name CLA
no flags Details
Class exhibiting the bug (1.56 KB, application/octet-stream)
2010-07-12 12:01 EDT, Missing name CLA
no flags Details
Patch under consideration (8.33 KB, patch)
2010-07-13 11:33 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name CLA 2010-07-12 11:58:23 EDT
Build Identifier: 20100617-1415

If a class has two methods with generic arguments, one with arguments being subclasses of the other, e.g. :

<T> Collection<T> inter(Collection<T> a, Collection<T> b)
<T> Set<T> inter(Set<T> a, Set<T> b)

then eclipse forgets about the type parameter : in the second method return inter(b, a); yields "Type mismatch: cannot convert from Set<Object> to Set<T>". javac has no problem with this code.


If you rename the first method the problem goes away.

Reproducible: Always

Steps to Reproduce:
1. download both build.xml and CollectionUtils.java
2. put CollectionUtils.java in folder named "src"
3. run ant
4. you should see "CollectionUtils.main() success"
5. try to compile the same class with Eclipse
6. Type mismatch: cannot convert from Set<Object> to Set<T> at line 36
Comment 1 Missing name CLA 2010-07-12 11:59:48 EDT
Created attachment 174060 [details]
ant build.xml
Comment 2 Missing name CLA 2010-07-12 12:01:02 EDT
Created attachment 174061 [details]
Class exhibiting the bug
Comment 3 Missing name CLA 2010-07-12 12:05:34 EDT
I forgot to add that this used to work in eclipse-jee-galileo-SR1. It stopped working in eclipse-jee-galileo-SR2
Comment 4 Srikanth Sankaran CLA 2010-07-13 07:22:27 EDT
(In reply to comment #3)
> I forgot to add that this used to work in eclipse-jee-galileo-SR1. It stopped
> working in eclipse-jee-galileo-SR2

Regression introduced by the fix for bug 287592.
Under investigation.
Comment 5 Srikanth Sankaran CLA 2010-07-13 11:33:33 EDT
Created attachment 174167 [details]
Patch under consideration
Comment 6 Srikanth Sankaran CLA 2010-07-13 11:37:41 EDT
Olivier, please review for 3.6.1
This is a regression introduced in 3.5.2 & 3.6 M3.
Comment 7 Srikanth Sankaran CLA 2010-07-14 01:07:03 EDT
(In reply to comment #6)
> Olivier, please review for 3.6.1

Easier to review if you start with  ParameterizedGenericMethodBinding.java
and then look at Scope.java. Other changes logically follow from there.
Comment 8 Olivier Thomann CLA 2010-07-21 11:47:47 EDT
Looks good.
Comment 9 Srikanth Sankaran CLA 2010-07-22 00:29:25 EDT
Released in HEAD for 3.7 M1
Released in 3.6 maintenance stream for 3.6.1
Comment 10 Satyam Kandula CLA 2010-08-05 01:33:36 EDT
Verified for 3.7M1 using build I20100802-1800
Comment 11 Srikanth Sankaran CLA 2010-08-05 02:43:03 EDT
Change status to RESOLVED rather than VERIFIED as this
fix needs to be re-verified for 3.6.1
Comment 12 Frederic Fusier CLA 2010-08-26 09:23:04 EDT
Verified for 3.6.1 using build M20100825-0800.