summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-08-19 07:58:54 +0000
committeracolyer <acolyer>2005-08-19 07:58:54 +0000
commit63bbfa1b26251a7141f15852da8c6024a1a345ed (patch)
treea7b7af0b291e0a1405bedf05bfdee3e331e13ebe
parent5f0844449481c768431b3d99dce0eac8eebd0711 (diff)
downloadaspectj-63bbfa1b26251a7141f15852da8c6024a1a345ed.tar.gz
aspectj-63bbfa1b26251a7141f15852da8c6024a1a345ed.zip
new JDT compiler uses a Map instead of a Hashtable for CompilationUnit.compiledTypes
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java11
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java10
2 files changed, 11 insertions, 10 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java
index 0fc018a8a..bed80f0c9 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java
@@ -13,6 +13,7 @@ package org.aspectj.ajdt.internal.compiler;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Map;
import org.aspectj.bridge.IProgressListener;
import org.aspectj.weaver.IClassFileProvider;
@@ -175,7 +176,7 @@ public class WeaverAdapter implements IClassFileProvider, IWeaveRequestor, Itera
*/
public void acceptResult(UnwovenClassFile result) {
char[] key = result.getClassName().replace('.','/').toCharArray();
- removeFromHashtable(lastReturnedResult.result().compiledTypes,key);
+ removeFromMap(lastReturnedResult.result().compiledTypes,key);
String className = result.getClassName().replace('.', '/');
AjClassFile ajcf = new AjClassFile(className.toCharArray(),
result.getBytes());
@@ -203,20 +204,20 @@ public class WeaverAdapter implements IClassFileProvider, IWeaveRequestor, Itera
compilerAdapter.acceptResult(result.result());
}
- private void removeFromHashtable(Hashtable table, char[] key) {
+ private void removeFromMap(Map aMap, char[] key) {
// jdt uses char[] as a key in the hashtable, which is not very useful as equality is based on being
// the same array, not having the same content.
String skey = new String(key);
char[] victim = null;
- for (Enumeration iter = table.keys(); iter.hasMoreElements();) {
- char[] thisKey = (char[]) iter.nextElement();
+ for (Iterator iter = aMap.keySet().iterator(); iter.hasNext();) {
+ char[] thisKey = (char[]) iter.next();
if (skey.equals(new String(thisKey))) {
victim = thisKey;
break;
}
}
if (victim != null) {
- table.remove(victim);
+ aMap.remove(victim);
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
index c4475d47b..1289922d5 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
@@ -20,6 +20,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
@@ -738,7 +739,6 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
*/
public IIntermediateResultsRequestor getInterimResultRequestor() {
return new IIntermediateResultsRequestor() {
- int lineDelta = 0;
public void acceptResult(InterimCompilationResult result) {
if (progressListener != null) {
compiledCount++;
@@ -761,10 +761,10 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
public void acceptResult(CompilationResult unitResult) {
// end of compile, must now write the results to the output destination
// this is either a jar file or a file in a directory
- if (!(unitResult.hasErrors() && !proceedOnError())) {
- Enumeration classFiles = unitResult.compiledTypes.elements();
- while (classFiles.hasMoreElements()) {
- ClassFile classFile = (ClassFile) classFiles.nextElement();
+ if (!(unitResult.hasErrors() && !proceedOnError())) {
+ Collection classFiles = unitResult.compiledTypes.values();
+ for (Iterator iter = classFiles.iterator(); iter.hasNext();) {
+ ClassFile classFile = (ClassFile) iter.next();
String filename = new String(classFile.fileName());
filename = filename.replace('/', File.separatorChar) + ".class";
try {