@Override specification changes in Java 6

Between Java 5 and Java 6 changes to the specification of @Override have been made. In Java 6 it is possible to add the @Override annotation to methods that implement methods of an interface which is not allowed in Java 5.

I noticed the difference when a friend told me that he had to remove all the @Override annotations to make his Java 6 project compile with Java 5.

The interesting thing is that there is no documentation about this change. The API specification of @Override is exactly the same in both Java versions. I found out that this was forgotten by Sun developers. Peter, a former developer at Sun, calls it the @Override Snafu.

Leave a Reply