* accumulated.
*/
public class AccumulatingFileFilter extends ValidFileFilter {
- Vector files = new Vector();
+ Vector<File> files = new Vector<File>();
public final boolean accept(File f) {
if (super.accept(f) && (accumulate(f))) {
files.add(f);
*
* Use only for sorts, not to maintain maps.
*/
- public static final Comparator WEAK_File = new Comparator() {
- public int compare(Object o1, Object o2) {
+ public static final Comparator<File> WEAK_File = new Comparator<File>() {
+ public int compare(File o1, File o2) {
if ((o1 == o2)
|| (o1 == ISourceLocation.NO_FILE)
|| (o2 == ISourceLocation.NO_FILE) ) {
* Ordering only uses line number.
* Use only for sorts, not to maintain maps.
*/
- public static final Comparator WEAK_ISourceLocation = new Comparator() {
- public int compare(Object o1, Object o2) {
+ public static final Comparator<ISourceLocation> WEAK_ISourceLocation = new Comparator<ISourceLocation>() {
+ public int compare(ISourceLocation o1, ISourceLocation o2) {
if (o1 == o2) {
return 0;
}
* uses WEAK_FILE on the sourceFile.
* Use only for sorts, not to maintain maps.
*/
- public static final Comparator MEDIUM_ISourceLocation = new Comparator() {
- public int compare(Object o1, Object o2) {
+ public static final Comparator<ISourceLocation> MEDIUM_ISourceLocation = new Comparator<ISourceLocation>() {
+ public int compare(ISourceLocation o1, ISourceLocation o2) {
int result = WEAK_ISourceLocation.compare(o1, o2);
if (0 != result) {
return result;
* and ignores message
* so use only for sorts, not to maintain maps
*/
- public static final Comparator WEAK_IMessage = new Comparator() {
- public int compare(Object o1, Object o2) {
+ public static final Comparator<IMessage> WEAK_IMessage = new Comparator<IMessage>() {
+ public int compare(IMessage o1, IMessage o2) {
if (o1 == o2) {
return 0;
}
* or if either is empty, i.e., none specified).
* so use only for sorts, not to maintain maps
*/
- public static final Comparator MEDIUM_IMessage = new Comparator() {
- public int compare(Object o1, Object o2) {
+ public static final Comparator<IMessage> MEDIUM_IMessage = new Comparator<IMessage>() {
+ public int compare(IMessage o1, IMessage o2) {
int result = WEAK_IMessage.compare(o1, o2);
if (0 != result) {
return result;
/**
* Compare IMessages based on kind and source location line (only).
*/
- public static final Comparator MESSAGE_LINEKIND = new Comparator() {
+ public static final Comparator<IMessage> MESSAGE_LINEKIND = new Comparator<IMessage>() {
/**
* Compare IMessages based on kind and source location line (only).
* @throws NullPointerException if anything is null
*/
- public int compare(Object lhs, Object rhs) {
+ public int compare(IMessage lhs, IMessage rhs) {
IMessage lm = (IMessage) lhs;
IMessage rm = (IMessage) rhs;
ISourceLocation ls = (lm == null ? null : lm.getSourceLocation());
private static ArrayList getExcept(
IMessage[] source,
IMessage.Kind[] skip) {
- ArrayList sink = new ArrayList();
+ ArrayList<IMessage> sink = new ArrayList<IMessage>();
if (LangUtil.isEmpty(source)) {
return sink;
}
* @throws IllegalArgumentException if null == dir
* @return a Collection of String of paths, including paths inside jars
*/
- public static Collection directoryToString(File dir, Collection results) {
+ public static Collection<String> directoryToString(File dir, Collection results) {
if (null == dir) throw new IllegalArgumentException("null dir");
- final Collection result = (results != null? results : new Vector());
+ final Collection<String> result = (results != null? results : new Vector());
if (isZipFile(dir)) {
zipFileToString(dir, result);
} else if (!dir.isDirectory()) {
private final Messages messages;
private final HTMLEditorKit.Parser parser; // XXX untested - stateful
- private final ArrayList linksToCheck; // Link
- private final ArrayList checkedUrls; // String (URL.toString)
- private final ArrayList validRefs; // String (URL.toString)
- private final ArrayList refsToCheck; // String (URL.toString)
+ private final ArrayList<Link> linksToCheck;
+ private final ArrayList<String> checkedUrls; // String (URL.toString)
+ private final ArrayList<String> validRefs; // String (URL.toString)
+ private final ArrayList<String> refsToCheck; // String (URL.toString)
private final Link.Check checkExists;
private final Link.Check checkContents;
LangUtil.throwIaxIfNull(checkExists, "checkExists");
LangUtil.throwIaxIfNull(checkContents, "checkContents");
this.messages = new Messages(handler);
- linksToCheck = new ArrayList();
- checkedUrls = new ArrayList();
- refsToCheck = new ArrayList();
- validRefs = new ArrayList();
+ linksToCheck = new ArrayList<Link>();
+ checkedUrls = new ArrayList<String>();
+ refsToCheck = new ArrayList<String>();
+ validRefs = new ArrayList<String>();
parser = new HTMLEditorKit() {
public HTMLEditorKit.Parser getParser() {
return super.getParser();
}
public synchronized void run() {
- ArrayList list = new ArrayList();
+ ArrayList<Link> list = new ArrayList<Link>();
while (0 < linksToCheck.size()) {
messages.checkingLinks(linksToCheck.size());
list.clear();
list.addAll(linksToCheck);
- for (Iterator iter = list.iterator(); iter.hasNext();) {
- final Link link = (Link) iter.next();
+ for (Iterator<Link> iter = list.iterator(); iter.hasNext();) {
+ final Link link = iter.next();
String urlString = link.url.toString();
if (!checkedUrls.contains(urlString)) {
checkedUrls.add(urlString);
linksToCheck.removeAll(list);
}
// now check that all named references are accounted for
- for (Iterator iter = refsToCheck.iterator(); iter.hasNext();) {
- String ref = (String) iter.next();
+ for (Iterator<String> iter = refsToCheck.iterator(); iter.hasNext();) {
+ String ref = iter.next();
if (!validRefs.contains(ref)) {
messages.namedReferenceNotFound(ref);
}