Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Lanneluc2007-11-02 08:50:55 -0400
committerJerome Lanneluc2007-11-02 08:50:55 -0400
commit79bb706109cd69aca686a5f4f3a6814137f4251a (patch)
tree05fc3b46bfaa26b434d267d7ce4b30e820cdf7cc
parent340620dc002e5675dc6df491d69d5b880de3161a (diff)
downloadeclipse.jdt.core-79bb706109cd69aca686a5f4f3a6814137f4251a.tar.gz
eclipse.jdt.core-79bb706109cd69aca686a5f4f3a6814137f4251a.tar.xz
eclipse.jdt.core-79bb706109cd69aca686a5f4f3a6814137f4251a.zip
R3_0_maintenance - 208263v_456a_R30x
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties6
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html14
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java113
3 files changed, 83 insertions, 50 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 057c348270..2f55b4fb94 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
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
+# Copyright (c) 2000, 2007 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v1.0
# which accompanies this distribution, and is available at
@@ -12,8 +12,8 @@
### compiler
compiler.name = Eclipse Java Compiler
-compiler.version = 0.456_R30x
-compiler.copyright = Copyright IBM Corp 2000, 2005. All rights reserved.
+compiler.version = 0.457_R30x
+compiler.copyright = Copyright IBM Corp 2000, 2007. All rights reserved.
### scanning
scanning.start = Collecting source files inside {0}
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 0c326a5327..e346779fe6 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -40,6 +40,20 @@
</tr>
</table>
+<a name="v_457_R30x"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0.3 Build - %date%
+<br>Project org.eclipse.jdt.core v_457_R30x
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_457_R30x">cvs</a>).
+<h2>
+What's new in this drop</h2>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=208263">208263</a>
+[ast rewrite] performance problems with lots of changes
+
<a name="v_456_R30x"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java
index 3cdda7bdea..d928f6dbc3 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
@@ -160,7 +161,7 @@ public final class RewriteEventStore {
private Iterator trackedNodeIter;
public ParentIterator() {
- this.eventIter= RewriteEventStore.this.events.iterator();
+ this.eventIter= RewriteEventStore.this.eventLookup.keySet().iterator();
if (RewriteEventStore.this.nodeCopySources != null) {
this.sourceNodeIter= RewriteEventStore.this.nodeCopySources.iterator();
} else {
@@ -190,7 +191,7 @@ public final class RewriteEventStore {
*/
public Object next() {
if (this.eventIter.hasNext()) {
- return ((EventHolder) this.eventIter.next()).parent;
+ return this.eventIter.next();
}
if (this.sourceNodeIter.hasNext()) {
return ((CopySourceInfo) this.sourceNodeIter.next()).getStartNode();
@@ -213,9 +214,9 @@ public final class RewriteEventStore {
public final static int ORIGINAL= 2;
public final static int BOTH= NEW | ORIGINAL;
-
- /** all events */
- final List events;
+
+ /** all events by parent*/
+ final Map eventLookup;
/** cache for last accessed event */
private EventHolder lastEvent;
@@ -240,7 +241,7 @@ public final class RewriteEventStore {
private INodePropertyMapper nodePropertyMapper;
public RewriteEventStore() {
- this.events= new ArrayList();
+ this.eventLookup= new HashMap();
this.lastEvent= null;
this.editGroups= null; // lazy initialization
@@ -262,7 +263,7 @@ public final class RewriteEventStore {
}
public void clear() {
- this.events.clear();
+ this.eventLookup.clear();
this.lastEvent= null;
this.trackedNodes= null;
@@ -280,16 +281,21 @@ public final class RewriteEventStore {
EventHolder holder= new EventHolder(parent, childProperty, event);
- // check if already in list
- for (int i= 0; i < this.events.size(); i++) {
- EventHolder curr= (EventHolder) this.events.get(i);
- if (curr.parent == parent && curr.childProperty == childProperty) {
- this.events.set(i, holder);
- this.lastEvent= null;
- return;
+ List entriesList = (List) this.eventLookup.get(parent);
+ if (entriesList != null) {
+ for (int i= 0; i < entriesList.size(); i++) {
+ EventHolder curr= (EventHolder) entriesList.get(i);
+ if (curr.childProperty == childProperty) {
+ entriesList.set(i, holder);
+ this.lastEvent= null;
+ return;
+ }
}
+ } else {
+ entriesList= new ArrayList(3);
+ this.eventLookup.put(parent, entriesList);
}
- this.events.add(holder);
+ entriesList.add(holder);
}
public RewriteEvent getEvent(ASTNode parent, StructuralPropertyDescriptor property) {
@@ -299,11 +305,14 @@ public final class RewriteEventStore {
return this.lastEvent.event;
}
- for (int i= 0; i < this.events.size(); i++) {
- EventHolder holder= (EventHolder) this.events.get(i);
- if (holder.parent == parent && holder.childProperty == property) {
- this.lastEvent= holder;
- return holder.event;
+ List entriesList = (List) this.eventLookup.get(parent);
+ if (entriesList != null) {
+ for (int i= 0; i < entriesList.size(); i++) {
+ EventHolder holder= (EventHolder) entriesList.get(i);
+ if (holder.childProperty == property) {
+ this.lastEvent= holder;
+ return holder.event;
+ }
}
}
return null;
@@ -337,9 +346,10 @@ public final class RewriteEventStore {
public boolean hasChangedProperties(ASTNode parent) {
- for (int i= 0; i < this.events.size(); i++) {
- EventHolder holder= (EventHolder) this.events.get(i);
- if (holder.parent == parent) {
+ List entriesList = (List) this.eventLookup.get(parent);
+ if (entriesList != null) {
+ for (int i= 0; i < entriesList.size(); i++) {
+ EventHolder holder= (EventHolder) entriesList.get(i);
if (holder.event.getChangeKind() != RewriteEvent.UNCHANGED) {
return true;
}
@@ -349,17 +359,20 @@ public final class RewriteEventStore {
}
public PropertyLocation getPropertyLocation(Object value, int kind) {
- for (int i= 0; i < this.events.size(); i++) {
- EventHolder holder= (EventHolder) this.events.get(i);
- RewriteEvent event= holder.event;
- if (isNodeInEvent(event, value, kind)) {
- return new PropertyLocation(holder.parent, holder.childProperty);
- }
- if (event.isListRewrite()) {
- RewriteEvent[] children= event.getChildren();
- for (int k= 0; k < children.length; k++) {
- if (isNodeInEvent(children[k], value, kind)) {
- return new PropertyLocation(holder.parent, holder.childProperty);
+ for (Iterator iter= this.eventLookup.values().iterator(); iter.hasNext();) {
+ List events= (List) iter.next();
+ for (int i= 0; i < events.size(); i++) {
+ EventHolder holder= (EventHolder) events.get(i);
+ RewriteEvent event= holder.event;
+ if (isNodeInEvent(event, value, kind)) {
+ return new PropertyLocation(holder.parent, holder.childProperty);
+ }
+ if (event.isListRewrite()) {
+ RewriteEvent[] children= event.getChildren();
+ for (int k= 0; k < children.length; k++) {
+ if (isNodeInEvent(children[k], value, kind)) {
+ return new PropertyLocation(holder.parent, holder.childProperty);
+ }
}
}
}
@@ -379,16 +392,19 @@ public final class RewriteEventStore {
* @return RewriteEvent
*/
public RewriteEvent findEvent(Object value, int kind) {
- for (int i= 0; i < this.events.size(); i++) {
- RewriteEvent event= ((EventHolder) this.events.get(i)).event;
- if (isNodeInEvent(event, value, kind)) {
- return event;
- }
- if (event.isListRewrite()) {
- RewriteEvent[] children= event.getChildren();
- for (int k= 0; k < children.length; k++) {
- if (isNodeInEvent(children[k], value, kind)) {
- return children[k];
+ for (Iterator iter= this.eventLookup.values().iterator(); iter.hasNext();) {
+ List events= (List) iter.next();
+ for (int i= 0; i < events.size(); i++) {
+ RewriteEvent event= ((EventHolder) events.get(i)).event;
+ if (isNodeInEvent(event, value, kind)) {
+ return event;
+ }
+ if (event.isListRewrite()) {
+ RewriteEvent[] children= event.getChildren();
+ for (int k= 0; k < children.length; k++) {
+ if (isNodeInEvent(children[k], value, kind)) {
+ return children[k];
+ }
}
}
}
@@ -625,8 +641,11 @@ public final class RewriteEventStore {
public String toString() {
StringBuffer buf= new StringBuffer();
- for (int i= 0; i < this.events.size(); i++) {
- buf.append(this.events.get(i).toString()).append('\n');
+ for (Iterator iter = this.eventLookup.values().iterator(); iter.hasNext();) {
+ List events = (List) iter.next();
+ for (int i= 0; i < events.size(); i++) {
+ buf.append(events.get(i).toString()).append('\n');
+ }
}
return buf.toString();
}

Back to the top