I have a class that is extending Java\'s ArrayList. I\'m currently using Java build 1.6.0_22-b04. Looks like this:
public class TokenSequence extends ArrayList&
Change it to public boolean add(Token o). (Note return and parameter type)
In order to override a method, your override must have the exact same signature, including the return type.
Since your method has a different return type, it doesn't actually override the base add method.
The reason that it won't even compile is that because it doesn't override the base method, you end up with two different add methods, both of which are callable by your derived class.
However, due to type erasure, they both actually take an Object parameter, which is illegal.