Monday, January 19, 2009

Open Type can't find your class?

I ran into an annoying case when switching frequently between workspaces and doing some really mean things to a couple of them with swapping out external frameworks repeatedly. Somehow I managed to corrupt my type caches in Eclipse so that the Open Type dialog would just be missing some entries (which is REALLY annoying, I might add). This would also manifest as java type completion not working for the missing classes. Maybe there's a nice way in Eclipse to do this, but I couldn't find it, but you can toss your type caches. Quit Eclipse, go to workspace/.metadata/.plugins/org.eclipse.jdt.core and remove *.index and savedIndexNames.txt. When you restart Eclipse it will rebuild the entire type cache and life should be happy again.

25 comments:

Unknown said...

Nice one. That saved me an hour or two this morning. Thanks.

Unknown said...

Thanks! I had the same issue and this worked for me as well. This also affected Open Type Hierarchy. The problem seemed to start after some serious refactoring involving moving classes from one project to another and renaming some classes.

Unknown said...

Yupp, happens to work for me, too. And affected was also the "referenced in workspace" and the "call hierarchy".

yadog said...

Made my morning as well

Unknown said...

Any idea what to do if deleting the indexes fails to fix things? In my workspace, it no longer seems to be able to figure out which classes implement which interfaces, etc.

imrahil said...

If deleting the indexes fails to fix thing, you can also (if you use maven) do an "Maven=>Update Project Configuration" on the project where class are missing in the "open type" window.

imrahil said...
This comment has been removed by the author.
Omkar Shetkar said...

Thanks a lot... It saved lot of time...

Triguna Mutuguppe Sripathi said...

I am looking for an exact implementation in my project. Something like given an interface, get me all the classes which implements that interface. Any idea how to do this? This should be same as what Open Type Hierarchy does. Let me know please.

Thanks.
Triguna

curd0 said...
This comment has been removed by the author.
curd0 said...

Your fix is still relevant in 2012! Thank you very much! I wish I found it earlier...

Unknown said...

Thanks, this is a really useful tip.

lopezvit said...

And also relevant on 2013 ;). I was trying everything: changing eclipse, java version (1.6, 1.7, x64, x86) and I was becoming crazy....Thank you a lot.
By the way, if you use a lot the "Open implementation" there is a very useful plugin->Implementators, you can do the same with alt + F3 and since the type hierachy wasn't working I was very sad...

Unknown said...

Saved me from going insane. Thank you.

Unknown said...

Thank You!! (working in Eclipse 3.7.2)

Lakil said...

thank you!! it's working

Free blogger said...

Thanks Mike! It worked very well.

Adam said...

And 2014!

tiga2001 said...

You should also check that little arrow on the right of the search box to see if you have selected any working sets. I had been working on multiple projects so thought it would be a good idea to filter them by working sets, but then it didn't find an entire project's worth of files. Talk about irony.

Ian Mayo said...

Still valid in 2015!

Unknown said...

Also fixed slow "Open Type" and "Open Resource" dialogs

Unknown said...

This fix still works in Eclipse Mars as of 2016-05-18. Also corrects issues with 'Show Declarations' / 'Show References' not finding all of the proper declerations / references in the workspace.

babalucodes said...

Works and saves my day 11/22/2017!
Thank you.

Unknown said...

May work in 2020, Can not find *.index

Unknown said...

WORKS In 2020