]> source.dussan.org Git - aspectj.git/commitdiff
generics
authorAndy Clement <andrew.clement@gmail.com>
Mon, 7 May 2012 17:39:00 +0000 (10:39 -0700)
committerAndy Clement <andrew.clement@gmail.com>
Mon, 7 May 2012 17:39:00 +0000 (10:39 -0700)
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java

index a28e514fcd620e085311adc2afa476456518cc3a..0b620847e80f4697598c8fccadd9d9dcfaaef4db 100644 (file)
@@ -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/* <Pointcut,Pointcut> */<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>();
-               for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
-                       ShadowMunger munger = (ShadowMunger) iter.next();
+               Map<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>();
+               for (ShadowMunger munger: shadowMungers) {
                        Pointcut p = munger.getPointcut();
                        Pointcut newP = shareEntriesFromMap(p, pcMap);
                        newP.m_ignoreUnboundBindingForNames = p.m_ignoreUnboundBindingForNames;
index 6b71647efa5df82d5329058718917dc37b86b447..83b7efdac9ca776d85865d22e092cb2926844ca8 100644 (file)
@@ -34,13 +34,13 @@ import org.aspectj.weaver.tools.TraceFactory;
 
 public class ClassPathManager {
 
-       private List entries;
+       private List<Entry> 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<ZipFile> openArchives = new ArrayList<ZipFile>();
        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<String> classpath, IMessageHandler handler) {
                if (trace.isTraceEnabled())
                        trace.enter("<init>", this, new Object[] { classpath, handler });
-               entries = new ArrayList();
-               for (Iterator i = classpath.iterator(); i.hasNext();) {
+               entries = new ArrayList<Entry>();
+               for (Iterator<String> 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<Entry> 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<Entry> 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<ZipEntryClassFile> getAllClassFiles() throws IOException {
                        ensureOpen();
-                       List ret = new ArrayList();
-                       for (Enumeration e = zipFile.entries(); e.hasMoreElements();) {
-                               ZipEntry entry = (ZipEntry) e.nextElement();
+                       List<ZipEntryClassFile> ret = new ArrayList<ZipEntryClassFile>();
+                       for (Enumeration<? extends ZipEntry> 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();
                        }