aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/src/org/aspectj/util/FileUtil.java2
-rw-r--r--util/src/org/aspectj/util/GenericSignatureParser.java20
-rw-r--r--util/src/org/aspectj/util/LangUtil.java50
-rw-r--r--util/src/org/aspectj/util/UtilClassLoader.java12
4 files changed, 43 insertions, 41 deletions
diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java
index b9f017663..5269b50a6 100644
--- a/util/src/org/aspectj/util/FileUtil.java
+++ b/util/src/org/aspectj/util/FileUtil.java
@@ -868,6 +868,7 @@ public class FileUtil {
}
/** do line-based copying */
+ @SuppressWarnings("deprecation")
public static void copyStream(DataInputStream in, PrintStream out) throws IOException {
LangUtil.throwIaxIfNull(in, "in");
LangUtil.throwIaxIfNull(in, "out");
@@ -965,6 +966,7 @@ public class FileUtil {
*
* @param file the File to convert to URL (not null)
*/
+ @SuppressWarnings("deprecation")
public static URL getFileURL(File file) {
LangUtil.throwIaxIfNull(file, "file");
URL result = null;
diff --git a/util/src/org/aspectj/util/GenericSignatureParser.java b/util/src/org/aspectj/util/GenericSignatureParser.java
index d8e5bd073..3f11662f6 100644
--- a/util/src/org/aspectj/util/GenericSignatureParser.java
+++ b/util/src/org/aspectj/util/GenericSignatureParser.java
@@ -46,7 +46,7 @@ public class GenericSignatureParser {
GenericSignature.ClassSignature classSig = new GenericSignature.ClassSignature();
// FormalTypeParameters-opt
if (maybeEat("<")) {
- List formalTypeParametersList = new ArrayList();
+ List<FormalTypeParameter> formalTypeParametersList = new ArrayList<FormalTypeParameter>();
do {
formalTypeParametersList.add(parseFormalTypeParameter());
} while (!maybeEat(">"));
@@ -54,7 +54,7 @@ public class GenericSignatureParser {
formalTypeParametersList.toArray(classSig.formalTypeParameters);
}
classSig.superclassSignature = parseClassTypeSignature();
- List superIntSigs = new ArrayList();
+ List<ClassTypeSignature> superIntSigs = new ArrayList<ClassTypeSignature>();
while (tokenIndex < tokenStream.length) {
superIntSigs.add(parseClassTypeSignature());
}
@@ -75,7 +75,7 @@ public class GenericSignatureParser {
TypeSignature returnType = null;
// FormalTypeParameters-opt
if (maybeEat("<")) {
- List formalTypeParametersList = new ArrayList();
+ List<FormalTypeParameter> formalTypeParametersList = new ArrayList<FormalTypeParameter>();
do {
formalTypeParametersList.add(parseFormalTypeParameter());
} while (!maybeEat(">"));
@@ -84,7 +84,7 @@ public class GenericSignatureParser {
}
// Parameters
eat("(");
- List paramList = new ArrayList();
+ List<TypeSignature> paramList = new ArrayList<TypeSignature>();
while (!maybeEat(")")) {
FieldTypeSignature fsig = parseFieldTypeSignature(true);
if (fsig != null) {
@@ -100,7 +100,7 @@ public class GenericSignatureParser {
if (returnType == null)
returnType = new GenericSignature.BaseTypeSignature(eatIdentifier());
// throws
- List throwsList = new ArrayList();
+ List<FieldTypeSignature> throwsList = new ArrayList<FieldTypeSignature>();
while (maybeEat("^")) {
FieldTypeSignature fsig = parseFieldTypeSignature(false);
throwsList.add(fsig);
@@ -132,7 +132,7 @@ public class GenericSignatureParser {
ftp.classBound = new ClassTypeSignature("Ljava/lang/Object;", "Ljava/lang/Object");
}
// Optional InterfaceBounds
- List optionalBounds = new ArrayList();
+ List<FieldTypeSignature> optionalBounds = new ArrayList<FieldTypeSignature>();
while (maybeEat(":")) {
optionalBounds.add(parseFieldTypeSignature(false));
}
@@ -190,7 +190,7 @@ public class GenericSignatureParser {
if (maybeEat(".")) {
// outer type completed
outerType = new SimpleClassTypeSignature(identifier);
- List nestedTypeList = new ArrayList();
+ List<SimpleClassTypeSignature> nestedTypeList = new ArrayList<SimpleClassTypeSignature>();
do {
ret.append(".");
SimpleClassTypeSignature sig = parseSimpleClassTypeSignature();
@@ -208,7 +208,7 @@ public class GenericSignatureParser {
ret.append(">");
outerType = new SimpleClassTypeSignature(identifier, tArgs);
// now parse possible nesteds...
- List nestedTypeList = new ArrayList();
+ List<SimpleClassTypeSignature> nestedTypeList = new ArrayList<SimpleClassTypeSignature>();
while (maybeEat(".")) {
ret.append(".");
SimpleClassTypeSignature sig = parseSimpleClassTypeSignature();
@@ -254,7 +254,7 @@ public class GenericSignatureParser {
private TypeArgument[] maybeParseTypeArguments() {
if (maybeEat("<")) {
- List typeArgs = new ArrayList();
+ List<TypeArgument> typeArgs = new ArrayList<TypeArgument>();
do {
TypeArgument arg = parseTypeArgument();
typeArgs.add(arg);
@@ -301,7 +301,7 @@ public class GenericSignatureParser {
public String[] tokenize(String signatureString) {
char[] chars = signatureString.toCharArray();
int index = 0;
- List tokens = new ArrayList();
+ List<String> tokens = new ArrayList<String>();
StringBuffer identifier = new StringBuffer();
boolean inParens = false;
boolean inArray = false;
diff --git a/util/src/org/aspectj/util/LangUtil.java b/util/src/org/aspectj/util/LangUtil.java
index 85dc86ee7..224ca8e02 100644
--- a/util/src/org/aspectj/util/LangUtil.java
+++ b/util/src/org/aspectj/util/LangUtil.java
@@ -124,7 +124,7 @@ public class LangUtil {
* @param c the Class to check - use null to ignore type check
* @throws IllegalArgumentException "null {name}" if o is null
*/
- public static final void throwIaxIfNotAssignable(final Object ra[], final Class c, final String name) {
+ public static final void throwIaxIfNotAssignable(final Object ra[], final Class<?> c, final String name) {
throwIaxIfNull(ra, name);
String label = (null == name ? "input" : name);
for (int i = 0; i < ra.length; i++) {
@@ -132,7 +132,7 @@ public class LangUtil {
String m = " null " + label + "[" + i + "]";
throw new IllegalArgumentException(m);
} else if (null != c) {
- Class actualClass = ra[i].getClass();
+ Class<?> actualClass = ra[i].getClass();
if (!c.isAssignableFrom(actualClass)) {
String message = label + " not assignable to " + c.getName();
throw new IllegalArgumentException(message);
@@ -146,10 +146,10 @@ public class LangUtil {
*
* @throws IllegalArgumentException "null {name}" if o is null
*/
- public static final void throwIaxIfNotAssignable(final Object o, final Class c, final String name) {
+ public static final void throwIaxIfNotAssignable(final Object o, final Class<?> c, final String name) {
throwIaxIfNull(o, name);
if (null != c) {
- Class actualClass = o.getClass();
+ Class<?> actualClass = o.getClass();
if (!c.isAssignableFrom(actualClass)) {
String message = name + " not assignable to " + c.getName();
throw new IllegalArgumentException(message);
@@ -201,7 +201,7 @@ public class LangUtil {
}
/** @return ((null == collection) || (0 == collection.size())) */
- public static boolean isEmpty(Collection collection) {
+ public static boolean isEmpty(Collection<?> collection) {
return ((null == collection) || (0 == collection.size()));
}
@@ -220,7 +220,7 @@ public class LangUtil {
* @param input <code>String</code> to split.
* @return List of String of elements.
*/
- public static List commaSplit(String input) {
+ public static List<String> commaSplit(String input) {
return anySplit(input, ",");
}
@@ -235,7 +235,7 @@ public class LangUtil {
return new String[0];
}
StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator);
- ArrayList result = new ArrayList(st.countTokens());
+ ArrayList<String> result = new ArrayList<String>(st.countTokens());
while (st.hasMoreTokens()) {
String entry = st.nextToken();
if (!LangUtil.isEmpty(entry)) {
@@ -273,11 +273,11 @@ public class LangUtil {
* @param delim <code>String</code> separators for input.
* @return List of String of elements.
*/
- public static List anySplit(String input, String delim) {
+ public static List<String> anySplit(String input, String delim) {
if (null == input) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- ArrayList result = new ArrayList();
+ ArrayList<String> result = new ArrayList<String>();
if (LangUtil.isEmpty(delim) || (-1 == input.indexOf(delim))) {
result.add(input.trim());
@@ -295,11 +295,11 @@ public class LangUtil {
*
* @param text <code>String</code> to split.
*/
- public static List strings(String text) {
+ public static List<String> strings(String text) {
if (LangUtil.isEmpty(text)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- List strings = new ArrayList();
+ List<String> strings = new ArrayList<String>();
StringTokenizer tok = new StringTokenizer(text);
while (tok.hasMoreTokens()) {
strings.add(tok.nextToken());
@@ -308,8 +308,8 @@ public class LangUtil {
}
/** @return a non-null unmodifiable List */
- public static List safeList(List list) {
- return (null == list ? Collections.EMPTY_LIST : Collections.unmodifiableList(list));
+ public static <T> List<T> safeList(List<T> list) {
+ return (null == list ? Collections.<T>emptyList() : Collections.unmodifiableList(list));
}
// /**
@@ -654,16 +654,16 @@ public class LangUtil {
* @throws IllegalArgumentException if either is null
*/
public static Object[] safeCopy(Object[] source, Object[] sink) {
- final Class sinkType = (null == sink ? Object.class : sink.getClass().getComponentType());
+ final Class<?> sinkType = (null == sink ? Object.class : sink.getClass().getComponentType());
final int sourceLength = (null == source ? 0 : source.length);
final int sinkLength = (null == sink ? 0 : sink.length);
final int resultSize;
- ArrayList result = null;
+ ArrayList<Object> result = null;
if (0 == sourceLength) {
resultSize = 0;
} else {
- result = new ArrayList(sourceLength);
+ result = new ArrayList<Object>(sourceLength);
for (int i = 0; i < sourceLength; i++) {
if ((null != source[i]) && (sinkType.isAssignableFrom(source[i].getClass()))) {
result.add(source[i]);
@@ -683,7 +683,7 @@ public class LangUtil {
/**
* @return a String with the unqualified class name of the class (or "null")
*/
- public static String unqualifiedClassName(Class c) {
+ public static String unqualifiedClassName(Class<?> c) {
if (null == c) {
return "null";
}
@@ -820,7 +820,7 @@ public class LangUtil {
if (null == checker || (null == stack) || (0 == stack.length())) {
return;
}
- final LinkedList lines = new LinkedList();
+ final LinkedList<String> lines = new LinkedList<String>();
StringTokenizer st = new StringTokenizer(stack.toString(), "\n\r");
while (st.hasMoreTokens() && (0 < --maxLines)) {
lines.add(st.nextToken());
@@ -914,11 +914,11 @@ public class LangUtil {
* @param array the Object[] to convert (may be null)
* @return the List corresponding to array (never null)
*/
- public static List arrayAsList(Object[] array) {
+ public static List<Object> arrayAsList(Object[] array) {
if ((null == array) || (1 > array.length)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- ArrayList list = new ArrayList();
+ ArrayList<Object> list = new ArrayList<Object>();
list.addAll(Arrays.asList(array));
return list;
}
@@ -996,7 +996,7 @@ public class LangUtil {
*/
public static ProcessController makeProcess(ProcessController controller, String classpath, String mainClass, String[] args) {
File java = LangUtil.getJavaExecutable();
- ArrayList cmd = new ArrayList();
+ ArrayList<String> cmd = new ArrayList<String>();
cmd.add(java.getAbsolutePath());
cmd.add("-classpath");
cmd.add(classpath);
@@ -1185,7 +1185,7 @@ public class LangUtil {
LangUtil.throwIaxIfNull(java, "java");
LangUtil.throwIaxIfNull(mainClass, "mainClass");
LangUtil.throwIaxIfNull(args, "args");
- ArrayList cmd = new ArrayList();
+ ArrayList<String> cmd = new ArrayList<String>();
cmd.add(java.getAbsolutePath());
cmd.add("-classpath");
cmd.add(classpath);
diff --git a/util/src/org/aspectj/util/UtilClassLoader.java b/util/src/org/aspectj/util/UtilClassLoader.java
index 85783aa40..091e022a3 100644
--- a/util/src/org/aspectj/util/UtilClassLoader.java
+++ b/util/src/org/aspectj/util/UtilClassLoader.java
@@ -31,7 +31,7 @@ import java.util.List;
public class UtilClassLoader extends URLClassLoader {
/** seek classes in dirs first */
- List /*File*/ dirs;
+ List<File> dirs;
/** save URL[] only for toString */
private URL[] urlsForDebugString;
@@ -40,7 +40,7 @@ public class UtilClassLoader extends URLClassLoader {
super(urls);
LangUtil.throwIaxIfNotAssignable(dirs, File.class, "dirs");
this.urlsForDebugString = urls;
- ArrayList dcopy = new ArrayList();
+ ArrayList<File> dcopy = new ArrayList<File>();
if (!LangUtil.isEmpty(dirs)) {
dcopy.addAll(Arrays.asList(dirs));
@@ -57,13 +57,13 @@ public class UtilClassLoader extends URLClassLoader {
return ClassLoader.getSystemResourceAsStream(name);
}
- public synchronized Class loadClass(String name, boolean resolve)
+ public synchronized Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException {
// search the cache, our dirs (if maybe test),
// the system, the superclass (URL[]),
// and our dirs again (if not maybe test)
ClassNotFoundException thrown = null;
- Class result = findLoadedClass(name);
+ Class<?> result = findLoadedClass(name);
if (null != result) {
resolve = false;
} else {
@@ -102,8 +102,8 @@ public class UtilClassLoader extends URLClassLoader {
/** @return null if class not found or byte[] of class otherwise */
private byte[] readClass(String className) throws ClassNotFoundException {
final String fileName = className.replace('.', '/')+".class";
- for (Iterator iter = dirs.iterator(); iter.hasNext();) {
- File file = new File((File) iter.next(), fileName);
+ for (Iterator<File> iter = dirs.iterator(); iter.hasNext();) {
+ File file = new File(iter.next(), fileName);
if (file.canRead()) {
return getClassData(file);
}