src/solaris/classes/sun/print/UnixPrintService.java
Print this page
@@ -146,20 +146,20 @@
encoding = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("file.encoding"));
}
/* let's try to support a few of these */
- private static final Class[] serviceAttrCats = {
+ private static final Class<?>[] serviceAttrCats = {
PrinterName.class,
PrinterIsAcceptingJobs.class,
QueuedJobCount.class,
};
/* it turns out to be inconvenient to store the other categories
* separately because many attributes are in multiple categories.
*/
- private static final Class[] otherAttrCats = {
+ private static final Class<?>[] otherAttrCats = {
Chromaticity.class,
Copies.class,
Destination.class,
Fidelity.class,
JobName.class,
@@ -276,11 +276,11 @@
// Filter the list of possible AIX Printers and remove header lines
// and extra lines which have been added for remote printers.
// 'protected' because this method is also used from UnixPrintServiceLookup.
protected static String[] filterPrinterNamesAIX(String[] posPrinters) {
- ArrayList printers = new ArrayList();
+ ArrayList<String> printers = new ArrayList<>();
String [] splitPart;
for(int i = 0; i < posPrinters.length; i++) {
// Remove the header lines
if (posPrinters[i].startsWith("---") ||
@@ -293,11 +293,11 @@
if(splitPart.length >= 1 && !splitPart[0].trim().endsWith(":")) {
printers.add(posPrinters[i]);
}
}
- return (String[])printers.toArray(new String[printers.size()]);
+ return printers.toArray(new String[printers.size()]);
}
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsAIX() {
// On AIX there should not be a blank after '-a'.
String command = "/usr/bin/lpstat -a" + printer;
@@ -531,10 +531,11 @@
notifier = null;
}
}
}
+ @SuppressWarnings("unchecked")
public <T extends PrintServiceAttribute>
T getAttribute(Class<T> category)
{
if (category == null) {
throw new NullPointerException("category");
@@ -615,13 +616,13 @@
}
}
return false;
}
- public Class[] getSupportedAttributeCategories() {
+ public Class<?>[] getSupportedAttributeCategories() {
int totalCats = otherAttrCats.length;
- Class [] cats = new Class[totalCats];
+ Class<?>[] cats = new Class<?>[totalCats];
System.arraycopy(otherAttrCats, 0, cats, 0, otherAttrCats.length);
return cats;
}
public boolean
@@ -965,11 +966,11 @@
" is an unsupported flavor");
} else if (isAutoSense(flavor)) {
return false;
}
}
- Class category = attr.getCategory();
+ Class<? extends Attribute> category = attr.getCategory();
if (!isAttributeCategorySupported(category)) {
return false;
}
else if (attr.getCategory() == Chromaticity.class) {
if (flavor == null || isServiceFormattedFlavor(flavor)) {
@@ -1076,10 +1077,10 @@
public int hashCode() {
return this.getClass().hashCode()+getName().hashCode();
}
- public boolean usesClass(Class c) {
+ public boolean usesClass(Class<?> c) {
return (c == sun.print.PSPrinterJob.class);
}
}