Community
Participate
Working Groups
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.
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.
I'm using the methods from JDT UI to show the triangle. The override decorator has the same problem.
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() { } }
Bug is fixed by fix for bug 97208. Other issues are fixed by bug 120659