src/share/classes/sun/awt/shell/ShellFolder.java
Print this page
rev 9830 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by: darcy, prr
@@ -125,18 +125,18 @@
public File[] listFiles(boolean includeHiddenFiles) {
File[] files = super.listFiles();
if (!includeHiddenFiles) {
- Vector v = new Vector();
+ Vector<File> v = new Vector<>();
int nameCount = (files == null) ? 0 : files.length;
for (int i = 0; i < nameCount; i++) {
if (!files[i].isHidden()) {
v.addElement(files[i]);
}
}
- files = (File[])v.toArray(new File[v.size()]);
+ files = v.toArray(new File[v.size()]);
}
return files;
}
@@ -206,11 +206,11 @@
private static Invoker invoker;
static {
String managerClassName = (String)Toolkit.getDefaultToolkit().
getDesktopProperty("Shell.shellFolderManager");
- Class managerClass = null;
+ Class<?> managerClass = null;
try {
managerClass = ReflectUtil.forName(managerClassName);
// swallow the exceptions below and use default shell folder
} catch(ClassNotFoundException e) {
} catch(NullPointerException e) {
@@ -552,22 +552,24 @@
}
/**
* Provides a default comparator for the default column set
*/
- private static final Comparator DEFAULT_COMPARATOR = new Comparator() {
+ private static final Comparator<Object> DEFAULT_COMPARATOR = new Comparator<Object>() {
public int compare(Object o1, Object o2) {
int gt;
if (o1 == null && o2 == null) {
gt = 0;
} else if (o1 != null && o2 == null) {
gt = 1;
} else if (o1 == null && o2 != null) {
gt = -1;
} else if (o1 instanceof Comparable) {
- gt = ((Comparable) o1).compareTo(o2);
+ @SuppressWarnings("unchecked")
+ Comparable<Object> o = (Comparable<Object>) o1;
+ gt = o.compareTo(o2);
} else {
gt = 0;
}
return gt;