Community
Participate
Working Groups
I20060124 Steps (not reproducable): - have a syntax error in a CU (in org.eclipse.jface.text in my case), file is dirty (not saved) - open the manifest of the org.eclipse.jface.text plug-in with the PDE editor - go to the dependencies page and select a dependency (org.eclipse.core.runtime) - from the ctx menu, select "Compute dependency extent" -> got this java.lang.ArrayIndexOutOfBoundsException: 0 at org.eclipse.jdt.internal.core.search.matching.PatternLocator.matchNameValue(PatternLocator.java:269) at org.eclipse.jdt.internal.core.search.matching.PatternLocator.matchesName(PatternLocator.java:244) at org.eclipse.jdt.internal.core.search.matching.TypeReferenceLocator.match(TypeReferenceLocator.java:83) at org.eclipse.jdt.internal.core.search.matching.MatchLocatorParser.getTypeReference(MatchLocatorParser.java:311) at org.eclipse.jdt.internal.compiler.parser.Parser.consumeEnterVariable(Parser.java:2673) at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:4799) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8560) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8730) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8695) at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:7488) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.parseAndBuildBindings(MatchLocator.java:1453) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:956) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1055) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1173) at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:206) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:491) at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:532) at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentOperation.searchForTypesUsed(DependencyExtentOperation.java:149) at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentOperation.checkForJavaDependencies(DependencyExtentOperation.java:135) at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentOperation.execute(DependencyExtentOperation.java:77) at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentQuery.run(DependencyExtentQuery.java:43) at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:94) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
I've reproduce it... It seems that searching for dependencies means that PDE takes all selected plugin types (org.eclipse.core.runtime in your example) and search for references for each one in current plugin (org.eclipse.jface.text in your example). Unfortunately it also searches for references of anonymous types...! This kind of type has an empty name and built search pattern as an empty char arrays as simple name and Search Engine does not handle properly this kind of pattern... I'll add test to avoid to fail in this case but PDE may also avoid to search for this kind of reference which will never return any match... Wassim, what's your mind about this point?
sure. sounds good to me. so all we're talking about here is check that IType.isAnonymous() returns false before we search for references to it, right?
That's right...
Fixed and released in HEAD. When pattern name is an empty char array, then only return accurate if compared name is also empty. Changes done in PatternLocator.matchNameValue(...). Test case added in JavaSearchBugsTests
The PDE side of things was addressed in bug 125442. thanks frederic.
Welcome, wassim :-) Note to verifier that you *definitely* need to have a dirty editor while searching for dependencies otherwise bug cannot happen (there's no anonymous reference in index files => Search Engine will reach pattern locator only if there's at least one working copy in search scope...)
Verified for 3.2 M5 using build I20060215-0010