Community
Participate
Working Groups
Build 20011107 + Jdtcore from HEAD (~v_212), self-hosting setup. When searching for references to Namelookup.findPackageFragmentRoot(IPath), I obtained 5 matches, where only the last one is a correct one. The 4 previous ones are inaccurate ones. Project jdtui was in source. ?: checkNewName() - org.eclipse.jdt.internal.core.refactoring.rename.RenameSourceFolderRefactoring ?: chooseSourceContainer(IJavaElement) - org.eclipse.jdt.internal.ui.wizards.ContainerPage ?: exportElement(Object, IProgressMonitor) - org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation ?: isOnBuildPath(IJavaProject, IJavaElement) - org.eclipse.jdt.internal.ui.util.JavaModelUtil findPackageFragmentRoot(IPath) - org.eclipse.jdt.internal.core.JavaProject
The test case is as follows: Project P Source folder src1 X.java Source folder src2 X.java Both X.java have references to method foo(). When searching for references to method foo(), P/src2/X.java appears as having an inaccurate match. The problem is that P/src2/X.java is hidden by P/src1/X.java. It should not even be considered as a potential compilation unit. Changed MatchLocator to sort the potential compilation units in the classpath order. This allows to detect hidden types by checking if there is a DuplicateTypes problem after bindings resolution. In this case, the potential compilation unit is skipped.