One of the nice features in Java 5 is the annotation @Override. It prevents a base class changing underfoot without you realising. For example, consider the base class:

public class Base
{
    protected void record(String name)
    {
        //...
    }
}

Now I can extend the Base class and override the record method as follows:

public class SafeOverride extends Base
{
   @Override
   protected void record(String name)
   {
       //...
   }
}

If the signature of the record method changes in the Base class, then a compilation error will occur when compiling SafeOvverride. This is very useful for preventing subtle bugs.

Now naturally JDK 1.4 does not support `Override, but you can simulate the behaviour using the Javadoc tool and the Javadoc tag {`inheritDoc}. In JDK 1.4 write the SafeOverride class as follows:

public class SafeOverride extends Base
{
    /** {@inheritDoc} */
    protected void record(String name)
    {
        //...
    }
}

Now if the signature of the record method changes in the Base class, then Javadoc will report a warning like:

C:\\tmp\\SafeOverride.java:6: warning - @inheritDoc used but record(String) does not override or implement any method.