Community
Participate
Working Groups
Since static methods can only be hidden and not overriden, @Override cannot be used for them. The following code should report an error or at least a warning. Right we don't report anything. class Base { public static void foo() {} } class Derived extends Base { @Override public static void foo() {} }
Static methods should get complained indeed. Introduced a new problem constant ID: IProblem#StaticMethodOverride This is not a breaking API change, just an additional compiler diagnostic which we were missing incorrectly.
Mike/Jeff - slight API change, but still technically an API change. Can you pls cast your vote ? In the past, we did let new compiler IDs to make it until late in the game. Mostly JDT/UI is the only consumer for these so as to compute quickfixes (for a subset of them).
cc'ing jeff
Can now tell: public static void foo() {} ^^^^^ The method foo() of type Derived cannot be tagged with @Override since it is static
Hmm... actually, only saying: The method foo() of type Derived must override a superclass method wouldn't require any API change at all. Message is not as intuitive, though overriding only occurs in between instance methods; thus it is still accurate.
No need to worry Mike/Jeff. No more API change. Fixed in HEAD. Added AnnotationTest#test194.
Verified for 3.2 M6 using build I20060328-0010
Could the message be improved for 3.3? See also thread "Problem with annotation" on eclipse.newcomer.