Re: Question regarding JavaType existence
Hugo Palma <[email protected]> Mon, 6 Feb 2006 18:16:12 +0000
| Newsgroups | gmane.comp.ide.eclipse.spindle.devel |
|---|---|
| Message-ID | <[email protected]> |
There's no exists() in IntelliJ API :o( I think i'll spend the rest of the afternoon trying all PsiClass methods to see if anything gets broken when i remove the jar from the classpath :o) Oh well, it's all to a greater end... :o) Cheers Hugo On 06/02/06, Geoff Longman <[email protected]> wrote: > > The JDT's IType.exists() just works in all cases :-) > > Actually, behind the scenes JDT is caching metadata (using a > complicated LRU cache) about the type. It detects the removal of > classpath entries and invalidates the all the metadata it holds for, > among other things, any IType in the removed entities (like jars). > > So, if later I call exists(), the metadata is gone and JDT tries to > recreate it. But it can't (the jar is gone) so exists() returns false. > > The key to all the above is that JDT only looks at jars that are in > the classpath. They can still be in the project but if they aren't in > the classpath they are just files to JDT and not interesting at all. > > IDEA doesn't have a similar concept? perhaps the PSI tree for the type > becomes inaccessible once the jar is removed from the classpath? > > Geoff > > > > > > On 2/6/06, Hugo Palma <[email protected]> wrote: > > I was creating some tests and a problem came up with my implementation > of > > the exists() method of the IJavaType. > > > > Like you said before, the exists() should return false if the underlying > > real type is deleted. This is easy when you're talking about source > types, > > but gets tricky when it comes to classpath types. The problem is that at > the > > time the type is returned the project has the library in it's classpath, > > sometime after that it's possible that the library was removed from the > > project classpath, althout the .jar is still there. The exists() method > > should return false now. I checked your implementation in > > com.iw.plugins.spindle.core.eclipse.lang.EclipseJavaType > > and all you do is call the IType.exists() method. Does Eclipse > > implementation provide this behaviour ? > > > > I can of course implement this behaviour but after i checked your > > implementation to see how you handled this i just started to think if i > > could be seeing problems where there are none. > > > > > > Cheers > > > > Hugo > > > > > -- > The Spindle guy. http://spindle.sf.net > Get help with Spindle: > http://lists.sourceforge.net/mailman/listinfo/spindle-user > Blog: http://jroller.com/page/glongman > Feature Updates: http://spindle.sf.net/updates >