summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Butzke2012-08-29 17:01:28 (EDT)
committerKaren Butzke2012-08-29 17:01:28 (EDT)
commit4eb6cd54720c31e55b23ce2b7f8bd7218341793c (patch)
tree4184c003ac093e9f69d0a1101c1c2f320e3c2244
parentf58571464a578bec1cd744d569f975a66b460abb (diff)
downloadwebtools.dali-4eb6cd54720c31e55b23ce2b7f8bd7218341793c.zip
webtools.dali-4eb6cd54720c31e55b23ce2b7f8bd7218341793c.tar.gz
webtools.dali-4eb6cd54720c31e55b23ce2b7f8bd7218341793c.tar.bz2
minor performance improvement
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
index f3d8958..ba4323d 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
@@ -175,13 +175,15 @@ final class SourceType
FieldDeclaration[] fieldDeclarations = typeDeclaration.getFields();
CounterMap counters = new CounterMap(fieldDeclarations.length);
+ HashSet<JavaResourceField> remainingFields = new HashSet<JavaResourceField>(this.fields);
for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
String fieldName = fragment.getName().getFullyQualifiedName();
int occurrence = counters.increment(fieldName);
- JavaResourceField field = this.getField(fieldName, occurrence);
+ JavaResourceField field = getField(remainingFields, fieldName, occurrence);
field.resolveTypes(fieldDeclaration, fragment);
+ remainingFields.remove(field);
}
}
@@ -470,8 +472,8 @@ final class SourceType
this.addItemToCollection(field, this.fields, FIELDS_COLLECTION);
}
- private JavaResourceField getField(String fieldName, int occurrence) {
- for (JavaResourceField field : this.getFields()) {
+ private static JavaResourceField getField(Collection<JavaResourceField> fields, String fieldName, int occurrence) {
+ for (JavaResourceField field : fields) {
if (field.isFor(fieldName, occurrence)) {
return field;
}
@@ -504,7 +506,7 @@ final class SourceType
String fieldName = fragment.getName().getFullyQualifiedName();
int occurrence = counters.increment(fieldName);
- JavaResourceField field = this.getField(fieldName, occurrence);
+ JavaResourceField field = getField(fieldsToRemove, fieldName, occurrence);
if (field == null) {
this.addField(this.buildField(fieldName, occurrence, fieldDeclaration, fragment));
} else {