7144475: fix some warnings in java.awt, javax.print.attribute.standard, and sun.beans.infos

Co-authored-by: Martijn Verburg <martijnverburg@gmail.com>
Co-authored-by: Goerge Albrecht <goerge.albrecht@gmx.net>
Co-authored-by: Graham Allan <grundlefleck@googlemail.com>
Co-authored-by: Iordanis Giannakakis <i.giannakakis@ymail.com>
Co-authored-by: Jose Llarena <jose.llarena@gmail.com>
Co-authored-by: Abrahamn Marin Perez <abraham.marin.perez@gmail.com>
Reviewed-by: chegar, prr, alanb, anthony
This commit is contained in:
Prasannaa 2012-02-10 11:03:20 +00:00 committed by Chris Hegarty
parent 36a08afe2a
commit 1cfc57d91b
6 changed files with 16 additions and 17 deletions

View File

@ -115,7 +115,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @see #addItem(String)
* @see #getItem(int)
*/
Vector items = new Vector();
Vector<String> items = new Vector<>();
/**
* This field will represent the number of visible rows in the
@ -306,7 +306,7 @@ public class List extends Component implements ItemSelectable, Accessible {
// to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
final String getItemImpl(int index) {
return (String)items.elementAt(index);
return items.elementAt(index);
}
/**
@ -415,7 +415,7 @@ public class List extends Component implements ItemSelectable, Accessible {
if (peer != null) {
peer.removeAll();
}
items = new Vector();
items = new Vector<>();
selected = new int[0];
}
@ -490,9 +490,9 @@ public class List extends Component implements ItemSelectable, Accessible {
public synchronized int[] getSelectedIndexes() {
ListPeer peer = (ListPeer)this.peer;
if (peer != null) {
selected = ((ListPeer)peer).getSelectedIndexes();
selected = peer.getSelectedIndexes();
}
return (int[])selected.clone();
return selected.clone();
}
/**
@ -908,7 +908,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @since 1.4
*/
public synchronized ItemListener[] getItemListeners() {
return (ItemListener[])(getListeners(ItemListener.class));
return getListeners(ItemListener.class);
}
/**
@ -975,7 +975,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @since 1.4
*/
public synchronized ActionListener[] getActionListeners() {
return (ActionListener[])(getListeners(ActionListener.class));
return getListeners(ActionListener.class);
}
/**

View File

@ -398,10 +398,10 @@ public class Window extends Container implements Accessible {
initIDs();
}
String s = (String) java.security.AccessController.doPrivileged(
String s = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.syncLWRequests"));
systemSyncLWRequests = (s != null && s.equals("true"));
s = (String) java.security.AccessController.doPrivileged(
s = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.Window.locationByPlatform"));
locationByPlatformProp = (s != null && s.equals("true"));
}
@ -1378,7 +1378,7 @@ public class Window extends Container implements Accessible {
// make sure the privileged action is only
// for getting the property! We don't want the
// above checkTopLevelWindow call to always succeed!
warningString = (String) AccessController.doPrivileged(
warningString = AccessController.doPrivileged(
new GetPropertyAction("awt.appletWarning",
"Java Applet Window"));
}

View File

@ -921,9 +921,9 @@ public class ICC_Profile implements Serializable {
*/
private static ICC_Profile getStandardProfile(final String name) {
return (ICC_Profile) AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
return AccessController.doPrivileged(
new PrivilegedAction<ICC_Profile>() {
public ICC_Profile run() {
ICC_Profile p = null;
try {
p = getInstance (name);

View File

@ -180,8 +180,7 @@ public final class PrinterStateReasons
if (severity == null) {
throw new NullPointerException("severity is null");
}
return super.put((PrinterStateReason) reason,
(Severity) severity);
return super.put(reason, severity);
}
/**

View File

@ -141,7 +141,7 @@ public class ReferenceUriSchemesSupported
* Returns the string table for class ReferenceUriSchemesSupported.
*/
protected String[] getStringTable() {
return (String[])myStringTable.clone();
return myStringTable.clone();
}
/**

View File

@ -32,7 +32,7 @@ import java.beans.*;
*/
public class ComponentBeanInfo extends SimpleBeanInfo {
private static final Class beanClass = java.awt.Component.class;
private static final Class<java.awt.Component> beanClass = java.awt.Component.class;
public PropertyDescriptor[] getPropertyDescriptors() {
try {