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,142 ****
public File[] listFiles(boolean includeHiddenFiles) {
File[] files = super.listFiles();
if (!includeHiddenFiles) {
! Vector 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()]);
}
return files;
}
--- 125,142 ----
public File[] listFiles(boolean includeHiddenFiles) {
File[] files = super.listFiles();
if (!includeHiddenFiles) {
! 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 = v.toArray(new File[v.size()]);
}
return files;
}
*** 206,216 ****
private static Invoker invoker;
static {
String managerClassName = (String)Toolkit.getDefaultToolkit().
getDesktopProperty("Shell.shellFolderManager");
! Class managerClass = null;
try {
managerClass = ReflectUtil.forName(managerClassName);
// swallow the exceptions below and use default shell folder
} catch(ClassNotFoundException e) {
} catch(NullPointerException e) {
--- 206,216 ----
private static Invoker invoker;
static {
String managerClassName = (String)Toolkit.getDefaultToolkit().
getDesktopProperty("Shell.shellFolderManager");
! Class<?> managerClass = null;
try {
managerClass = ReflectUtil.forName(managerClassName);
// swallow the exceptions below and use default shell folder
} catch(ClassNotFoundException e) {
} catch(NullPointerException e) {
*** 552,573 ****
}
/**
* Provides a default comparator for the default column set
*/
! private static final Comparator DEFAULT_COMPARATOR = new Comparator() {
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);
} else {
gt = 0;
}
return gt;
--- 552,575 ----
}
/**
* Provides a default comparator for the default column set
*/
! 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) {
! @SuppressWarnings("unchecked")
! Comparable<Object> o = (Comparable<Object>) o1;
! gt = o.compareTo(o2);
} else {
gt = 0;
}
return gt;