Bug 345949 - [compiler] Inconsistent name clash behavior vis-a-vis javac7
Summary: [compiler] Inconsistent name clash behavior vis-a-vis javac7
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.8 M2   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-16 09:47 EDT by Srikanth Sankaran CLA
Modified: 2011-09-12 20:48 EDT (History)
2 users (show)

See Also:
srikanth_sankaran: review+


Attachments
Proposed patch (18.93 KB, patch)
2011-06-07 05:05 EDT, Satyam Kandula CLA
no flags Details | Diff
Synchronized patch (17.11 KB, patch)
2011-08-22 03:12 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-16 09:47:20 EDT
The following program triggers a name clash error
from javac 7 while eclipse compiles it silently.

class A<T> {}
class Super {
    static void foo(A<Number> p) {}
}
class Sub extends Super {
    static void foo(A<Integer> p) {}
}

Needs to be investigated. This is a follow up from bug 334306.
Comment 1 Srikanth Sankaran CLA 2011-05-27 03:22:49 EDT
Satyam, please take a look.
Comment 2 Srikanth Sankaran CLA 2011-06-04 21:25:23 EDT
See also oracle/sun bugs 6793555, 6910491, 5009937
Comment 3 Srikanth Sankaran CLA 2011-06-06 04:35:41 EDT
Retagging. Not a 1.7 issue per se. Targetting 3.8.
Comment 4 Satyam Kandula CLA 2011-06-07 05:05:46 EDT
Created attachment 197485 [details]
Proposed patch

In this patch, I put an additional check for static in Java7 compliance mode. 

There is still one case where Javac7 behaves differently. Javac doesn't show up  any error but Eclipse does show. I believe Eclipse behavior is correct as the number of type parameters are different.
########
class Base {
    static void foo() {}
}
class Sub extends Base {
    static <T> void foo() {}
}
#######
This case is discussed in javac bug 6910491, but there it tells that the error message is correct.
Comment 5 Satyam Kandula CLA 2011-06-07 05:07:10 EDT
Srikanth, Please review the patch.
Comment 6 Srikanth Sankaran CLA 2011-06-07 05:12:34 EDT
(In reply to comment #4)
> Created attachment 197485 [details]
> Proposed patch
> 
> In this patch, I put an additional check for static in Java7 compliance mode. 
> 
> There is still one case where Javac7 behaves differently. 

I think this is same as bug 345947 which is open.
Comment 7 Srikanth Sankaran CLA 2011-08-22 03:12:55 EDT
Created attachment 201890 [details]
Synchronized patch

Same patch - synchronized with HEAD.
Comment 8 Srikanth Sankaran CLA 2011-08-22 04:26:30 EDT
(In reply to comment #5)
> Srikanth, Please review the patch.

Patch looks good.  

(In reply to comment #6)

> > There is still one case where Javac7 behaves differently. 
> 
> I think this is same as bug 345947 which is open.

I think we need some code akin to what Ayush introduced for bug
354579 for this case too. However this can be handled in the
context of bug 345947.
Comment 9 Satyam Kandula CLA 2011-08-23 02:17:24 EDT
Released on HEAD
Comment 10 Ayushman Jain CLA 2011-09-12 20:48:41 EDT
Verified for 3.8M2 using build I20110911-2000.