'Must Override a Superclass Method' Errors after importing a project into Eclipse

Posted by Tim H on Stack Overflow See other posts from Stack Overflow or by Tim H
Published on 2009-11-05T03:17:53Z Indexed on 2010/05/19 22:50 UTC
Read the original article Hit count: 507

Filed under:
|
|
|
|

Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing the error 'The method ?????????? must override a superclass method'.

It may be noteworthy to mention this is with Android projects - for whatever reason, the method argument values are not always populated, so I have to manually populate them myself. For instance:

list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

    		public void onCreateContextMenu(ContextMenu menu, View v,
    				ContextMenuInfo menuInfo) {
    			//These arguments have their correct names
    		}


    	});

will be initially populated like this:

list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

    		public void onCreateContextMenu(ContextMenu arg1, View arg2,
    				ContextMenuInfo arg3) {
    			//This methods arguments were not automatically provided
    		}


    	});

The odd thing is, if I remove my code, and have Eclipse automatically recreate the method, it uses the same argument names I already had, so I don't really know where the problem is, other then it auto-formatting the method for me.

This becomes quite a pain having to manually recreate ALL my overridden methods by hand. If anyone can explain why this happens or how to fix it .. I would be very happy.

Maybe it is due to the way I am formatting the methods, which are inside an argument of another method?

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse