@Override features

Java 1.5 has a very nice new feature that has gone almost completely unnoticed for now:
If you want to override a method in a subclass, you can now say so explicitly:

The compiler will complain if any method annotated with @Override does not override a base class method. The big advantage is that a typo like

will be rejected by the compiler. The same is true if you use a different type for any of the arguments.
In short it prevents you from overloading a method when you intended to override it instead.

I filed a tracker entry to explicitly support this feature in Idea (error marking, inspections, etc.). If you'd like to see it implemented, please vote for it. Or just have some discussion:

Please sign in to leave a comment.