From 30c38582eef681e4a8f1098a298c143a190fd840 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Mon, 7 May 2012 10:39:00 -0700 Subject: [PATCH] generics --- .../org/aspectj/weaver/bcel/BcelWeaver.java | 5 ++-- .../aspectj/weaver/bcel/ClassPathManager.java | 27 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index a28e514fc..0b620847e 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -641,9 +641,8 @@ public class BcelWeaver { // across the set of pointcuts.... // Use a map from key based on pc equality, to value based on // pc identity. - Map/* */ pcMap = new HashMap(); - for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) { - ShadowMunger munger = (ShadowMunger) iter.next(); + Map pcMap = new HashMap(); + for (ShadowMunger munger: shadowMungers) { Pointcut p = munger.getPointcut(); Pointcut newP = shareEntriesFromMap(p, pcMap); newP.m_ignoreUnboundBindingForNames = p.m_ignoreUnboundBindingForNames; diff --git a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java index 6b71647ef..83b7efdac 100644 --- a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java +++ b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java @@ -34,13 +34,13 @@ import org.aspectj.weaver.tools.TraceFactory; public class ClassPathManager { - private List entries; + private List entries; // In order to control how many open files we have, we maintain a list. // The max number is configured through the property: // org.aspectj.weaver.openarchives // and it defaults to 1000 - private List openArchives = new ArrayList(); + private List openArchives = new ArrayList(); private static int maxOpenArchives = -1; private static final int MAXOPEN_DEFAULT = 1000; @@ -54,11 +54,11 @@ public class ClassPathManager { maxOpenArchives = 1000; } - public ClassPathManager(List classpath, IMessageHandler handler) { + public ClassPathManager(List classpath, IMessageHandler handler) { if (trace.isTraceEnabled()) trace.enter("", this, new Object[] { classpath, handler }); - entries = new ArrayList(); - for (Iterator i = classpath.iterator(); i.hasNext();) { + entries = new ArrayList(); + for (Iterator i = classpath.iterator(); i.hasNext();) { String name = (String) i.next(); addPath(name, handler); } @@ -95,8 +95,8 @@ public class ClassPathManager { public ClassFile find(UnresolvedType type) { String name = type.getName(); - for (Iterator i = entries.iterator(); i.hasNext();) { - Entry entry = (Entry) i.next(); + for (Iterator i = entries.iterator(); i.hasNext();) { + Entry entry = i.next(); try { ClassFile ret = entry.find(name); if (ret != null) @@ -113,7 +113,7 @@ public class ClassPathManager { public String toString() { StringBuffer buf = new StringBuffer(); boolean start = true; - for (Iterator i = entries.iterator(); i.hasNext();) { + for (Iterator i = entries.iterator(); i.hasNext();) { if (start) { start = false; } else { @@ -270,11 +270,11 @@ public class ClassPathManager { return null; // This zip will be closed when necessary... } - public List getAllClassFiles() throws IOException { + public List getAllClassFiles() throws IOException { ensureOpen(); - List ret = new ArrayList(); - for (Enumeration e = zipFile.entries(); e.hasMoreElements();) { - ZipEntry entry = (ZipEntry) e.nextElement(); + List ret = new ArrayList(); + for (Enumeration e = zipFile.entries(); e.hasMoreElements();) { + ZipEntry entry = e.nextElement(); String name = entry.getName(); if (hasClassExtension(name)) ret.add(new ZipEntryClassFile(this, entry)); @@ -345,8 +345,7 @@ public class ClassPathManager { } public void closeArchives() { - for (Iterator i = entries.iterator(); i.hasNext();) { - Entry entry = (Entry) i.next(); + for (Entry entry: entries) { if (entry instanceof ZipFileEntry) { ((ZipFileEntry) entry).close(); } -- 2.39.5