Bug 111350 - [1.5][compiler] method override and generics
Summary: [1.5][compiler] method override and generics
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-03 12:36 EDT by Dominik Gruntz CLA
Modified: 2006-01-10 09:22 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik Gruntz CLA 2005-10-03 12:36:10 EDT
Version: 3.1.1
Build id: M20050929-0840

Version: 3.2M2
Build id: I20050923-1000

Consider the following Code example:

----------------------------------------------------
class Array<T> {
	public void add(T t){
		System.out.println("Array<T>:add");
	}
}

class NumericArray<T extends Number> extends Array<T> {
	@Override
	public void add(Number n){
		System.out.println("NumericArray<T>:add");
	}
}
----------------------------------------------------

Eclipse gives an error on the @Override annotation  "the method add(Number)
of type NumericArray<T> must override a superclass method"
together with the marker
"overrides Array<T>.add"

If add is called on an instance of e.g. NumericArray<Integer>, then
Eclipse calls Array<T>.add, whereas java version 1.5.0_05 calls
NumericArray<T>:add.

Summary:
- Javac 1.5.0_05 considers NumericArray.add as an override
- Eclipse compiler considers NumericArray.add as an overload
- Eclipse override marker considers NumericArray.add as an override
Comment 1 Kent Johnson CLA 2005-10-13 12:56:16 EDT
Added MethodVerifier test073

Released into HEAD and the 3.1.2 branch
Comment 2 Frederic Fusier CLA 2006-01-10 05:48:09 EST
Verified for 3.1.2 using build M20060109-1200.
Comment 3 Frederic Fusier CLA 2006-01-10 09:22:29 EST
Verified for 3.2 M4 using build I20051215-1506.