Index: search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java,v retrieving revision 1.41 diff -u -r1.41 JavaSearchScope.java --- search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 17 May 2005 09:06:03 -0000 1.41 +++ search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 14 Jun 2005 10:24:49 -0000 @@ -133,7 +133,8 @@ if ((includeMask & APPLICATION_LIBRARIES) != 0) { IPath path = entry.getPath(); if (pathToAdd == null || pathToAdd.equals(path)) { - add("", path.toString(), true, access); //$NON-NLS-1$ + String pathToString = path.getDevice() == null ? path.toString() : path.toOSString(); + add("", pathToString, true, access); //$NON-NLS-1$ addEnclosingProjectOrJar(path); } } @@ -145,7 +146,8 @@ || (includeMask & SYSTEM_LIBRARIES) != 0) { IPath path = entry.getPath(); if (pathToAdd == null || pathToAdd.equals(path)) { - add("", path.toString(), true, access); //$NON-NLS-1$ + String pathToString = path.getDevice() == null ? path.toString() : path.toOSString(); + add("", pathToString, true, access); //$NON-NLS-1$ addEnclosingProjectOrJar(path); } } @@ -178,6 +180,7 @@ */ public void add(IJavaElement element) throws JavaModelException { IPath containerPath = null; + String containerPathToString = null; int includeMask = SOURCES | APPLICATION_LIBRARIES | SYSTEM_LIBRARIES; switch (element.getElementType()) { case IJavaElement.JAVA_MODEL: @@ -190,12 +193,13 @@ IPackageFragmentRoot root = (IPackageFragmentRoot)element; IPath rootPath = root.getPath(); containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : rootPath; + containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); IResource rootResource = root.getResource(); if (rootResource != null && rootResource.isAccessible()) { String relativePath = Util.relativePath(rootResource.getFullPath(), containerPath.segmentCount()); - add(relativePath, containerPath.toString(), true, null); + add(relativePath, containerPathToString, true, null); } else { - add("", containerPath.toString(), true, null); //$NON-NLS-1$ + add("", containerPathToString, true, null); //$NON-NLS-1$ } break; case IJavaElement.PACKAGE_FRAGMENT: @@ -203,13 +207,15 @@ if (root.isArchive()) { String relativePath = Util.concatWith(((PackageFragment) element).names, '/'); containerPath = root.getPath(); - add(relativePath, containerPath.toString(), false, null); + containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); + add(relativePath, containerPathToString, false, null); } else { IResource resource = element.getResource(); if (resource != null && resource.isAccessible()) { containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : root.getPath(); + containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); String relativePath = Util.relativePath(resource.getFullPath(), containerPath.segmentCount()); - add(relativePath, containerPath.toString(), false, null); + add(relativePath, containerPathToString, false, null); } } break; @@ -230,7 +236,8 @@ containerPath = root.getPath(); relativePath = getPath(element, true/*relative path*/).toString(); } - add(relativePath, containerPath.toString(), true, null); + containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); + add(relativePath, containerPathToString, true, null); } if (containerPath != null) @@ -342,8 +349,9 @@ IPackageFragmentRoot root = (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); if (root != null && root.isArchive()) { IPath rootPath = root.getPath(); + String rootPathToString = rootPath.getDevice() == null ? rootPath.toString() : rootPath.toOSString(); IPath relativePath = getPath(element, true/*relative path*/); - return indexOf(relativePath.toString(), rootPath.toString()) >= 0; + return indexOf(relativePath.toString(), rootPathToString) >= 0; } return this.indexOf(getPath(element, false/*full path*/).toString(), null) >= 0; } Index: search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java,v retrieving revision 1.140 diff -u -r1.140 IndexManager.java --- search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java 18 Apr 2005 19:21:35 -0000 1.140 +++ search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java 14 Jun 2005 10:24:50 -0000 @@ -189,18 +189,19 @@ } // index isn't cached, consider reusing an existing index file + String containerPathString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); if (reuseExistingFile) { File indexFile = new File(indexLocation); if (indexFile.exists()) { // check before creating index so as to avoid creating a new empty index if file is missing try { - index = new Index(indexLocation, containerPath.toString(), true /*reuse index file*/); //$NON-NLS-1$ + index = new Index(indexLocation, containerPathString, true /*reuse index file*/); //$NON-NLS-1$ indexes.put(indexLocation, index); return index; } catch (IOException e) { // failed to read the existing file or its no longer compatible if (currentIndexState != REBUILDING_STATE) { // rebuild index if existing file is corrupt, unless the index is already being rebuilt if (VERBOSE) - Util.verbose("-> cannot reuse existing index: "+indexLocation+" path: "+containerPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ + Util.verbose("-> cannot reuse existing index: "+indexLocation+" path: "+containerPathString); //$NON-NLS-1$ //$NON-NLS-2$ rebuildIndex(indexLocation, containerPath); return null; } @@ -216,13 +217,13 @@ if (createIfMissing) { try { if (VERBOSE) - Util.verbose("-> create empty index: "+indexLocation+" path: "+containerPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ - index = new Index(indexLocation, containerPath.toString(), false /*do not reuse index file*/); //$NON-NLS-1$ + Util.verbose("-> create empty index: "+indexLocation+" path: "+containerPathString); //$NON-NLS-1$ //$NON-NLS-2$ + index = new Index(indexLocation, containerPathString, false /*do not reuse index file*/); //$NON-NLS-1$ indexes.put(indexLocation, index); return index; } catch (IOException e) { if (VERBOSE) - Util.verbose("-> unable to create empty index: "+indexLocation+" path: "+containerPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ + Util.verbose("-> unable to create empty index: "+indexLocation+" path: "+containerPathString); //$NON-NLS-1$ //$NON-NLS-2$ // The file could not be created. Possible reason: the project has been deleted. return null; } @@ -423,6 +424,7 @@ */ public synchronized Index recreateIndex(IPath containerPath) { // only called to over write an existing cached index... + String containerPathString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); try { // Path is already canonical String indexLocation = computeIndexLocation(containerPath); @@ -431,15 +433,15 @@ ReadWriteMonitor monitor = index == null ? null : index.monitor; if (VERBOSE) - Util.verbose("-> recreating index: "+indexLocation+" for path: "+containerPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ - index = new Index(indexLocation, containerPath.toString(), false /*reuse index file*/); //$NON-NLS-1$ + Util.verbose("-> recreating index: "+indexLocation+" for path: "+containerPathString); //$NON-NLS-1$ //$NON-NLS-2$ + index = new Index(indexLocation, containerPathString, false /*reuse index file*/); //$NON-NLS-1$ this.indexes.put(indexLocation, index); index.monitor = monitor; return index; } catch (IOException e) { // The file could not be created. Possible reason: the project has been deleted. if (VERBOSE) { - Util.verbose("-> failed to recreate index for path: "+containerPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ + Util.verbose("-> failed to recreate index for path: "+containerPathString); //$NON-NLS-1$ //$NON-NLS-2$ e.printStackTrace(); } return null; Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v retrieving revision 1.247 diff -u -r1.247 MatchLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 8 Jun 2005 16:53:08 -0000 1.247 +++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 14 Jun 2005 10:24:52 -0000 @@ -539,12 +539,18 @@ */ protected IJavaElement createHandle(FieldDeclaration fieldDeclaration, TypeDeclaration typeDeclaration, IJavaElement parent) { if (!(parent instanceof IType)) return parent; + IType type = (IType) parent; switch (fieldDeclaration.getKind()) { case AbstractVariableDeclaration.FIELD : case AbstractVariableDeclaration.ENUM_CONSTANT : return ((IType) parent).getField(new String(fieldDeclaration.name)); } + if (type.isBinary()) { + // do not return initializer for binary types + // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=98378 + return type; + } // find occurence count of the given initializer in its type declaration int occurrenceCount = 0; FieldDeclaration[] fields = typeDeclaration.fields; @@ -1904,6 +1910,11 @@ */ protected void reportMatching(CompilationUnitDeclaration unit, boolean mustResolve) throws CoreException { MatchingNodeSet nodeSet = this.currentPossibleMatch.nodeSet; + if (BasicSearchEngine.VERBOSE) { + System.out.println("Report matching: "); //$NON-NLS-1$ + System.out.println(" - node set:\n"+nodeSet); //$NON-NLS-1$ + System.out.println(" - must resolve: "+mustResolve); //$NON-NLS-1$ + } boolean locatorMustResolve = this.patternLocator.mustResolve; if (nodeSet.mustResolve) this.patternLocator.mustResolve = true; if (mustResolve) { @@ -1927,6 +1938,9 @@ nodeSet.addMatch(node, this.patternLocator.resolveLevel(node)); } nodeSet.possibleMatchingNodesSet = new SimpleSet(3); + if (BasicSearchEngine.VERBOSE) { + System.out.println(" - resolved node set:\n"+nodeSet); //$NON-NLS-1$ + } } else { this.unitScope = null; }