Bug 76745 - [navigation] Static overrides are not really overrides
Summary: [navigation] Static overrides are not really overrides
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Tobias Widmer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-21 10:07 EDT by Michael Valenta CLA
Modified: 2006-04-09 19:43 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2004-10-21 10:07:09 EDT
I can use code assist to "override" a static method by typing the first few 
characters and then hitting CTRL_SPACE. The little green triangle will then 
tell me "overides org.eclipse.whatever.staticMethodFromSuperclass". The only 
problem is that static methods do not support the concept of override so, in 
essence, Eclipse is lying to me.

The scenario I got bitten by was that I though the method I was overriding was 
not a static since Eclipse allowed me to override it. Of course, I did not get 
the results I expected since my method was never called by the superclass. 
Eclipse should either not support code assit override in this case or somehow 
let the user know that it is not really an override.
Comment 1 Dirk Baeumer CLA 2004-10-25 06:03:30 EDT
IMO code assist should still offer the method, but we should not state the we
override. Hoewever show the green triangle in this case is a bug. 
Comment 2 Dani Megert CLA 2005-05-30 03:39:45 EDT
I'm using the methods from JDT UI to show the triangle. The override decorator
has the same problem.
Comment 3 Martin Aeschlimann CLA 2005-05-30 06:08:47 EDT
The bug is much funnier: The method created is not the static method, but just a
randomly chosen overridable method. e.g finalize() (see example).

To simply choose one doesn't make sense. Tobias, can you fix that?
But the real bug is that jdt.core offers the override code assist proposal here.

Creating a static method with the same signature as a method from a super type
just asks for trouble. I filed bug 97208.

The ovreride indicator seem to work correctly, Dani.

public class B extends A {

	@Override
	protected void finalize() throws Throwable {
		// TODO Auto-generated method stub
		super.finalize();
	}
}

class A {
	public static void staticM() {
	}
}
Comment 4 Tobias Widmer CLA 2006-04-09 19:43:05 EDT
Bug is fixed by fix for bug 97208.

Other issues are fixed by bug 120659