Bug 71241

Summary: [1.5] different methods with same erasure should not override
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dirk_baeumer
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2004-08-02 12:04:00 EDT
200406251208 + jdt from 20040801:

In the following example, B#useList() does not override A#useList, since the
argument types don't match:

class A {
	List<String> useList(List<String> la) {
		la.add("asdf");
		return la;
	}
}

class B extends A {
	List useList(List lb) {
		lb.add(new Integer(17));
		return lb;
	}
}

JDK 1.5.0-beta-b32 reports a compile error "name clash: useList(java.util.List)
in p.B and useList(java.util.List<java.lang.String>) in p.A have the same
erasure, yet neither overrides the other", whereas the eclipse compiler
generates classfiles in which the methods do override. Running ...
public class User {
	public static void main(String[] args) {
		A a= new B();
		List list= new ArrayList();
		List list2= a.useList(list);
		System.out.println(list2.get(0));
	}
}
... with JDK 1.5.0-beta-b32 then prints 17.
Comment 1 Kent Johnson CLA 2004-08-03 14:10:58 EDT
Compiling & running this code with JDK 1.5.0-beta-b60 prints 17.

The compile error has been replaced with unchecked conversion warnings.
Comment 2 Kent Johnson CLA 2004-08-06 13:15:12 EDT
Fixed in HEAD & added tests 274-278.