@@ -1293,7 +1293,7 @@ public abstract class World implements Dump.INode { | |||
if (!memoryProfiling) { | |||
return; | |||
} | |||
Reference r = null; | |||
Reference<? extends ResolvedType> r = null; | |||
while ((r=rq.poll()) != null) { | |||
collectedTypes++; | |||
} |
@@ -23,6 +23,7 @@ import java.util.Collections; | |||
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | |||
import org.aspectj.weaver.AnnotationAJ; | |||
import org.aspectj.weaver.AnnotationTargetKind; | |||
import org.aspectj.weaver.ConcreteTypeMunger; | |||
import org.aspectj.weaver.ISourceContext; | |||
import org.aspectj.weaver.ReferenceType; | |||
import org.aspectj.weaver.ReferenceTypeDelegate; | |||
@@ -34,6 +35,7 @@ import org.aspectj.weaver.UnresolvedType; | |||
import org.aspectj.weaver.WeakClassLoaderReference; | |||
import org.aspectj.weaver.WeaverStateInfo; | |||
import org.aspectj.weaver.World; | |||
import org.aspectj.weaver.patterns.Declare; | |||
import org.aspectj.weaver.patterns.PerClause; | |||
/** | |||
@@ -62,7 +64,7 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega | |||
public ReflectionBasedReferenceTypeDelegate() { | |||
} | |||
public void initialize(ReferenceType aType, Class aClass, ClassLoader aClassLoader, World aWorld) { | |||
public void initialize(ReferenceType aType, Class<?> aClass, ClassLoader aClassLoader, World aWorld) { | |||
this.myClass = aClass; | |||
this.resolvedType = aType; | |||
this.world = aWorld; | |||
@@ -302,22 +304,12 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega | |||
return null; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.ReferenceTypeDelegate#getDeclares() | |||
*/ | |||
public Collection getDeclares() { | |||
// no declares | |||
return Collections.EMPTY_SET; | |||
public Collection<Declare> getDeclares() { | |||
return Collections.emptySet(); | |||
} | |||
/* | |||
* @see org.aspectj.weaver.ReferenceTypeDelegate#getTypeMungers() | |||
*/ | |||
public Collection getTypeMungers() { | |||
// no type mungers | |||
return Collections.EMPTY_SET; | |||
public Collection<ConcreteTypeMunger> getTypeMungers() { | |||
return Collections.emptySet(); | |||
} | |||
/* | |||
@@ -363,29 +355,14 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega | |||
return null; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.ReferenceTypeDelegate#getResolvedTypeX() | |||
*/ | |||
public ReferenceType getResolvedTypeX() { | |||
return this.resolvedType; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.ReferenceTypeDelegate#doesNotExposeShadowMungers() | |||
*/ | |||
public boolean doesNotExposeShadowMungers() { | |||
return false; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.ReferenceTypeDelegate#getDeclaredGenericSignature() | |||
*/ | |||
public String getDeclaredGenericSignature() { | |||
// no generic sig in 1.4 | |||
return null; |
@@ -166,11 +166,11 @@ public abstract class AbstractTrace implements Trace { | |||
} | |||
} | |||
protected String formatArray (Object obj) { | |||
protected String formatArray(Object obj) { | |||
return obj.getClass().getComponentType().getName() + "[" + Array.getLength(obj) + "]"; | |||
} | |||
protected String formatCollection (Collection c) { | |||
protected String formatCollection(Collection<?> c) { | |||
return c.getClass().getName() + "(" + c.size() + ")"; | |||
} | |||
@@ -929,11 +929,11 @@ public class LangUtil { | |||
* @param array the Object[] to convert (may be null) | |||
* @return the List corresponding to array (never null) | |||
*/ | |||
public static List<Object> arrayAsList(Object[] array) { | |||
public static <T> List<T> arrayAsList(T[] array) { | |||
if ((null == array) || (1 > array.length)) { | |||
return Collections.emptyList(); | |||
} | |||
ArrayList<Object> list = new ArrayList<Object>(); | |||
ArrayList<T> list = new ArrayList<>(); | |||
list.addAll(Arrays.asList(array)); | |||
return list; | |||
} |
@@ -49,12 +49,12 @@ public class PartialOrder { | |||
public int fallbackCompareTo(Object other); | |||
} | |||
private static class SortObject { | |||
PartialComparable object; | |||
List<SortObject> smallerObjects = new LinkedList<SortObject>(); | |||
List<SortObject> biggerObjects = new LinkedList<SortObject>(); | |||
private static class SortObject<T extends PartialComparable> { | |||
T object; | |||
List<SortObject<T>> smallerObjects = new LinkedList<SortObject<T>>(); | |||
List<SortObject<T>> biggerObjects = new LinkedList<SortObject<T>>(); | |||
public SortObject(PartialComparable o) { | |||
public SortObject(T o) { | |||
object = o; | |||
} | |||
@@ -62,12 +62,12 @@ public class PartialOrder { | |||
return smallerObjects.size() == 0; | |||
} | |||
boolean removeSmallerObject(SortObject o) { | |||
boolean removeSmallerObject(SortObject<T> o) { | |||
smallerObjects.remove(o); | |||
return hasNoSmallerObjects(); | |||
} | |||
void addDirectedLinks(SortObject other) { | |||
void addDirectedLinks(SortObject<T> other) { | |||
int cmp = object.compareTo(other.object); | |||
if (cmp == 0) { | |||
return; | |||
@@ -86,18 +86,18 @@ public class PartialOrder { | |||
} | |||
} | |||
private static void addNewPartialComparable(List<SortObject> graph, PartialComparable o) { | |||
SortObject so = new SortObject(o); | |||
for (Iterator<SortObject> i = graph.iterator(); i.hasNext();) { | |||
SortObject other = i.next(); | |||
private static <T extends PartialComparable> void addNewPartialComparable(List<SortObject<T>> graph, T o) { | |||
SortObject<T> so = new SortObject<T>(o); | |||
for (Iterator<SortObject<T>> i = graph.iterator(); i.hasNext();) { | |||
SortObject<T> other = i.next(); | |||
so.addDirectedLinks(other); | |||
} | |||
graph.add(so); | |||
} | |||
private static void removeFromGraph(List<SortObject> graph, SortObject o) { | |||
for (Iterator<SortObject> i = graph.iterator(); i.hasNext();) { | |||
SortObject other = i.next(); | |||
private static <T extends PartialComparable> void removeFromGraph(List<SortObject<T>> graph, SortObject<T> o) { | |||
for (Iterator<SortObject<T>> i = graph.iterator(); i.hasNext();) { | |||
SortObject<T> other = i.next(); | |||
if (o == other) { | |||
i.remove(); | |||
@@ -114,7 +114,7 @@ public class PartialOrder { | |||
* @returns the same members as objects, but sorted according to their partial order. returns null if the objects are cyclical | |||
* | |||
*/ | |||
public static List sort(List objects) { | |||
public static <T extends PartialComparable> List<T> sort(List<T> objects) { | |||
// lists of size 0 or 1 don't need any sorting | |||
if (objects.size() < 2) { | |||
return objects; | |||
@@ -124,9 +124,9 @@ public class PartialOrder { | |||
// ??? I don't like creating this data structure, but it does give good | |||
// ??? separation of concerns. | |||
List<SortObject> sortList = new LinkedList<SortObject>(); // objects.size()); | |||
for (Iterator i = objects.iterator(); i.hasNext();) { | |||
addNewPartialComparable(sortList, (PartialComparable) i.next()); | |||
List<SortObject<T>> sortList = new LinkedList<SortObject<T>>(); | |||
for (Iterator<T> i = objects.iterator(); i.hasNext();) { | |||
addNewPartialComparable(sortList, i.next()); | |||
} | |||
// System.out.println(sortList); | |||
@@ -140,11 +140,9 @@ public class PartialOrder { | |||
// System.out.println(sortList); | |||
// System.out.println("-->" + ret); | |||
SortObject leastWithNoSmallers = null; | |||
SortObject<T> leastWithNoSmallers = null; | |||
for (Iterator i = sortList.iterator(); i.hasNext();) { | |||
SortObject so = (SortObject) i.next(); | |||
// System.out.println(so); | |||
for (SortObject<T> so: sortList) { | |||
if (so.hasNoSmallerObjects()) { | |||
if (leastWithNoSmallers == null || so.object.fallbackCompareTo(leastWithNoSmallers.object) < 0) { | |||
leastWithNoSmallers = so; |
@@ -62,7 +62,7 @@ public class FileUtilTest extends TestCase { | |||
* @throws AssertionFailedError if any names are not in dir | |||
*/ | |||
public static String[] dirContains(File dir, final String[] filenames) { | |||
final ArrayList sought = new ArrayList(LangUtil.arrayAsList(filenames)); | |||
final ArrayList<String> sought = new ArrayList<>(LangUtil.arrayAsList(filenames)); | |||
FilenameFilter filter = new FilenameFilter() { | |||
public boolean accept(File d, String name) { | |||
return !sought.remove(name); | |||
@@ -129,11 +129,11 @@ public class FileUtilTest extends TestCase { | |||
* @return sorted String[] of all paths to all files under dir ending with one of the listed suffixes but not starting with "." | |||
*/ | |||
public static String[] dirPaths(File dir, String[] suffixes) { | |||
ArrayList result = new ArrayList(); | |||
ArrayList<String> result = new ArrayList<String>(); | |||
doDirPaths(dir, result); | |||
// if suffixes required, remove those without suffixes | |||
if (!LangUtil.isEmpty(suffixes)) { | |||
for (ListIterator iter = result.listIterator(); iter.hasNext();) { | |||
for (ListIterator<String> iter = result.listIterator(); iter.hasNext();) { | |||
String path = iter.next().toString(); | |||
boolean hasSuffix = false; | |||
for (int i = 0; !hasSuffix && (i < suffixes.length); i++) { | |||
@@ -161,7 +161,7 @@ public class FileUtilTest extends TestCase { | |||
* @param dir the File to read - ignored if null, not a directory, or has "CVS" in its path | |||
* @param useSuffix if true, then use dir as suffix to path | |||
*/ | |||
private static void doDirPaths(File dir, ArrayList paths) { | |||
private static void doDirPaths(File dir, ArrayList<String> paths) { | |||
if ((null == dir) || !dir.canRead() || (-1 != dir.getPath().indexOf("CVS"))) { | |||
return; | |||
} | |||
@@ -188,15 +188,15 @@ public class FileUtilTest extends TestCase { | |||
} | |||
/** List of File files or directories to delete when exiting */ | |||
final ArrayList tempFiles; | |||
final ArrayList<File> tempFiles; | |||
public FileUtilTest(String s) { | |||
super(s); | |||
tempFiles = new ArrayList(); | |||
tempFiles = new ArrayList<File>(); | |||
} | |||
public void tearDown() { | |||
for (ListIterator iter = tempFiles.listIterator(); iter.hasNext();) { | |||
for (ListIterator<File> iter = tempFiles.listIterator(); iter.hasNext();) { | |||
File dir = (File) iter.next(); | |||
log("removing " + dir); | |||
FileUtil.deleteContents(dir); | |||
@@ -236,7 +236,7 @@ public class FileUtilTest extends TestCase { | |||
public void testCopyFiles() { | |||
// bad input | |||
Class iaxClass = IllegalArgumentException.class; | |||
Class<?> iaxClass = IllegalArgumentException.class; | |||
checkCopyFiles(null, null, iaxClass, false); | |||
@@ -388,7 +388,7 @@ public class FileUtilTest extends TestCase { | |||
} | |||
public void testRandomFileString() { | |||
ArrayList results = new ArrayList(); | |||
ArrayList<String> results = new ArrayList<>(); | |||
for (int i = 0; i < 1000; i++) { | |||
String s = FileUtil.randomFileString(); | |||
if (results.contains(s)) { | |||
@@ -469,7 +469,7 @@ public class FileUtilTest extends TestCase { | |||
} | |||
}; | |||
for (int i = 0; i < 10; i++) { | |||
List result = FileUtil.lineSeek("" + i, sourceList, true, errorSink); | |||
List<String> result = FileUtil.lineSeek("" + i, sourceList, true, errorSink); | |||
assertEquals(2, result.size()); | |||
assertEquals(path + ":1:" + i, result.get(0)); | |||
assertEquals(path + ":2:" + i, result.get(1)); | |||
@@ -502,19 +502,19 @@ public class FileUtilTest extends TestCase { | |||
tempFiles.add(file); | |||
} | |||
// now test | |||
final ArrayList errors = new ArrayList(); | |||
final ArrayList<String> errors = new ArrayList<>(); | |||
final PrintStream errorSink = new PrintStream(System.err, true) { | |||
public void println(String error) { | |||
errors.add(error); | |||
} | |||
}; | |||
List sourceList = new ArrayList(); | |||
List<String> sourceList = new ArrayList<>(); | |||
sourceList.addAll(Arrays.asList(sources)); | |||
sourceList = Collections.unmodifiableList(sourceList); | |||
for (int k = 0; k < sources.length; k++) { | |||
List result = FileUtil.lineSeek("" + k, sourceList, true, errorSink); | |||
List<String> result = FileUtil.lineSeek("" + k, sourceList, true, errorSink); | |||
// number k found in every other line of every file at index k | |||
Iterator iter = result.iterator(); | |||
Iterator<String> iter = result.iterator(); | |||
for (int i = 0; i < MAX; i++) { // for each file | |||
for (int j = 1; j < (MAX + 1); j++) { // for every other line | |||
assertTrue(iter.hasNext()); |