Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 31480 Details for
Bug 120092
[search] Java like extensions functionality causes performance issue for search engine
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to fix this issue
v01-core.txt (text/plain), 5.48 KB, created by
Frederic Fusier
on 2005-12-09 11:40:02 EST
(
hide
)
Description:
Patch to fix this issue
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2005-12-09 11:40:02 EST
Size:
5.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java,v >retrieving revision 1.17 >diff -u -r1.17 ClasspathSourceDirectory.java >--- search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java 7 Dec 2005 11:27:15 -0000 1.17 >+++ search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java 9 Dec 2005 16:37:24 -0000 >@@ -15,7 +15,6 @@ > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; > import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; > import org.eclipse.jdt.internal.core.builder.ClasspathLocation; >@@ -26,7 +25,7 @@ > > IContainer sourceFolder; > SimpleLookupTable directoryCache; >- String[] missingPackageHolder = new String[1]; >+ SimpleLookupTable missingPackageHolder = new SimpleLookupTable(); > char[][] fullExclusionPatternChars; > char[][] fulInclusionPatternChars; > >@@ -41,27 +40,31 @@ > this.directoryCache = null; > } > >-String[] directoryList(String qualifiedPackageName) { >- String[] dirList = (String[]) directoryCache.get(qualifiedPackageName); >- if (dirList == missingPackageHolder) return null; // package exists in another classpath directory or jar >- if (dirList != null) return dirList; >+SimpleLookupTable directoryTable(String qualifiedPackageName) { >+ SimpleLookupTable dirTable = (SimpleLookupTable) directoryCache.get(qualifiedPackageName); >+ if (dirTable == missingPackageHolder) return null; // package exists in another classpath directory or jar >+ if (dirTable != null) return dirTable; > > try { > IResource container = sourceFolder.findMember(qualifiedPackageName); // this is a case-sensitive check > if (container instanceof IContainer) { > IResource[] members = ((IContainer) container).members(); >- dirList = new String[members.length]; >- int index = 0; >+ dirTable = new SimpleLookupTable(); > for (int i = 0, l = members.length; i < l; i++) { > IResource m = members[i]; > String name; >- if (m.getType() == IResource.FILE && org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(name = m.getName())) >- dirList[index++] = name; >+ if (m.getType() == IResource.FILE) { >+ int index = Util.indexOfJavaLikeExtension(name = m.getName()); >+ if (index >= 0) { >+ String fullPath = m.getFullPath().toString(); >+ if (!org.eclipse.jdt.internal.compiler.util.Util.isExcluded(fullPath.toCharArray(), this.fulInclusionPatternChars, this.fullExclusionPatternChars, false/*not a folder path*/)) { >+ dirTable.put(name.substring(0, index), m); >+ } >+ } >+ } > } >- if (index < dirList.length) >- System.arraycopy(dirList, 0, dirList = new String[index], 0, index); >- directoryCache.put(qualifiedPackageName, dirList); >- return dirList; >+ directoryCache.put(qualifiedPackageName, dirTable); >+ return dirTable; > } > } catch(CoreException ignored) { > // treat as if missing >@@ -70,16 +73,6 @@ > return null; > } > >-boolean doesFileExist(String fileName, String qualifiedPackageName) { >- String[] dirList = directoryList(qualifiedPackageName); >- if (dirList == null) return false; // most common case >- >- for (int i = dirList.length; --i >= 0;) >- if (fileName.equals(dirList[i])) >- return true; >- return false; >-} >- > public boolean equals(Object o) { > if (this == o) return true; > if (!(o instanceof ClasspathSourceDirectory)) return false; >@@ -88,20 +81,12 @@ > } > > public NameEnvironmentAnswer findClass(String sourceFileWithoutExtension, String qualifiedPackageName, String qualifiedSourceFileWithoutExtension) { >- >- String sourceFolderPath = this.sourceFolder.getFullPath().toString() + IPath.SEPARATOR; >- char[][] javaLikeExtensions = Util.getJavaLikeExtensions(); >- for (int i = 0, length = javaLikeExtensions.length; i < length; i++) { >- String extension = '.' + new String(javaLikeExtensions[i]); >- String sourceFileName = sourceFileWithoutExtension + extension; >- if (!doesFileExist(sourceFileName, qualifiedPackageName)) continue; // most common case >- >- String qualifiedSourceFileName = qualifiedSourceFileWithoutExtension + extension; >- if (org.eclipse.jdt.internal.compiler.util.Util.isExcluded((sourceFolderPath + qualifiedSourceFileName).toCharArray(), this.fulInclusionPatternChars, this.fullExclusionPatternChars, false/*not a folder path*/)) >- continue; >- IPath path = new Path(qualifiedSourceFileName); >- IFile file = this.sourceFolder.getFile(path); >- return new NameEnvironmentAnswer(new ResourceCompilationUnit(file), null /* no access restriction */); >+ SimpleLookupTable dirTable = directoryTable(qualifiedPackageName); >+ if (dirTable != null && dirTable.elementSize > 0) { >+ IFile file = (IFile) dirTable.get(sourceFileWithoutExtension); >+ if (file != null) { >+ return new NameEnvironmentAnswer(new ResourceCompilationUnit(file), null /* no access restriction */); >+ } > } > return null; > } >@@ -111,7 +96,7 @@ > } > > public boolean isPackage(String qualifiedPackageName) { >- return directoryList(qualifiedPackageName) != null; >+ return directoryTable(qualifiedPackageName) != null; > } > > public void reset() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 120092
: 31480