Why is it not possible to tell the compiler to override onClick
<p>I am making an Android application, and I have some buttons.
I want to add some listeners to them, so I have implemented <code>android.view.View.OnClickListener</code>, and added listeners to the buttons.</p>

<p>However, at the <code>onClick</code> method, I can't add the <code>Override</code> annotation like this:</p>

<pre><code>@Override
public void onClick(View view) { /* With Override */ }
</code></pre>

<p>But this works:</p>

<pre><code>public void onClick(View view) { /* Without Override */ }
</code></pre>

<p>And if I try to log something in the latter onClick method, it works as intended.</p>

<p>I am using Eclipse, and it keeps telling me that I must override a superclass method.</p>

<p>Why can't I add the <code>Override</code> annotation to it if I'm overriding it?</p>

<p>I am using Ubuntu 11.4, if that matters. <code>java -version</code> returns:</p>

<p><code>java version "1.6.0_24"</code><br/>
<code>Java(TM) SE Runtime Environment (build 1.6.0_24-b07)</code><br/>
<code>Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)</code></p>

<p>Here is the code:</p>

<pre><code>import android.view.View.OnClickListener;

public class Main extends Activity implements OnClickListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

        Button btnFoo = (Button) findViewById(R.id.btnFoo);
        btnFoo.setOnClickListener(this);
    }

    // @Override
    public void onClick(View v) {
        Log.e("foo", "bar");
    }
}
</code></pre>

<p>PS. I'm using Sun JDK 1.6</p>

<p><strong>EDIT:</strong></p>

<p>I've found this applies to most of the methods I'm trying to use, e.g <code>public void run()</code> (from <code>Runnable</code>).</p>
