aspose file tools*
The moose likes Beginning Java and the fly likes Type mismatch: cannot convert from Override to Annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Type mismatch: cannot convert from Override to Annotation" Watch "Type mismatch: cannot convert from Override to Annotation" New topic
Author

Type mismatch: cannot convert from Override to Annotation

Sasha Ruehmkorf
Ranch Hand

Joined: Mar 29, 2007
Posts: 115
I am using Eclipse and I always get the above mentioned message when hoovering the mouse over the word Override. I don't have a clue what to do...

class ObjektMitFinalize{

int [] intArray = new int[100];

@Override
protected void finalize(){
}
}
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi Sasha,

I had the same problem also.

In my case I had a class named "Override" that caused the error. The class was in the same package.


Yours,
Bu.
[ April 01, 2007: Message edited by: Burkhard Hassel ]

all events occur in real time
Sasha Ruehmkorf
Ranch Hand

Joined: Mar 29, 2007
Posts: 115
That was the problem.
Thank you!!!
shakthi balaji
Greenhorn

Joined: Oct 13, 2010
Posts: 3
Thanks! That saved my time.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39877
    
  28
Common problem; the answer is never to create a class with the same name as a class in the package you are importing. That implicitly includes the java.lang package.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39877
    
  28
Alternatively, you can use the fully‑qualified names of the classes imported.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Type mismatch: cannot convert from Override to Annotation