Summary: | Overloaded methods with different type parameters cause compilation error. | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Alessandro Nistico <alienisty> |
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> |
Status: | CLOSED DUPLICATE | QA Contact: | |
Severity: | major | ||
Priority: | P3 | CC: | amj87.iitr, srikanth_sankaran |
Version: | 3.6 | ||
Target Milestone: | 3.6 M2 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Alessandro Nistico
2010-06-08 01:44:12 EDT
This is a defect in the Sun/Oracle compiler. See http://bugs.sun.com/view_bug.do?bug_id=6182950 fixed and released only in the JDK 7 stream. Accordingly if I compile the snippet attached to this bug using javac 7 I get: BadOverloading.java:7: name clash: size(List<Long>) and size(List<Integer>) have the same erasure public long size(List<Long> large) { ^ 1 error (In reply to comment #0) > In fact type parameters are part of the method signature and then, the methods > in the example have different signature. List<Long> and List<Integer> both decay to just List after type erasure. So there is no difference in the method signature and both methods have the same erasure and hence constitute an error according to JLS 8.4.8.3 *** This bug has been marked as a duplicate of bug 289247 *** Verified for 3.6RC4 using build I20100603-1500. |