diff --git a/src/share/classes/java/awt/List.java b/src/share/classes/java/awt/List.java index 917977b157ea13775e4ab704efa5d1b2b6c44026..d5b60ae56c6bb599049ffe543720a0c47ef29f44 100644 --- a/src/share/classes/java/awt/List.java +++ b/src/share/classes/java/awt/List.java @@ -115,7 +115,7 @@ public class List extends Component implements ItemSelectable, Accessible { * @see #addItem(String) * @see #getItem(int) */ - Vector items = new Vector(); + Vector 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); } /** diff --git a/src/share/classes/java/awt/Window.java b/src/share/classes/java/awt/Window.java index d2c97dbf8ab47d7feced5590fceb80ae0a495dfe..646d9ded822188950cf1d04f196782fa2b0f2966 100644 --- a/src/share/classes/java/awt/Window.java +++ b/src/share/classes/java/awt/Window.java @@ -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")); } diff --git a/src/share/classes/java/awt/color/ICC_Profile.java b/src/share/classes/java/awt/color/ICC_Profile.java index 81212fbfeaf141dff32acb1c6f88a3a8c6cda374..c06ddf61c9772229b52f7df103c06f601f7942a4 100644 --- a/src/share/classes/java/awt/color/ICC_Profile.java +++ b/src/share/classes/java/awt/color/ICC_Profile.java @@ -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() { + public ICC_Profile run() { ICC_Profile p = null; try { p = getInstance (name); diff --git a/src/share/classes/java/awt/event/InputEvent.java b/src/share/classes/java/awt/event/InputEvent.java index c98c872ed8be859373bc766499961661bb8664c9..f645c3a10a67512a41315d5efc36c92300ddfe19 100644 --- a/src/share/classes/java/awt/event/InputEvent.java +++ b/src/share/classes/java/awt/event/InputEvent.java @@ -321,14 +321,15 @@ public abstract class InputEvent extends ComponentEvent { * @param when a long int that gives the time the event occurred. * Passing negative or zero value * is not recommended - * @param modifiers the modifier keys down during event (e.g. shift, ctrl, - * alt, meta) - * Passing negative parameter is not recommended. - * Zero value means no modifiers. - * Either extended _DOWN_MASK or old _MASK modifiers - * should be used, but both models should not be mixed - * in one event. Use of the extended modifiers is - * preferred + * @param modifiers a modifier mask describing the modifier keys and mouse + * buttons (for example, shift, ctrl, alt, and meta) that + * are down during the event. + * Only extended modifiers are allowed to be used as a + * value for this parameter (see the {@link InputEvent#getModifiersEx} + * class for the description of extended modifiers). + * Passing negative parameter + * is not recommended. + * Zero value means that no modifiers were passed * @throws IllegalArgumentException if source is null * @see #getSource() * @see #getID() @@ -416,9 +417,13 @@ public abstract class InputEvent extends ComponentEvent { /** * Returns the extended modifier mask for this event. + *

+ * Extended modifiers are the modifiers that ends with the _DOWN_MASK suffix, + * such as ALT_DOWN_MASK, BUTTON1_DOWN_MASK, and others. + *

* Extended modifiers represent the state of all modal keys, * such as ALT, CTRL, META, and the mouse buttons just after - * the event occurred + * the event occurred. *

* For example, if the user presses button 1 followed by * button 2, and then releases them in the same order, diff --git a/src/share/classes/java/awt/event/MouseEvent.java b/src/share/classes/java/awt/event/MouseEvent.java index 988eda60a8bb8e70858287cc8651e48f42a26b7a..15cb6ee0309ef11dd2803697a42f2898e698019e 100644 --- a/src/share/classes/java/awt/event/MouseEvent.java +++ b/src/share/classes/java/awt/event/MouseEvent.java @@ -488,14 +488,15 @@ public class MouseEvent extends InputEvent { * @param when A long integer that gives the time the event occurred. * Passing negative or zero value * is not recommended - * @param modifiers The modifier keys down during event (e.g. shift, ctrl, - * alt, meta) + * @param modifiers a modifier mask describing the modifier keys and mouse + * buttons (for example, shift, ctrl, alt, and meta) that + * are down during the event. + * Only extended modifiers are allowed to be used as a + * value for this parameter (see the {@link InputEvent#getModifiersEx} + * class for the description of extended modifiers). * Passing negative parameter * is not recommended. - * Zero value means that no modifiers were passed. - * Use either an extended _DOWN_MASK or old _MASK modifiers, - * however do not mix models in the one event. - * The extended modifiers are preferred for using + * Zero value means that no modifiers were passed * @param x The horizontal x coordinate for the mouse location. * It is allowed to pass negative values * @param y The vertical y coordinate for the mouse location. @@ -586,14 +587,15 @@ public class MouseEvent extends InputEvent { * @param when A long integer that gives the time the event occurred. * Passing negative or zero value * is not recommended - * @param modifiers The modifier keys down during event (e.g. shift, ctrl, - * alt, meta) + * @param modifiers a modifier mask describing the modifier keys and mouse + * buttons (for example, shift, ctrl, alt, and meta) that + * are down during the event. + * Only extended modifiers are allowed to be used as a + * value for this parameter (see the {@link InputEvent#getModifiersEx} + * class for the description of extended modifiers). * Passing negative parameter * is not recommended. - * Zero value means that no modifiers were passed. - * Use either an extended _DOWN_MASK or old _MASK modifiers, - * however do not mix models in the one event. - * The extended modifiers are preferred for using + * Zero value means that no modifiers were passed * @param x The horizontal x coordinate for the mouse location. * It is allowed to pass negative values * @param y The vertical y coordinate for the mouse location. @@ -657,14 +659,15 @@ public class MouseEvent extends InputEvent { * @param when A long integer that gives the time the event occurred. * Passing negative or zero value * is not recommended - * @param modifiers The modifier keys down during event (e.g. shift, ctrl, - * alt, meta) + * @param modifiers a modifier mask describing the modifier keys and mouse + * buttons (for example, shift, ctrl, alt, and meta) that + * are down during the event. + * Only extended modifiers are allowed to be used as a + * value for this parameter (see the {@link InputEvent#getModifiersEx} + * class for the description of extended modifiers). * Passing negative parameter * is not recommended. - * Zero value means that no modifiers were passed. - * Use either an extended _DOWN_MASK or old _MASK modifiers, - * however do not mix models in the one event. - * The extended modifiers are preferred for using + * Zero value means that no modifiers were passed * @param x The horizontal x coordinate for the mouse location. * It is allowed to pass negative values * @param y The vertical y coordinate for the mouse location. diff --git a/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java b/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java index f49210d081d9080040ecf5a171c348e7dff4ca84..339be3621d95d00fc75fa24a5a33214b9f0a0d78 100644 --- a/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java +++ b/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java @@ -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); } /** diff --git a/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java b/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java index 70d09510de259a9e2c96152f39370740dddc477b..b52b2abbca0c54076365f31999c8251e267dbaaf 100644 --- a/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java +++ b/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java @@ -141,7 +141,7 @@ public class ReferenceUriSchemesSupported * Returns the string table for class ReferenceUriSchemesSupported. */ protected String[] getStringTable() { - return (String[])myStringTable.clone(); + return myStringTable.clone(); } /** diff --git a/src/share/classes/sun/beans/infos/ComponentBeanInfo.java b/src/share/classes/sun/beans/infos/ComponentBeanInfo.java index e16511f98544a9e7e18db11019beecbf0d88f1b5..ae6631f1f3149670292c099da4e96413b248ed4e 100644 --- a/src/share/classes/sun/beans/infos/ComponentBeanInfo.java +++ b/src/share/classes/sun/beans/infos/ComponentBeanInfo.java @@ -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 beanClass = java.awt.Component.class; public PropertyDescriptor[] getPropertyDescriptors() { try {