]> source.dussan.org Git - aspectj.git/commitdiff
generics
authorAndy Clement <aclement@vmware.com>
Fri, 2 Mar 2012 16:15:27 +0000 (08:15 -0800)
committerAndy Clement <aclement@vmware.com>
Fri, 2 Mar 2012 16:15:27 +0000 (08:15 -0800)
testing/src/org/aspectj/testing/harness/bridge/AbstractRunSpec.java
testing/testsrc/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java
tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java

index f3d260028cb6d6b8d0b65cc4c1faa70ecb33f8b1..d45037aac8eeb39ac2fe94d7b126c8890e3e01f8 100644 (file)
@@ -89,7 +89,7 @@ abstract public class AbstractRunSpec implements IRunSpec {
        protected final ArrayList<String> paths;
        // XXXXXunused protected final ArrayList /*ISourceLocation*/ sourceLocations; // XXX remove?
        protected final ArrayList<IRunSpec> children;
-       protected final ArrayList /* DirChanges.Spec */dirChanges;
+       protected final ArrayList<DirChanges.Spec> dirChanges;
        protected XMLNames xmlNames;
        protected String comment;
 
@@ -775,10 +775,10 @@ abstract public class AbstractRunSpec implements IRunSpec {
                private boolean verbose;
 
                /** null unless parent set options for children to consider */
-               final private ArrayList /* String */parentOptions;
+               final private ArrayList<String> parentOptions;
 
                public RT() {
-                       parentOptions = new ArrayList();
+                       parentOptions = new ArrayList<String>();
                }
 
                public boolean isVerbose() {
@@ -878,15 +878,15 @@ abstract public class AbstractRunSpec implements IRunSpec {
                        if (LangUtil.isEmpty(validOptions) || LangUtil.isEmpty(parentOptions)) {
                                return new String[0];
                        }
-                       ArrayList result = new ArrayList();
+                       ArrayList<String> result = new ArrayList<String>();
                        // boolean haveOption = false;
                        for (int i = 0; i < validOptions.length; i++) {
                                String option = validOptions[i];
                                if (LangUtil.isEmpty(option)) {
                                        continue;
                                }
-                               for (ListIterator iter = parentOptions.listIterator(); iter.hasNext();) {
-                                       String parentOption = (String) iter.next();
+                               for (ListIterator<String> iter = parentOptions.listIterator(); iter.hasNext();) {
+                                       String parentOption = iter.next();
                                        if (parentOption.startsWith(option)) {
                                                result.add(parentOption);
                                                if (absorb) {
@@ -899,7 +899,7 @@ abstract public class AbstractRunSpec implements IRunSpec {
                }
 
                /** Get ListIterator that permits removals */
-               ListIterator getListIterator() {
+               ListIterator<String> getListIterator() {
                        return parentOptions.listIterator();
                }
 
index f6e59abdc664868d6a7fff891f8fde25cbe6c34f..6ab5a386b6e86eb737f8372b4ca707fcb7807008 100644 (file)
@@ -32,7 +32,7 @@ import junit.framework.TestCase;
 public class AjcTaskCompileCommandTest extends TestCase {
     static boolean loggedWarning = false;
     static boolean runAllTests = true;
-    static ArrayList tempFiles = new ArrayList();
+    static ArrayList<File> tempFiles = new ArrayList<File>();
     
     private static File getClassesDir() {
         File tempDir = FileUtil.getTempDir("AjcTaskCompileCommandTest-classes");
@@ -40,7 +40,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
         return tempDir;
     }
 
-    private static void addCommonArgs(ArrayList list) {
+    private static void addCommonArgs(ArrayList<String> list) {
         list.add("-d");
         list.add(getClassesDir().getAbsolutePath());
         list.add("-classpath");
@@ -109,7 +109,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
     void runSimpleTest(String path, int expectedErrors) {
         File file = new File(path);
         assertTrue(path, file.canRead());
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         addCommonArgs(list);
         if (path.endsWith(".lst")) {
             list.add("-argfile");
@@ -123,7 +123,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
         runTest(list, expectedErrors);
     }
     
-    void runTest(ArrayList args, int expectedErrors) {
+    void runTest(ArrayList<String> args, int expectedErrors) {
         AjcTaskCompileCommand command =
             new AjcTaskCompileCommand();
         MessageHandler handler = new MessageHandler();
index a87d563c6013a84e376bafe11aa700781f066bdb..10c108067248e5d604416a77e521cbfe42201c29 100644 (file)
@@ -61,8 +61,8 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
                        // System.out.println("kvp: " + object + " = " + m.get(object));
                        // }
                        // }
-                       for (Iterator i = node.getChildren().iterator(); i.hasNext();) {
-                               dumptree((IProgramElement) i.next(), indent + 2);
+                       for (Iterator<IProgramElement> i = node.getChildren().iterator(); i.hasNext();) {
+                               dumptree( i.next(), indent + 2);
                        }
                }
        }
@@ -88,17 +88,12 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
        public int getRelationshipCount(String project) {
                IRelationshipMap relmap = getModelFor(project).getRelationshipMap();
                int ctr = 0;
-               Set entries = relmap.getEntries();
-               for (Iterator iter = entries.iterator(); iter.hasNext();) {
+               Set<String> entries = relmap.getEntries();
+               for (Iterator<String> iter = entries.iterator(); iter.hasNext();) {
                        String hid = (String) iter.next();
-                       List rels = relmap.get(hid);
-                       for (Iterator iterator = rels.iterator(); iterator.hasNext();) {
-                               IRelationship ir = (IRelationship) iterator.next();
-                               List targets = ir.getTargets();
-                               for (Iterator iterator2 = targets.iterator(); iterator2.hasNext();) {
-                                       String thid = (String) iterator2.next();
-                                       ctr++;
-                               }
+                       List<IRelationship> rels = relmap.get(hid);
+                       for (Iterator<IRelationship> iterator = rels.iterator(); iterator.hasNext();) {
+                               ctr+=iterator.next().getTargets().size();
                        }
                }
                return ctr;
@@ -114,14 +109,13 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
        private void constructUpToDateLstFile(String pname, String configname) {
                File projectBase = new File(sandboxDir, pname);
                File toConstruct = new File(projectBase, configname);
-               List filesForCompilation = new ArrayList();
+               List<String> filesForCompilation = new ArrayList<String>();
                collectUpFiles(projectBase, projectBase, filesForCompilation);
 
                try {
                        FileOutputStream fos = new FileOutputStream(toConstruct);
                        DataOutputStream dos = new DataOutputStream(fos);
-                       for (Iterator iter = filesForCompilation.iterator(); iter.hasNext();) {
-                               String file = (String) iter.next();
+                       for (String file: filesForCompilation) {
                                dos.writeBytes(file + "\n");
                        }
                        dos.close();
@@ -130,7 +124,7 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
                }
        }
 
-       private void collectUpFiles(File location, File base, List collectionPoint) {
+       private void collectUpFiles(File location, File base, List<String> collectionPoint) {
                String contents[] = location.list();
                if (contents == null)
                        return;