Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome lanneluc2004-10-11 05:38:53 -0400
committerJerome lanneluc2004-10-11 05:38:53 -0400
commit5f82220f4336a56f36a705b37e0452f48eb82dd9 (patch)
tree077a51d0b2c2ca70c62ef76236c0828b0083a46a
parent6635f8a9a49dfb93a63a851a607addfcd6d83842 (diff)
downloadeclipse.jdt.core-5f82220f4336a56f36a705b37e0452f48eb82dd9.tar.gz
eclipse.jdt.core-5f82220f4336a56f36a705b37e0452f48eb82dd9.tar.xz
eclipse.jdt.core-5f82220f4336a56f36a705b37e0452f48eb82dd9.zip
75842
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties2
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html16
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java94
3 files changed, 55 insertions, 57 deletions
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index cc69182e13..7504cd27b3 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -12,7 +12,7 @@
### compiler
compiler.name = Eclipse Java Compiler
-compiler.version = 0.452_R30x
+compiler.version = 0.453_R30x
compiler.copyright = Copyright IBM Corp 2000, 2004. All rights reserved.
### scanning
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index e2447c59bf..ab8b728b20 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -35,6 +35,22 @@
</tr>
</table>
+<a name="v_453"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0.1 Build - ?th October 2004
+<br>Project org.eclipse.jdt.core v_453_R30x
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_453_R30x">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=75842">75842</a>
+Performance Regression in NameLookup.seekPackageFragments
+
<a name="v_452"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
index 80f473d6b8..255b7763a7 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
@@ -290,51 +290,28 @@ public class NameLookup implements SuffixConstants {
* only exact name matches qualify when <code>false</code>
*/
public IPackageFragment[] findPackageFragments(String name, boolean partialMatch) {
- int count= this.packageFragmentRoots.length;
if (partialMatch) {
- name= name.toLowerCase();
- for (int i= 0; i < count; i++) {
- IPackageFragmentRoot root= this.packageFragmentRoots[i];
- IJavaElement[] list= null;
- try {
- list= root.getChildren();
- } catch (JavaModelException npe) {
- continue; // the package fragment root is not present;
- }
- int elementCount= list.length;
- IPackageFragment[] result = new IPackageFragment[elementCount];
- int resultLength = 0;
- for (int j= 0; j < elementCount; j++) {
- IPackageFragment packageFragment= (IPackageFragment) list[j];
- if (nameMatches(name, packageFragment, true)) {
- result[resultLength++] = packageFragment;
+ String prefix = name.toLowerCase();
+ ArrayList pkgs = null;
+ Iterator keys = this.packageFragments.keySet().iterator();
+ while (keys.hasNext()) {
+ String pkgName = (String) keys.next();
+ if (pkgName.toLowerCase().startsWith(prefix)) {
+ IPackageFragment[] fragments = (IPackageFragment[]) this.packageFragments.get(pkgName);
+ for (int i = 0, length = fragments == null ? 0 : fragments.length; i < length; i++) {
+ if (pkgs == null) pkgs = new ArrayList();
+ pkgs.add(fragments[i]);
}
}
- if (resultLength > 0) {
- System.arraycopy(result, 0, result = new IPackageFragment[resultLength], 0, resultLength);
- return result;
- } else {
- return null;
- }
}
+ if (pkgs == null) return null;
+ int resultLength = pkgs.size();
+ IPackageFragment[] result = new IPackageFragment[resultLength];
+ pkgs.toArray(result);
+ return result;
} else {
- IPackageFragment[] fragments= (IPackageFragment[]) this.packageFragments.get(name);
- if (fragments != null) {
- IPackageFragment[] result = new IPackageFragment[fragments.length];
- int resultLength = 0;
- for (int i= 0; i < fragments.length; i++) {
- IPackageFragment packageFragment= fragments[i];
- result[resultLength++] = packageFragment;
- }
- if (resultLength > 0) {
- System.arraycopy(result, 0, result = new IPackageFragment[resultLength], 0, resultLength);
- return result;
- } else {
- return null;
- }
- }
+ return (IPackageFragment[]) this.packageFragments.get(name);
}
- return null;
}
/**
@@ -492,25 +469,30 @@ public class NameLookup implements SuffixConstants {
* only exact name matches qualify when <code>false</code>
*/
public void seekPackageFragments(String name, boolean partialMatch, IJavaElementRequestor requestor) {
- int count= this.packageFragmentRoots.length;
- String matchName= partialMatch ? name.toLowerCase() : name;
- for (int i= 0; i < count; i++) {
- if (requestor.isCanceled())
- return;
- IPackageFragmentRoot root= this.packageFragmentRoots[i];
- IJavaElement[] list= null;
- try {
- list= root.getChildren();
- } catch (JavaModelException npe) {
- continue; // this root package fragment is not present
- }
- int elementCount= list.length;
- for (int j= 0; j < elementCount; j++) {
+ if (partialMatch) {
+ String prefix = name.toLowerCase();
+ Iterator keys = this.packageFragments.keySet().iterator();
+ while (keys.hasNext()) {
if (requestor.isCanceled())
return;
- IPackageFragment packageFragment= (IPackageFragment) list[j];
- if (nameMatches(matchName, packageFragment, partialMatch))
- requestor.acceptPackageFragment(packageFragment);
+ String pkgName = (String) keys.next();
+ if (pkgName.toLowerCase().startsWith(prefix)) {
+ IPackageFragment[] pkgs = (IPackageFragment[]) this.packageFragments.get(pkgName);
+ for (int i = 0, length = pkgs == null ? 0 : pkgs.length; i < length; i++) {
+ if (requestor.isCanceled())
+ return;
+ requestor.acceptPackageFragment(pkgs[i]);
+ }
+ }
+ }
+ } else {
+ IPackageFragment[] pkgs = (IPackageFragment[]) this.packageFragments.get(name);
+ if (pkgs != null) {
+ for (int i = 0, length = pkgs.length; i < length; i++) {
+ if (requestor.isCanceled())
+ return;
+ requestor.acceptPackageFragment(pkgs[i]);
+ }
}
}
}

Back to the top