Community
Participate
Working Groups
Test case: class Super { static void notOverridden() { return; } } public class Test extends Super { static void notOverridden() { return; } } @@@@ Static methods cannot be overridden but they're hidden (see http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#227928 ). So the current message is wrong. However having the warning is appreciated because hiding static methods is a common programming error for new programmers. Opened bug 90110 for an additional compiler flag.
Version: 3.1.0 Build id: I20050401-1645
Added AnnotationTest#test123-124. Fixed, by turning off complaining in presence of static method.
does this also take care of the folowing? public class Foo { static void foo(){} } class Bar extends Foo{ @Override //should be an error (bug in 3.1M6) static void foo(){} }
We do not complain on latter case, and javac agrees with us.
Added AnnotationTest#tes140
am I correct that it is a bug (in both eclipse and javac)?
@Override is not very strictly spec'ed... so one could say it is a matter of interpretation. If you feel it is bad, please enter a separate defect about your latter issue, for later investigating. For current time being, there are other more critical issues; and given our behavior seems to match others expectation...
will do. i understand it's not high prio though. @Override javadoc says "Indicates that a method declaration is intended to override a method declaration in a superclass." And method overriding (jls3 8.4.8.1) says that overriding only applies to instance methods.
Verified in I20050510-0010