Bug 346029 - [1.7][compiler] Eclipse compiles code rejected by JDK7
Summary: [1.7][compiler] Eclipse compiles code rejected by JDK7
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: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 01:32 EDT by Srikanth Sankaran CLA
Modified: 2011-08-05 02:54 EDT (History)
2 users (show)

See Also:
satyam.kandula: review+


Attachments
Patch under consideration (13.17 KB, patch)
2011-05-18 05:54 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 Srikanth Sankaran CLA 2011-05-17 01:32:15 EDT
The following code compiles alright with eclipse while
JDK 7b138 rejects it with:

X.java:7: error: methods f(T) from B<String> and f(String) from A<String> are in
herited with the same signature
public class X extends B<String> {
       ^
  where T is a type-variable:
    T extends Object declared in class B
1 error

// ------------------------

class A<T> {
    void f(String s) {}
}
class B<T> extends A<T> {
    void f(T t) {}
}
public class X extends B<String> {
}
Comment 1 Srikanth Sankaran CLA 2011-05-17 01:32:40 EDT
I'll follow up.
Comment 2 Srikanth Sankaran CLA 2011-05-17 02:24:19 EDT
Compare eclipse behavior on:

class X<T> {
    public void m(Number num) {}
    public void m(T t) {}
}
class Y extends X<Number> {}
Comment 3 Srikanth Sankaran CLA 2011-05-18 05:54:03 EDT
Created attachment 195944 [details]
Patch under consideration

This patch fixes the problem for all compliance levels,
though the plan is to release it only in BETA_JAVA7 branch.
So a user will see this fix only when a Java 7 compliant
release is made from eclipse.
Comment 4 Srikanth Sankaran CLA 2011-05-18 07:15:22 EDT
All tests pass. Released in BETA_JAVA7 branch.

Satyam, please review, TIA.
Comment 5 Satyam Kandula CLA 2011-05-19 07:32:17 EDT
The patch looks good to me from a functionality point. However, now there is lot of redundant code out there. The outer for loop is executed only once, there is no need of the skip array and probably the duplicate array is also not necessary.
Comment 6 Srikanth Sankaran CLA 2011-05-19 07:47:31 EDT
(In reply to comment #5)
> The patch looks good to me from a functionality point. However, now there is
> lot of redundant code out there. The outer for loop is executed only once,
> there is no need of the skip array and probably the duplicate array is also not
> necessary.

I agree the fix has rendered a lot of the old code redundant - this slipped
my attention. I suggest we will consider this issue closed as is and I'll
clean this up when I fix bug 334313 (which is in the same area) in the next
week or two -- Thanks.
Comment 7 Satyam Kandula CLA 2011-05-19 10:23:04 EDT
(In reply to comment #6) 
> I agree the fix has rendered a lot of the old code redundant - this slipped
> my attention. I suggest we will consider this issue closed as is and I'll
> clean this up when I fix bug 334313 (which is in the same area) in the next
> week or two -- Thanks.
Sure, That's fine.
Comment 8 Satyam Kandula CLA 2011-07-01 02:24:26 EDT
Verified using Eclipse Java 7 Support(Beta) feature patch v20110623-0900.