--- a/jdk/src/share/classes/com/sun/java/swing/Painter.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/Painter.java Tue Dec 20 15:26:23 2011 -0800
@@ -29,5 +29,5 @@
*
* @deprecated Use {@link javax.swing.Painter} instead.
*/
-public interface Painter<T> extends javax.swing.Painter {
+public interface Painter<T> extends javax.swing.Painter<T> {
}
--- a/jdk/src/share/classes/java/awt/AWTEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/AWTEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -278,9 +278,9 @@
private static synchronized Field get_InputEvent_CanAccessSystemClipboard() {
if (inputEvent_CanAccessSystemClipboard_Field == null) {
inputEvent_CanAccessSystemClipboard_Field =
- (Field)java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<Field>() {
+ public Field run() {
Field field = null;
try {
field = InputEvent.class.
--- a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java Tue Dec 20 15:26:23 2011 -0800
@@ -953,7 +953,7 @@
* AWTEventMulticaster. Additionally, only listeners of type listenerType
* are counted. Method modified to fix bug 4513402. -bchristi
*/
- private static int getListenerCount(EventListener l, Class listenerType) {
+ private static int getListenerCount(EventListener l, Class<?> listenerType) {
if (l instanceof AWTEventMulticaster) {
AWTEventMulticaster mc = (AWTEventMulticaster)l;
return getListenerCount(mc.a, listenerType) +
@@ -1017,6 +1017,7 @@
*
* @since 1.4
*/
+ @SuppressWarnings("unchecked")
public static <T extends EventListener> T[]
getListeners(EventListener l, Class<T> listenerType)
{
--- a/jdk/src/share/classes/java/awt/Component.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Component.java Tue Dec 20 15:26:23 2011 -0800
@@ -382,7 +382,7 @@
* @serial
* @see #add
*/
- Vector popups;
+ Vector<PopupMenu> popups;
/**
* A component's name.
@@ -441,7 +441,7 @@
* @see #getFocusTraversalKeys
* @since 1.4
*/
- Set[] focusTraversalKeys;
+ Set<AWTKeyStroke>[] focusTraversalKeys;
private static final String[] focusTraversalKeyPropertyNames = {
"forwardFocusTraversalKeys",
@@ -598,12 +598,12 @@
initIDs();
}
- String s = (String) java.security.AccessController.doPrivileged(
- new GetPropertyAction("awt.image.incrementaldraw"));
+ String s = java.security.AccessController.doPrivileged(
+ new GetPropertyAction("awt.image.incrementaldraw"));
isInc = (s == null || s.equals("true"));
- s = (String) java.security.AccessController.doPrivileged(
- new GetPropertyAction("awt.image.redrawrate"));
+ s = java.security.AccessController.doPrivileged(
+ new GetPropertyAction("awt.image.redrawrate"));
incRate = (s != null) ? Integer.parseInt(s) : 100;
}
@@ -986,6 +986,7 @@
appContext = AppContext.getAppContext();
}
+ @SuppressWarnings({"rawtypes", "unchecked"})
void initializeFocusTraversalKeys() {
focusTraversalKeys = new Set[3];
}
@@ -1369,13 +1370,13 @@
throw new HeadlessException();
}
- PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
- return MouseInfo.getPointerInfo();
- }
- }
- );
+ PointerInfo pi = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<PointerInfo>() {
+ public PointerInfo run() {
+ return MouseInfo.getPointerInfo();
+ }
+ }
+ );
synchronized (getTreeLock()) {
Component inTheSameWindow = findUnderMouseInWindow(pi);
@@ -2334,7 +2335,7 @@
peer.setBounds(nativeX, nativeY, width, height, op);
}
-
+ @SuppressWarnings("deprecation")
private void notifyNewBounds(boolean resized, boolean moved) {
if (componentListener != null
|| (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0
@@ -4690,6 +4691,7 @@
dispatchEventImpl(e);
}
+ @SuppressWarnings("deprecation")
void dispatchEventImpl(AWTEvent e) {
int id = e.getID();
@@ -5242,7 +5244,7 @@
* @since 1.4
*/
public synchronized ComponentListener[] getComponentListeners() {
- return (ComponentListener[]) (getListeners(ComponentListener.class));
+ return getListeners(ComponentListener.class);
}
/**
@@ -5311,7 +5313,7 @@
* @since 1.4
*/
public synchronized FocusListener[] getFocusListeners() {
- return (FocusListener[]) (getListeners(FocusListener.class));
+ return getListeners(FocusListener.class);
}
/**
@@ -5402,7 +5404,7 @@
* @since 1.4
*/
public synchronized HierarchyListener[] getHierarchyListeners() {
- return (HierarchyListener[])(getListeners(HierarchyListener.class));
+ return getListeners(HierarchyListener.class);
}
/**
@@ -5564,8 +5566,7 @@
* @since 1.4
*/
public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners() {
- return (HierarchyBoundsListener[])
- (getListeners(HierarchyBoundsListener.class));
+ return getListeners(HierarchyBoundsListener.class);
}
/*
@@ -5644,7 +5645,7 @@
* @since 1.4
*/
public synchronized KeyListener[] getKeyListeners() {
- return (KeyListener[]) (getListeners(KeyListener.class));
+ return getListeners(KeyListener.class);
}
/**
@@ -5713,7 +5714,7 @@
* @since 1.4
*/
public synchronized MouseListener[] getMouseListeners() {
- return (MouseListener[]) (getListeners(MouseListener.class));
+ return getListeners(MouseListener.class);
}
/**
@@ -5782,7 +5783,7 @@
* @since 1.4
*/
public synchronized MouseMotionListener[] getMouseMotionListeners() {
- return (MouseMotionListener[]) (getListeners(MouseMotionListener.class));
+ return getListeners(MouseMotionListener.class);
}
/**
@@ -5855,7 +5856,7 @@
* @since 1.4
*/
public synchronized MouseWheelListener[] getMouseWheelListeners() {
- return (MouseWheelListener[]) (getListeners(MouseWheelListener.class));
+ return getListeners(MouseWheelListener.class);
}
/**
@@ -5922,7 +5923,7 @@
* @since 1.4
*/
public synchronized InputMethodListener[] getInputMethodListeners() {
- return (InputMethodListener[]) (getListeners(InputMethodListener.class));
+ return getListeners(InputMethodListener.class);
}
/**
@@ -5967,6 +5968,7 @@
*
* @since 1.3
*/
+ @SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
EventListener l = null;
if (listenerType == ComponentListener.class) {
@@ -6909,7 +6911,7 @@
int npopups = (popups != null? popups.size() : 0);
for (int i = 0 ; i < npopups ; i++) {
- PopupMenu popup = (PopupMenu)popups.elementAt(i);
+ PopupMenu popup = popups.elementAt(i);
popup.addNotify();
}
@@ -6979,7 +6981,7 @@
int npopups = (popups != null? popups.size() : 0);
for (int i = 0 ; i < npopups ; i++) {
- PopupMenu popup = (PopupMenu)popups.elementAt(i);
+ PopupMenu popup = popups.elementAt(i);
popup.removeNotify();
}
// If there is any input context for this component, notify
@@ -7238,7 +7240,7 @@
// would erroneously generate an IllegalArgumentException for
// DOWN_CYCLE_TRAVERSAL_KEY.
final void setFocusTraversalKeys_NoIDCheck(int id, Set<? extends AWTKeyStroke> keystrokes) {
- Set oldKeys;
+ Set<AWTKeyStroke> oldKeys;
synchronized (this) {
if (focusTraversalKeys == null) {
@@ -7246,20 +7248,12 @@
}
if (keystrokes != null) {
- for (Iterator iter = keystrokes.iterator(); iter.hasNext(); ) {
- Object obj = iter.next();
-
- if (obj == null) {
+ for (AWTKeyStroke keystroke : keystrokes ) {
+
+ if (keystroke == null) {
throw new IllegalArgumentException("cannot set null focus traversal key");
}
- // Fix for 6195828:
- //According to javadoc this method should throw IAE instead of ClassCastException
- if (!(obj instanceof AWTKeyStroke)) {
- throw new IllegalArgumentException("object is expected to be AWTKeyStroke");
- }
- AWTKeyStroke keystroke = (AWTKeyStroke)obj;
-
if (keystroke.getKeyChar() != KeyEvent.CHAR_UNDEFINED) {
throw new IllegalArgumentException("focus traversal keys cannot map to KEY_TYPED events");
}
@@ -7279,16 +7273,16 @@
oldKeys = focusTraversalKeys[id];
focusTraversalKeys[id] = (keystrokes != null)
- ? Collections.unmodifiableSet(new HashSet(keystrokes))
+ ? Collections.unmodifiableSet(new HashSet<AWTKeyStroke>(keystrokes))
: null;
}
firePropertyChange(focusTraversalKeyPropertyNames[id], oldKeys,
keystrokes);
}
- final Set getFocusTraversalKeys_NoIDCheck(int id) {
+ final Set<AWTKeyStroke> getFocusTraversalKeys_NoIDCheck(int id) {
// Okay to return Set directly because it is an unmodifiable view
- Set keystrokes = (focusTraversalKeys != null)
+ Set<AWTKeyStroke> keystrokes = (focusTraversalKeys != null)
? focusTraversalKeys[id]
: null;
@@ -7686,7 +7680,7 @@
}
Window window = getContainingWindow();
- if (window == null || !((Window)window).isFocusableWindow()) {
+ if (window == null || !window.isFocusableWindow()) {
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("Component doesn't have toplevel");
}
@@ -8025,7 +8019,7 @@
popup.parent.remove(popup);
}
if (popups == null) {
- popups = new Vector();
+ popups = new Vector<PopupMenu>();
}
popups.addElement(popup);
popup.parent = this;
@@ -8044,6 +8038,7 @@
* @see #add(PopupMenu)
* @since JDK1.1
*/
+ @SuppressWarnings("unchecked")
public void remove(MenuComponent popup) {
synchronized (getTreeLock()) {
if (popups == null) {
@@ -8556,26 +8551,26 @@
//
// Swing classes MUST be loaded by the bootstrap class loader,
// otherwise we don't consider them.
- for (Class klass = Component.this.getClass(); klass != null;
+ for (Class<?> klass = Component.this.getClass(); klass != null;
klass = klass.getSuperclass()) {
if (klass.getPackage() == swingPackage &&
klass.getClassLoader() == null) {
- final Class swingClass = klass;
+ final Class<?> swingClass = klass;
// Find the first override of the compWriteObjectNotify method
- Method[] methods = (Method[])AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return swingClass.getDeclaredMethods();
- }
- });
+ Method[] methods = AccessController.doPrivileged(
+ new PrivilegedAction<Method[]>() {
+ public Method[] run() {
+ return swingClass.getDeclaredMethods();
+ }
+ });
for (int counter = methods.length - 1; counter >= 0;
counter--) {
final Method method = methods[counter];
if (method.getName().equals("compWriteObjectNotify")){
// We found it, use doPrivileged to make it accessible
// to use.
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
method.setAccessible(true);
return null;
}
@@ -8804,7 +8799,7 @@
if (popups != null) {
int npopups = popups.size();
for (int i = 0 ; i < npopups ; i++) {
- PopupMenu popup = (PopupMenu)popups.elementAt(i);
+ PopupMenu popup = popups.elementAt(i);
popup.parent = this;
}
}
@@ -9658,7 +9653,7 @@
if (obj == null) return false;
if (className == null) return false;
- Class cls = obj.getClass();
+ Class<?> cls = obj.getClass();
while (cls != null) {
if (cls.getName().equals(className)) {
return true;
--- a/jdk/src/share/classes/java/awt/Font.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Font.java Tue Dec 20 15:26:23 2011 -0800
@@ -254,7 +254,7 @@
* @serial
* @see #getAttributes()
*/
- private Hashtable fRequestedAttributes;
+ private Hashtable<Object, Object> fRequestedAttributes;
/*
* Constants to be used for logical font family names.
@@ -446,6 +446,7 @@
// We implement this functionality in a package-private method
// to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
+ @SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
if(peer == null) {
Toolkit tk = Toolkit.getDefaultToolkit();
@@ -907,11 +908,11 @@
break;
}
if (tracker != null) {
- if (totalSize+bytesRead > tracker.MAX_FILE_SIZE) {
+ if (totalSize+bytesRead > CreatedFontTracker.MAX_FILE_SIZE) {
throw new IOException("File too big.");
}
if (totalSize+tracker.getNumBytes() >
- tracker.MAX_TOTAL_BYTES)
+ CreatedFontTracker.MAX_TOTAL_BYTES)
{
throw new IOException("Total files too big.");
}
@@ -2126,11 +2127,11 @@
return false; // REMIND always safe, but prevents caller optimize
}
- private transient SoftReference flmref;
+ private transient SoftReference<FontLineMetrics> flmref;
private FontLineMetrics defaultLineMetrics(FontRenderContext frc) {
FontLineMetrics flm = null;
if (flmref == null
- || (flm = (FontLineMetrics)flmref.get()) == null
+ || (flm = flmref.get()) == null
|| !flm.frc.equals(frc)) {
/* The device transform in the frc is not used in obtaining line
@@ -2194,7 +2195,7 @@
ssOffset, italicAngle);
flm = new FontLineMetrics(0, cm, frc);
- flmref = new SoftReference(flm);
+ flmref = new SoftReference<FontLineMetrics>(flm);
}
return (FontLineMetrics)flm.clone();
--- a/jdk/src/share/classes/java/awt/Toolkit.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Toolkit.java Tue Dec 20 15:26:23 2011 -0800
@@ -706,9 +706,9 @@
final Properties properties = new Properties();
- atNames = (String)java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ atNames = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<String>() {
+ public String run() {
// Try loading the per-user accessibility properties file.
try {
@@ -798,7 +798,7 @@
while (parser.hasMoreTokens()) {
atName = parser.nextToken();
try {
- Class clazz;
+ Class<?> clazz;
if (cl != null) {
clazz = cl.loadClass(atName);
} else {
@@ -860,8 +860,8 @@
java.lang.Compiler.disable();
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
String nm = null;
Class cls = null;
try {
@@ -1653,8 +1653,8 @@
static {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
try {
resources =
ResourceBundle.getBundle("sun.awt.resources.awt",
@@ -1984,7 +1984,7 @@
private int[] calls = new int[LONG_BITS];
private static volatile long enabledOnToolkitMask;
private AWTEventListener eventListener = null;
- private WeakHashMap listener2SelectiveListener = new WeakHashMap();
+ private WeakHashMap<AWTEventListener, SelectiveAWTEventListener> listener2SelectiveListener = new WeakHashMap<>();
/*
* Extracts a "pure" AWTEventListener from a AWTEventListenerProxy,
@@ -2051,7 +2051,7 @@
}
synchronized (this) {
SelectiveAWTEventListener selectiveListener =
- (SelectiveAWTEventListener)listener2SelectiveListener.get(localL);
+ listener2SelectiveListener.get(localL);
if (selectiveListener == null) {
// Create a new selectiveListener.
@@ -2121,7 +2121,7 @@
synchronized (this) {
SelectiveAWTEventListener selectiveListener =
- (SelectiveAWTEventListener)listener2SelectiveListener.get(localL);
+ listener2SelectiveListener.get(localL);
if (selectiveListener != null) {
listener2SelectiveListener.remove(localL);
@@ -2244,7 +2244,7 @@
synchronized (this) {
EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class);
- java.util.List list = new ArrayList(la.length);
+ java.util.List<AWTEventListenerProxy> list = new ArrayList<>(la.length);
for (int i = 0; i < la.length; i++) {
SelectiveAWTEventListener sael = (SelectiveAWTEventListener)la[i];
@@ -2254,7 +2254,7 @@
sael.getListener()));
}
}
- return (AWTEventListener[])list.toArray(new AWTEventListener[0]);
+ return list.toArray(new AWTEventListener[0]);
}
}
@@ -2457,7 +2457,9 @@
}
}
+ @SuppressWarnings("serial")
private static class DesktopPropertyChangeSupport extends PropertyChangeSupport {
+
private static final StringBuilder PROP_CHANGE_SUPPORT_KEY =
new StringBuilder("desktop property change support key");
private final Object source;
--- a/jdk/src/share/classes/java/awt/image/ColorModel.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/java/awt/image/ColorModel.java Tue Dec 20 15:26:23 2011 -0800
@@ -357,7 +357,7 @@
this.transparency = transparency;
}
- nBits = (int[]) bits.clone();
+ nBits = bits.clone();
this.pixel_bits = pixel_bits;
if (pixel_bits <= 0) {
throw new IllegalArgumentException("Number of pixel bits must "+
@@ -474,7 +474,7 @@
*/
public int[] getComponentSize() {
if (nBits != null) {
- return (int[]) nBits.clone();
+ return nBits.clone();
}
return null;
@@ -1692,10 +1692,10 @@
static short[] s8Tol16 = null; // 8-bit non-linear sRGB to 16-bit linear LUT
// Maps to hold LUTs for grayscale conversions
- static Map g8Tos8Map = null; // 8-bit gray values to 8-bit sRGB values
- static Map lg16Toog8Map = null; // 16-bit linear to 8-bit "other" gray
- static Map g16Tos8Map = null; // 16-bit gray values to 8-bit sRGB values
- static Map lg16Toog16Map = null; // 16-bit linear to 16-bit "other" gray
+ static Map<ICC_ColorSpace, byte[]> g8Tos8Map = null; // 8-bit gray values to 8-bit sRGB values
+ static Map<ICC_ColorSpace, byte[]> lg16Toog8Map = null; // 16-bit linear to 8-bit "other" gray
+ static Map<ICC_ColorSpace, byte[]> g16Tos8Map = null; // 16-bit gray values to 8-bit sRGB values
+ static Map<ICC_ColorSpace, short[]> lg16Toog16Map = null; // 16-bit linear to 16-bit "other" gray
static boolean isLinearRGBspace(ColorSpace cs) {
// Note: CMM.LINEAR_RGBspace will be null if the linear
@@ -1799,7 +1799,7 @@
return getLinearRGB8TosRGB8LUT();
}
if (g8Tos8Map != null) {
- byte[] g8Tos8LUT = (byte []) g8Tos8Map.get(grayCS);
+ byte[] g8Tos8LUT = g8Tos8Map.get(grayCS);
if (g8Tos8LUT != null) {
return g8Tos8LUT;
}
@@ -1827,7 +1827,7 @@
g8Tos8LUT[i] = tmp[j];
}
if (g8Tos8Map == null) {
- g8Tos8Map = Collections.synchronizedMap(new WeakHashMap(2));
+ g8Tos8Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, byte[]>(2));
}
g8Tos8Map.put(grayCS, g8Tos8LUT);
return g8Tos8LUT;
@@ -1840,7 +1840,7 @@
*/
static byte[] getLinearGray16ToOtherGray8LUT(ICC_ColorSpace grayCS) {
if (lg16Toog8Map != null) {
- byte[] lg16Toog8LUT = (byte []) lg16Toog8Map.get(grayCS);
+ byte[] lg16Toog8LUT = lg16Toog8Map.get(grayCS);
if (lg16Toog8LUT != null) {
return lg16Toog8LUT;
}
@@ -1866,7 +1866,7 @@
(byte) (((float) (tmp[i] & 0xffff)) * (1.0f /257.0f) + 0.5f);
}
if (lg16Toog8Map == null) {
- lg16Toog8Map = Collections.synchronizedMap(new WeakHashMap(2));
+ lg16Toog8Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, byte[]>(2));
}
lg16Toog8Map.put(grayCS, lg16Toog8LUT);
return lg16Toog8LUT;
@@ -1884,7 +1884,7 @@
return getLinearRGB16TosRGB8LUT();
}
if (g16Tos8Map != null) {
- byte[] g16Tos8LUT = (byte []) g16Tos8Map.get(grayCS);
+ byte[] g16Tos8LUT = g16Tos8Map.get(grayCS);
if (g16Tos8LUT != null) {
return g16Tos8LUT;
}
@@ -1916,7 +1916,7 @@
(byte) (((float) (tmp[j] & 0xffff)) * (1.0f /257.0f) + 0.5f);
}
if (g16Tos8Map == null) {
- g16Tos8Map = Collections.synchronizedMap(new WeakHashMap(2));
+ g16Tos8Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, byte[]>(2));
}
g16Tos8Map.put(grayCS, g16Tos8LUT);
return g16Tos8LUT;
@@ -1929,7 +1929,7 @@
*/
static short[] getLinearGray16ToOtherGray16LUT(ICC_ColorSpace grayCS) {
if (lg16Toog16Map != null) {
- short[] lg16Toog16LUT = (short []) lg16Toog16Map.get(grayCS);
+ short[] lg16Toog16LUT = lg16Toog16Map.get(grayCS);
if (lg16Toog16LUT != null) {
return lg16Toog16LUT;
}
@@ -1950,7 +1950,7 @@
transformList);
short[] lg16Toog16LUT = t.colorConvert(tmp, null);
if (lg16Toog16Map == null) {
- lg16Toog16Map = Collections.synchronizedMap(new WeakHashMap(2));
+ lg16Toog16Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, short[]>(2));
}
lg16Toog16Map.put(grayCS, lg16Toog16LUT);
return lg16Toog16LUT;
--- a/jdk/src/share/classes/javax/swing/AbstractButton.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/AbstractButton.java Tue Dec 20 15:26:23 2011 -0800
@@ -1349,6 +1349,7 @@
return new ButtonActionPropertyChangeListener(this, a);
}
+ @SuppressWarnings("serial")
private static class ButtonActionPropertyChangeListener
extends ActionPropertyChangeListener<AbstractButton> {
ButtonActionPropertyChangeListener(AbstractButton b, Action a) {
@@ -1976,6 +1977,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class ButtonChangeListener implements ChangeListener, Serializable {
// NOTE: This class is NOT used, instead the functionality has
// been moved to Handler.
@@ -2320,6 +2322,7 @@
//
// Listeners that are added to model
//
+ @SuppressWarnings("serial")
class Handler implements ActionListener, ChangeListener, ItemListener,
Serializable {
//
@@ -2472,7 +2475,7 @@
// the members of the button group.
int len = group.getButtonCount();
Object [] target = new Object[len];
- Enumeration elem = group.getElements();
+ Enumeration<AbstractButton> elem = group.getElements();
for (int i = 0; i < len; i++) {
if (elem.hasMoreElements()) {
target[i] = elem.nextElement();
--- a/jdk/src/share/classes/javax/swing/ActionMap.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/ActionMap.java Tue Dec 20 15:26:23 2011 -0800
@@ -55,6 +55,7 @@
* @author Scott Violet
* @since 1.3
*/
+@SuppressWarnings("serial")
public class ActionMap implements Serializable {
/** Handles the mapping between Action name and Action. */
private transient ArrayTable arrayTable;
--- a/jdk/src/share/classes/javax/swing/ActionPropertyChangeListener.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/ActionPropertyChangeListener.java Tue Dec 20 15:26:23 2011 -0800
@@ -101,9 +101,9 @@
// Check to see whether any old buttons have
// been enqueued for GC. If so, look up their
// PCL instance and remove it from its Action.
- OwnedWeakReference r;
+ OwnedWeakReference<?> r;
while ((r = (OwnedWeakReference)queue.poll()) != null) {
- ActionPropertyChangeListener oldPCL = r.getOwner();
+ ActionPropertyChangeListener<?> oldPCL = r.getOwner();
Action oldAction = oldPCL.getAction();
if (oldAction!=null) {
oldAction.removePropertyChangeListener(oldPCL);
@@ -142,15 +142,15 @@
private static class OwnedWeakReference<U extends JComponent> extends
WeakReference<U> {
- private ActionPropertyChangeListener owner;
+ private ActionPropertyChangeListener<?> owner;
OwnedWeakReference(U target, ReferenceQueue<? super U> queue,
- ActionPropertyChangeListener owner) {
+ ActionPropertyChangeListener<?> owner) {
super(target, queue);
this.owner = owner;
}
- public ActionPropertyChangeListener getOwner() {
+ public ActionPropertyChangeListener<?> getOwner() {
return owner;
}
}
--- a/jdk/src/share/classes/javax/swing/AncestorNotifier.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/AncestorNotifier.java Tue Dec 20 15:26:23 2011 -0800
@@ -42,6 +42,7 @@
* @author Dave Moore
*/
+@SuppressWarnings("serial")
class AncestorNotifier implements ComponentListener, PropertyChangeListener, Serializable
{
Component firstInvisibleAncestor;
--- a/jdk/src/share/classes/javax/swing/ArrayTable.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/ArrayTable.java Tue Dec 20 15:26:23 2011 -0800
@@ -133,7 +133,7 @@
if ((size==ARRAY_BOUNDARY) && isArray()) {
grow();
}
- ((Hashtable)table).put(key, value);
+ ((Hashtable<Object,Object>)table).put(key, value);
}
}
}
@@ -259,8 +259,8 @@
newArrayTable.put(array[i], array[i+1]);
}
} else {
- Hashtable tmp = (Hashtable)table;
- Enumeration keys = tmp.keys();
+ Hashtable<?,?> tmp = (Hashtable)table;
+ Enumeration<?> keys = tmp.keys();
while (keys.hasMoreElements()) {
Object o = keys.nextElement();
newArrayTable.put(o,tmp.get(o));
@@ -289,8 +289,8 @@
keys[index] = array[i];
}
} else {
- Hashtable tmp = (Hashtable)table;
- Enumeration enum_ = tmp.keys();
+ Hashtable<?,?> tmp = (Hashtable)table;
+ Enumeration<?> enum_ = tmp.keys();
int counter = tmp.size();
if (keys == null) {
keys = new Object[counter];
@@ -326,9 +326,9 @@
* Shrinks the storage from a hashtable to an array.
*/
private void shrink() {
- Hashtable tmp = (Hashtable)table;
+ Hashtable<?,?> tmp = (Hashtable)table;
Object[] array = new Object[tmp.size()*2];
- Enumeration keys = tmp.keys();
+ Enumeration<?> keys = tmp.keys();
int j = 0;
while (keys.hasMoreElements()) {
--- a/jdk/src/share/classes/javax/swing/Box.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/Box.java Tue Dec 20 15:26:23 2011 -0800
@@ -76,6 +76,7 @@
*
* @author Timothy Prinzing
*/
+@SuppressWarnings("serial")
public class Box extends JComponent implements Accessible {
/**
@@ -301,6 +302,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
public static class Filler extends JComponent implements Accessible {
/**
@@ -380,6 +382,7 @@
* This class implements accessibility support for the
* <code>Box.Filler</code> class.
*/
+ @SuppressWarnings("serial")
protected class AccessibleBoxFiller extends AccessibleAWTComponent {
// AccessibleContext methods
//
@@ -420,6 +423,7 @@
* This class implements accessibility support for the
* <code>Box</code> class.
*/
+ @SuppressWarnings("serial")
protected class AccessibleBox extends AccessibleAWTContainer {
// AccessibleContext methods
//
--- a/jdk/src/share/classes/javax/swing/BoxLayout.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/BoxLayout.java Tue Dec 20 15:26:23 2011 -0800
@@ -135,6 +135,7 @@
*
* @author Timothy Prinzing
*/
+@SuppressWarnings("serial")
public class BoxLayout implements LayoutManager2, Serializable {
/**
--- a/jdk/src/share/classes/javax/swing/ButtonGroup.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/ButtonGroup.java Tue Dec 20 15:26:23 2011 -0800
@@ -65,6 +65,7 @@
*
* @author Jeff Dinkins
*/
+@SuppressWarnings("serial")
public class ButtonGroup implements Serializable {
// the list of buttons participating in this group
--- a/jdk/src/share/classes/javax/swing/ComponentInputMap.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/ComponentInputMap.java Tue Dec 20 15:26:23 2011 -0800
@@ -35,6 +35,7 @@
* @author Scott Violet
* @since 1.3
*/
+@SuppressWarnings("serial")
public class ComponentInputMap extends InputMap {
/** Component binding is created for. */
private JComponent component;
--- a/jdk/src/share/classes/javax/swing/InputMap.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/InputMap.java Tue Dec 20 15:26:23 2011 -0800
@@ -52,6 +52,7 @@
* @author Scott Violet
* @since 1.3
*/
+@SuppressWarnings("serial")
public class InputMap implements Serializable {
/** Handles the mapping between KeyStroke and Action name. */
private transient ArrayTable arrayTable;
--- a/jdk/src/share/classes/javax/swing/JButton.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JButton.java Tue Dec 20 15:26:23 2011 -0800
@@ -75,6 +75,7 @@
*
* @author Jeff Dinkins
*/
+@SuppressWarnings("serial")
public class JButton extends AbstractButton implements Accessible {
/**
@@ -307,6 +308,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJButton extends AccessibleAbstractButton {
/**
--- a/jdk/src/share/classes/javax/swing/JComponent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JComponent.java Tue Dec 20 15:26:23 2011 -0800
@@ -2109,7 +2109,8 @@
private void registerWithKeyboardManager(boolean onlyIfNew) {
InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, false);
KeyStroke[] strokes;
- Hashtable<KeyStroke, KeyStroke> registered = (Hashtable)getClientProperty
+ Hashtable<KeyStroke, KeyStroke> registered =
+ (Hashtable<KeyStroke, KeyStroke>)getClientProperty
(WHEN_IN_FOCUSED_WINDOW_BINDINGS);
if (inputMap != null) {
@@ -2161,14 +2162,15 @@
* <code>WHEN_IN_FOCUSED_WINDOW</code> <code>KeyStroke</code> bindings.
*/
private void unregisterWithKeyboardManager() {
- Hashtable registered = (Hashtable)getClientProperty
+ Hashtable<KeyStroke, KeyStroke> registered =
+ (Hashtable<KeyStroke, KeyStroke>)getClientProperty
(WHEN_IN_FOCUSED_WINDOW_BINDINGS);
if (registered != null && registered.size() > 0) {
- Enumeration keys = registered.keys();
+ Enumeration<KeyStroke> keys = registered.keys();
while (keys.hasMoreElements()) {
- KeyStroke ks = (KeyStroke)keys.nextElement();
+ KeyStroke ks = keys.nextElement();
unregisterWithKeyboardManager(ks);
}
}
@@ -3469,6 +3471,7 @@
}
}
+ @SuppressWarnings("serial")
static class KeyboardState implements Serializable {
private static final Object keyCodesKey =
JComponent.KeyboardState.class;
@@ -4125,13 +4128,13 @@
if (!getFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET)) {
super.setFocusTraversalKeys(KeyboardFocusManager.
FORWARD_TRAVERSAL_KEYS,
- (Set)value);
+ (Set<AWTKeyStroke>)value);
}
} else if (propertyName == "focusTraversalKeysBackward") {
if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) {
super.setFocusTraversalKeys(KeyboardFocusManager.
BACKWARD_TRAVERSAL_KEYS,
- (Set)value);
+ (Set<AWTKeyStroke>)value);
}
} else {
throw new IllegalArgumentException("property \""+
@@ -4188,6 +4191,7 @@
*
* @return true if this component is lightweight
*/
+ @SuppressWarnings("deprecation")
public static boolean isLightweightComponent(Component c) {
return c.getPeer() instanceof LightweightPeer;
}
--- a/jdk/src/share/classes/javax/swing/JLabel.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JLabel.java Tue Dec 20 15:26:23 2011 -0800
@@ -104,6 +104,7 @@
*
* @author Hans Muller
*/
+@SuppressWarnings("serial")
public class JLabel extends JComponent implements SwingConstants, Accessible
{
/**
@@ -1067,6 +1068,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJLabel extends AccessibleJComponent
implements AccessibleText, AccessibleExtendedComponent {
--- a/jdk/src/share/classes/javax/swing/JLayeredPane.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JLayeredPane.java Tue Dec 20 15:26:23 2011 -0800
@@ -154,6 +154,7 @@
*
* @author David Kloba
*/
+@SuppressWarnings("serial")
public class JLayeredPane extends JComponent implements Accessible {
/// Watch the values in getObjectForLayer()
/** Convenience object defining the Default layer. Equivalent to new Integer(0).*/
@@ -256,7 +257,7 @@
*/
public void removeAll() {
Component[] children = getComponents();
- Hashtable cToL = getComponentToLayer();
+ Hashtable<Component, Integer> cToL = getComponentToLayer();
for (int counter = children.length - 1; counter >= 0; counter--) {
Component c = children[counter];
if (c != null && !(c instanceof JComponent)) {
@@ -768,6 +769,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJLayeredPane extends AccessibleJComponent {
/**
--- a/jdk/src/share/classes/javax/swing/JMenu.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JMenu.java Tue Dec 20 15:26:23 2011 -0800
@@ -109,6 +109,7 @@
* @see JMenuBar
* @see JPopupMenu
*/
+@SuppressWarnings("serial")
public class JMenu extends JMenuItem implements Accessible,MenuElement
{
/**
@@ -134,13 +135,6 @@
*/
private MenuEvent menuEvent = null;
- /* Registry of listeners created for <code>Action-JMenuItem</code>
- * linkage. This is needed so that references can
- * be cleaned up at remove time to allow garbage collection
- * Default is <code>null</code>.
- */
- private static Hashtable listenerRegistry = null;
-
/*
* Used by the look and feel (L&F) code to handle
* implementation specific menu behaviors.
@@ -1111,6 +1105,7 @@
void configureAcceleratorFromAction(Action a) {
}
+ @SuppressWarnings("serial")
class MenuChangeListener implements ChangeListener, Serializable {
boolean isSelected = false;
public void stateChanged(ChangeEvent e) {
@@ -1158,6 +1153,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class WinListener extends WindowAdapter implements Serializable {
JPopupMenu popupMenu;
/**
@@ -1394,6 +1390,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJMenu extends AccessibleJMenuItem
implements AccessibleSelection {
--- a/jdk/src/share/classes/javax/swing/JMenuBar.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JMenuBar.java Tue Dec 20 15:26:23 2011 -0800
@@ -82,6 +82,7 @@
* @see JPopupMenu
* @see JMenuItem
*/
+@SuppressWarnings("serial")
public class JMenuBar extends JComponent implements Accessible,MenuElement
{
/**
@@ -498,6 +499,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJMenuBar extends AccessibleJComponent
implements AccessibleSelection {
--- a/jdk/src/share/classes/javax/swing/JMenuItem.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JMenuItem.java Tue Dec 20 15:26:23 2011 -0800
@@ -87,6 +87,7 @@
* @see JCheckBoxMenuItem
* @see JRadioButtonMenuItem
*/
+@SuppressWarnings("serial")
public class JMenuItem extends AbstractButton implements Accessible,MenuElement {
/**
@@ -829,6 +830,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJMenuItem extends AccessibleAbstractButton implements ChangeListener {
private boolean isArmed = false;
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java Tue Dec 20 15:26:23 2011 -0800
@@ -81,6 +81,7 @@
* @author David Karlton
* @author Arnaud Weber
*/
+@SuppressWarnings("serial")
public class JPopupMenu extends JComponent implements Accessible,MenuElement {
/**
@@ -1200,6 +1201,7 @@
* Java Accessibility API appropriate to popup menu user-interface
* elements.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJPopupMenu extends AccessibleJComponent
implements PropertyChangeListener {
@@ -1268,7 +1270,7 @@
private void fireActiveDescendant() {
if (JPopupMenu.this instanceof BasicComboPopup) {
// get the popup list
- JList popupList = ((BasicComboPopup)JPopupMenu.this).getList();
+ JList<?> popupList = ((BasicComboPopup)JPopupMenu.this).getList();
if (popupList == null) {
return;
}
@@ -1335,7 +1337,7 @@
throws IOException, ClassNotFoundException {
s.defaultReadObject();
- Vector values = (Vector)s.readObject();
+ Vector<?> values = (Vector)s.readObject();
int indexCounter = 0;
int maxCounter = values.size();
@@ -1519,6 +1521,7 @@
/**
* A popup menu-specific separator.
*/
+ @SuppressWarnings("serial")
static public class Separator extends JSeparator
{
public Separator( )
--- a/jdk/src/share/classes/javax/swing/JRootPane.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JRootPane.java Tue Dec 20 15:26:23 2011 -0800
@@ -199,6 +199,7 @@
* @author David Kloba
*/
/// PENDING(klobad) Who should be opaque in this component?
+@SuppressWarnings("serial")
public class JRootPane extends JComponent implements Accessible {
private static final String uiClassID = "RootPaneUI";
@@ -834,6 +835,7 @@
}
}
+ @SuppressWarnings("serial")
static class DefaultAction extends AbstractAction {
JButton owner;
JRootPane root;
@@ -900,6 +902,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class RootLayout implements LayoutManager2, Serializable
{
/**
@@ -1065,6 +1068,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJRootPane extends AccessibleJComponent {
/**
* Get the role of this object.
--- a/jdk/src/share/classes/javax/swing/JSeparator.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JSeparator.java Tue Dec 20 15:26:23 2011 -0800
@@ -71,6 +71,7 @@
* @author Georges Saab
* @author Jeff Shapiro
*/
+@SuppressWarnings("serial")
public class JSeparator extends JComponent implements SwingConstants, Accessible
{
/**
@@ -279,6 +280,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJSeparator extends AccessibleJComponent {
/**
--- a/jdk/src/share/classes/javax/swing/JToolTip.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JToolTip.java Tue Dec 20 15:26:23 2011 -0800
@@ -66,6 +66,7 @@
* @author Dave Moore
* @author Rich Shiavi
*/
+@SuppressWarnings("serial")
public class JToolTip extends JComponent implements Accessible {
/**
* @see #getUIClassID
@@ -251,6 +252,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJToolTip extends AccessibleJComponent {
/**
--- a/jdk/src/share/classes/javax/swing/JTree.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JTree.java Tue Dec 20 15:26:23 2011 -0800
@@ -142,6 +142,7 @@
* @author Ray Ryan
* @author Scott Violet
*/
+@SuppressWarnings("serial")
public class JTree extends JComponent implements Scrollable, Accessible
{
/**
@@ -421,6 +422,7 @@
*/
private int expandRow = -1;
+ @SuppressWarnings("serial")
private class TreeTimer extends Timer {
public TreeTimer() {
super(2000, null);
@@ -3077,7 +3079,7 @@
expandedStack = new Stack<Stack<TreePath>>();
- Vector values = (Vector)s.readObject();
+ Vector<?> values = (Vector)s.readObject();
int indexCounter = 0;
int maxCounter = values.size();
@@ -3159,7 +3161,7 @@
*/
private void unarchiveExpandedState(Object state) {
if(state instanceof Vector) {
- Vector paths = (Vector)state;
+ Vector<?> paths = (Vector)state;
for(int counter = paths.size() - 1; counter >= 0; counter--) {
Boolean eState = (Boolean)paths.elementAt(counter--);
@@ -3240,6 +3242,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected static class EmptySelectionModel extends
DefaultTreeSelectionModel
{
@@ -3361,6 +3364,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class TreeSelectionRedirector implements Serializable,
TreeSelectionListener
{
@@ -3661,7 +3665,7 @@
{
if(toRemove != null) {
while(toRemove.hasMoreElements()) {
- Enumeration descendants = getDescendantToggledPaths
+ Enumeration<?> descendants = getDescendantToggledPaths
(toRemove.nextElement());
if(descendants != null) {
@@ -3861,6 +3865,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
public static class DynamicUtilTreeNode extends DefaultMutableTreeNode {
/**
* Does the this <code>JTree</code> have children?
@@ -3882,7 +3887,7 @@
public static void createChildren(DefaultMutableTreeNode parent,
Object children) {
if(children instanceof Vector) {
- Vector childVector = (Vector)children;
+ Vector<?> childVector = (Vector)children;
for(int counter = 0, maxCounter = childVector.size();
counter < maxCounter; counter++)
@@ -3891,8 +3896,8 @@
childVector.elementAt(counter)));
}
else if(children instanceof Hashtable) {
- Hashtable childHT = (Hashtable)children;
- Enumeration keys = childHT.keys();
+ Hashtable<?,?> childHT = (Hashtable)children;
+ Enumeration<?> keys = childHT.keys();
Object aKey;
while(keys.hasMoreElements()) {
@@ -4092,6 +4097,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJTree extends AccessibleJComponent
implements AccessibleSelection, TreeSelectionListener,
TreeModelListener, TreeExpansionListener {
@@ -5242,6 +5248,7 @@
}
}
+ @SuppressWarnings("deprecation")
public boolean isFocusTraversable() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
--- a/jdk/src/share/classes/javax/swing/JWindow.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JWindow.java Tue Dec 20 15:26:23 2011 -0800
@@ -89,6 +89,7 @@
*
* @author David Kloba
*/
+@SuppressWarnings("serial")
public class JWindow extends Window implements Accessible,
RootPaneContainer,
TransferHandler.HasGetTransferHandler
@@ -663,6 +664,7 @@
* Java Accessibility API appropriate to window user-interface
* elements.
*/
+ @SuppressWarnings("serial")
protected class AccessibleJWindow extends AccessibleAWTWindow {
// everything is in the new parent, AccessibleAWTWindow
}
--- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Tue Dec 20 15:26:23 2011 -0800
@@ -213,7 +213,7 @@
MenuElement menuElement;
MenuElement subElements[];
MenuElement path[];
- Vector tmp;
+ Vector<MenuElement> tmp;
int selectionSize;
p = event.getPoint();
@@ -242,7 +242,7 @@
screenX = p.x;
screenY = p.y;
- tmp = (Vector)selection.clone();
+ tmp = (Vector<MenuElement>)selection.clone();
selectionSize = tmp.size();
boolean success = false;
for (i=selectionSize - 1;i >= 0 && success == false; i--) {
@@ -377,7 +377,7 @@
int cWidth,cHeight;
MenuElement menuElement;
MenuElement subElements[];
- Vector tmp;
+ Vector<MenuElement> tmp;
int selectionSize;
SwingUtilities.convertPointToScreen(p,source);
@@ -385,7 +385,7 @@
screenX = p.x;
screenY = p.y;
- tmp = (Vector)selection.clone();
+ tmp = (Vector<MenuElement>)selection.clone();
selectionSize = tmp.size();
for(i=selectionSize - 1 ; i >= 0 ; i--) {
menuElement = (MenuElement) tmp.elementAt(i);
--- a/jdk/src/share/classes/javax/swing/Popup.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/Popup.java Tue Dec 20 15:26:23 2011 -0800
@@ -98,6 +98,8 @@
* Makes the <code>Popup</code> visible. If the <code>Popup</code> is
* currently visible, this has no effect.
*/
+
+ @SuppressWarnings("deprecation")
public void show() {
Component component = getComponent();
@@ -114,6 +116,8 @@
* on a <code>disposed</code> <code>Popup</code>, indeterminate
* behavior will result.
*/
+
+ @SuppressWarnings("deprecation")
public void hide() {
Component component = getComponent();
--- a/jdk/src/share/classes/javax/swing/RepaintManager.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/RepaintManager.java Tue Dec 20 15:26:23 2011 -0800
@@ -744,7 +744,6 @@
int localBoundsY = 0;
int localBoundsH;
int localBoundsW;
- Enumeration keys;
roots = new ArrayList<Component>(count);
@@ -1073,9 +1072,9 @@
}
}
// Clear out the VolatileImages
- Iterator gcs = volatileMap.keySet().iterator();
+ Iterator<GraphicsConfiguration> gcs = volatileMap.keySet().iterator();
while (gcs.hasNext()) {
- GraphicsConfiguration gc = (GraphicsConfiguration)gcs.next();
+ GraphicsConfiguration gc = gcs.next();
VolatileImage image = volatileMap.get(gc);
if (image.getWidth() > width || image.getHeight() > height) {
image.flush();
--- a/jdk/src/share/classes/javax/swing/Timer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/Timer.java Tue Dec 20 15:26:23 2011 -0800
@@ -146,6 +146,7 @@
*
* @author Dave Moore
*/
+@SuppressWarnings("serial")
public class Timer implements Serializable
{
/*
--- a/jdk/src/share/classes/javax/swing/border/AbstractBorder.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/border/AbstractBorder.java Tue Dec 20 15:26:23 2011 -0800
@@ -46,6 +46,7 @@
*
* @author David Kloba
*/
+@SuppressWarnings("serial")
public abstract class AbstractBorder implements Border, Serializable
{
/**
--- a/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Tue Dec 20 15:26:23 2011 -0800
@@ -54,6 +54,7 @@
*
* @author David Kloba
*/
+@SuppressWarnings("serial")
public class CompoundBorder extends AbstractBorder {
protected Border outsideBorder;
protected Border insideBorder;
--- a/jdk/src/share/classes/javax/swing/border/EmptyBorder.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/border/EmptyBorder.java Tue Dec 20 15:26:23 2011 -0800
@@ -46,6 +46,7 @@
*
* @author David Kloba
*/
+@SuppressWarnings("serial")
public class EmptyBorder extends AbstractBorder implements Serializable
{
protected int left, right, top, bottom;
--- a/jdk/src/share/classes/javax/swing/border/MatteBorder.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/border/MatteBorder.java Tue Dec 20 15:26:23 2011 -0800
@@ -46,6 +46,7 @@
*
* @author Amy Fowler
*/
+@SuppressWarnings("serial")
public class MatteBorder extends EmptyBorder
{
protected Color color;
--- a/jdk/src/share/classes/javax/swing/border/TitledBorder.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/border/TitledBorder.java Tue Dec 20 15:26:23 2011 -0800
@@ -67,6 +67,7 @@
* @author David Kloba
* @author Amy Fowler
*/
+@SuppressWarnings("serial")
public class TitledBorder extends AbstractBorder
{
protected String title;
--- a/jdk/src/share/classes/javax/swing/event/AncestorEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/AncestorEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -43,6 +43,7 @@
*
* @author Dave Moore
*/
+@SuppressWarnings("serial")
public class AncestorEvent extends AWTEvent {
/**
* An ancestor-component was added to the hierarchy of
--- a/jdk/src/share/classes/javax/swing/event/ChangeEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/ChangeEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -42,6 +42,7 @@
*
* @author Jeff Dinkins
*/
+@SuppressWarnings("serial")
public class ChangeEvent extends EventObject {
/**
* Constructs a ChangeEvent object.
--- a/jdk/src/share/classes/javax/swing/event/EventListenerList.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/EventListenerList.java Tue Dec 20 15:26:23 2011 -0800
@@ -96,6 +96,7 @@
* @author Hans Muller
* @author James Gosling
*/
+@SuppressWarnings("serial")
public class EventListenerList implements Serializable {
/* A null array to be shared by all empty listener lists*/
private final static Object[] NULL_ARRAY = new Object[0];
@@ -250,7 +251,7 @@
// Save the non-null event listeners:
for (int i = 0; i < lList.length; i+=2) {
- Class t = (Class)lList[i];
+ Class<?> t = (Class)lList[i];
EventListener l = (EventListener)lList[i+1];
if ((l!=null) && (l instanceof Serializable)) {
s.writeObject(t.getName());
--- a/jdk/src/share/classes/javax/swing/event/ListDataEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/ListDataEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -42,6 +42,7 @@
*
* @author Hans Muller
*/
+@SuppressWarnings("serial")
public class ListDataEvent extends EventObject
{
/** Identifies one or more changes in the lists contents. */
--- a/jdk/src/share/classes/javax/swing/event/MenuDragMouseEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/MenuDragMouseEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -47,6 +47,7 @@
*
* @author Georges Saab
*/
+@SuppressWarnings("serial")
public class MenuDragMouseEvent extends MouseEvent {
private MenuElement path[];
private MenuSelectionManager manager;
--- a/jdk/src/share/classes/javax/swing/event/MenuEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/MenuEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -44,6 +44,7 @@
* @author Georges Saab
* @author David Karlton
*/
+@SuppressWarnings("serial")
public class MenuEvent extends EventObject {
/**
* Constructs a MenuEvent object.
--- a/jdk/src/share/classes/javax/swing/event/MenuKeyEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/MenuKeyEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -47,6 +47,7 @@
*
* @author Georges Saab
*/
+@SuppressWarnings("serial")
public class MenuKeyEvent extends KeyEvent {
private MenuElement path[];
private MenuSelectionManager manager;
--- a/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -41,6 +41,7 @@
*
* @author Arnaud Weber
*/
+@SuppressWarnings("serial")
public class PopupMenuEvent extends EventObject {
/**
* Constructs a PopupMenuEvent object.
--- a/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java Tue Dec 20 15:26:23 2011 -0800
@@ -244,6 +244,7 @@
* @see javax.swing.JComponent#contains
* @see java.awt.Component#contains
*/
+ @SuppressWarnings("deprecation")
public boolean contains(JComponent c, int x, int y) {
return c.inside(x, y);
}
--- a/jdk/src/share/classes/javax/swing/text/BadLocationException.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/BadLocationException.java Tue Dec 20 15:26:23 2011 -0800
@@ -39,6 +39,7 @@
*
* @author Timothy Prinzing
*/
+@SuppressWarnings("serial")
public class BadLocationException extends Exception
{
/**
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Tue Dec 20 15:26:23 2011 -0800
@@ -61,6 +61,7 @@
*
* @author Scott Violet
*/
+@SuppressWarnings("serial")
public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeSelectionModel
{
/** Property name for selectionMode. */
@@ -1073,7 +1074,7 @@
* @deprecated As of JDK version 1.7
*/
@Deprecated
- protected void notifyPathChange(Vector changedPaths,
+ protected void notifyPathChange(Vector<?> changedPaths,
TreePath oldLeadSelection) {
int cPathCount = changedPaths.size();
boolean[] newness = new boolean[cPathCount];
--- a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java Tue Dec 20 15:26:23 2011 -0800
@@ -26,10 +26,13 @@
package sun.awt;
import java.awt.AWTEvent;
+
import java.util.Collections;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Map;
+import java.util.Set;
+
import sun.util.logging.PlatformLogger;
/**
@@ -81,7 +84,7 @@
* new event to appear in their event queue.
* Access is synchronized on the main lock object.
*/
- private final HashSet busyThreadSet = new HashSet(7);
+ private final Set<Thread> busyThreadSet = new HashSet<>(7);
/**
* Indicates whether the toolkit thread is waiting for a new native
@@ -93,7 +96,7 @@
* This is a map between components and their peers.
* we should work with in under activationLock&mainLock lock.
*/
- private final Map peerMap = new IdentityHashMap();
+ private final Map<Object, Object> peerMap = new IdentityHashMap<>();
/**
* References the alive non-daemon thread that is currently used
@@ -319,8 +322,10 @@
}
}
+ @SuppressWarnings("serial")
static AWTEvent getShutdownEvent() {
- return new AWTEvent(getInstance(), 0) {};
+ return new AWTEvent(getInstance(), 0) {
+ };
}
/**
--- a/jdk/src/share/classes/sun/awt/AppContext.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/AppContext.java Tue Dec 20 15:26:23 2011 -0800
@@ -171,7 +171,7 @@
* HashMap's potentially risky methods, such as clear(), elements(),
* putAll(), etc.
*/
- private final HashMap table = new HashMap();
+ private final Map<Object, Object> table = new HashMap<>();
private final ThreadGroup threadGroup;
@@ -198,8 +198,8 @@
// On the main Thread, we get the ThreadGroup, make a corresponding
// AppContext, and instantiate the Java EventQueue. This way, legacy
// code is unaffected by the move to multiple AppContext ability.
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
ThreadGroup currentThreadGroup =
Thread.currentThread().getThreadGroup();
ThreadGroup parentThreadGroup = currentThreadGroup.getParent();
@@ -210,7 +210,7 @@
}
mainAppContext = new AppContext(currentThreadGroup);
numAppContexts = 1;
- return mainAppContext;
+ return null;
}
});
}
@@ -342,6 +342,16 @@
return appContext;
}
+ /**
+ * Returns the main ("system") AppContext.
+ *
+ * @return the main AppContext
+ * @since 1.8
+ */
+ final static AppContext getMainAppContext() {
+ return mainAppContext;
+ }
+
private long DISPOSAL_TIMEOUT = 5000; // Default to 5-second timeout
// for disposal of all Frames
// (we wait for this time twice,
@@ -399,8 +409,8 @@
log.finer("exception occured while disposing app context", t);
}
}
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
if (!GraphicsEnvironment.isHeadless() && SystemTray.isSupported())
{
SystemTray systemTray = SystemTray.getSystemTray();
@@ -523,7 +533,7 @@
}
}
- static final class CreateThreadAction implements PrivilegedAction {
+ static final class CreateThreadAction implements PrivilegedAction<Thread> {
private final AppContext appContext;
private final Runnable runnable;
@@ -532,7 +542,7 @@
runnable = r;
}
- public Object run() {
+ public Thread run() {
Thread t = new Thread(appContext.getThreadGroup(), runnable);
t.setContextClassLoader(appContext.getContextClassLoader());
t.setPriority(Thread.NORM_PRIORITY + 1);
@@ -552,8 +562,8 @@
if (appContext != AppContext.getAppContext()) {
// Create a thread that belongs to the thread group associated
// with the AppContext and invokes EventQueue.postEvent.
- PrivilegedAction action = new CreateThreadAction(appContext, r);
- Thread thread = (Thread)AccessController.doPrivileged(action);
+ PrivilegedAction<Thread> action = new CreateThreadAction(appContext, r);
+ Thread thread = AccessController.doPrivileged(action);
thread.start();
} else {
r.run();
--- a/jdk/src/share/classes/sun/awt/CausedFocusEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/CausedFocusEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -35,6 +35,7 @@
* CausedFocusEvent class or implicitly, by calling appropriate requestFocusXXX method with "cause"
* parameter. The default cause is UNKNOWN.
*/
+@SuppressWarnings("serial")
public class CausedFocusEvent extends FocusEvent {
public enum Cause {
UNKNOWN,
--- a/jdk/src/share/classes/sun/awt/DebugSettings.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/DebugSettings.java Tue Dec 20 15:26:23 2011 -0800
@@ -87,9 +87,9 @@
};
/* global instance of the settings object */
- private static DebugSettings instance = null;
+ private static DebugSettings instance = null;
- private Properties props = new Properties();
+ private Properties props = new Properties();
static void init() {
if (instance != null) {
@@ -102,12 +102,13 @@
}
private DebugSettings() {
- new java.security.PrivilegedAction() {
- public Object run() {
- loadProperties();
- return null;
- }
- }.run();
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
+ loadProperties();
+ return null;
+ }
+ });
}
/*
@@ -117,15 +118,14 @@
private synchronized void loadProperties() {
// setup initial properties
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction()
- {
- public Object run() {
- loadDefaultProperties();
- loadFileProperties();
- loadSystemProperties();
- return null;
- }
- });
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
+ loadDefaultProperties();
+ loadFileProperties();
+ loadSystemProperties();
+ return null;
+ }
+ });
// echo the initial property settings to stdout
if (log.isLoggable(PlatformLogger.FINE)) {
@@ -134,12 +134,9 @@
}
public String toString() {
- Enumeration enum_ = props.propertyNames();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
PrintStream pout = new PrintStream(bout);
-
- while (enum_.hasMoreElements()) {
- String key = (String)enum_.nextElement();
+ for (String key : props.stringPropertyNames()) {
String value = props.getProperty(key, "");
pout.println(key + " = " + value);
}
@@ -198,9 +195,7 @@
private void loadSystemProperties() {
// override file properties with system properties
Properties sysProps = System.getProperties();
- Enumeration enum_ = sysProps.propertyNames();
- while ( enum_.hasMoreElements() ) {
- String key = (String)enum_.nextElement();
+ for (String key : sysProps.stringPropertyNames()) {
String value = sysProps.getProperty(key,"");
// copy any "awtdebug" properties over
if ( key.startsWith(PREFIX) ) {
@@ -244,17 +239,14 @@
return value;
}
- public synchronized Enumeration getPropertyNames() {
- Vector propNames = new Vector();
- Enumeration enum_ = props.propertyNames();
-
+ private synchronized List<String> getPropertyNames() {
+ List<String> propNames = new LinkedList<>();
// remove global prefix from property names
- while ( enum_.hasMoreElements() ) {
- String propName = (String)enum_.nextElement();
+ for (String propName : props.stringPropertyNames()) {
propName = propName.substring(PREFIX.length()+1);
- propNames.addElement(propName);
+ propNames.add(propName);
}
- return propNames.elements();
+ return propNames;
}
private void println(Object object) {
@@ -279,13 +271,11 @@
//
// Filter out file/line ctrace properties from debug settings
//
- Vector traces = new Vector();
- Enumeration enum_ = getPropertyNames();
+ List<String> traces = new LinkedList<>();
- while ( enum_.hasMoreElements() ) {
- String key = (String)enum_.nextElement();
- if ( key.startsWith(PROP_CTRACE) && key.length() > PROP_CTRACE_LEN ) {
- traces.addElement(key);
+ for (String key : getPropertyNames()) {
+ if (key.startsWith(PROP_CTRACE) && key.length() > PROP_CTRACE_LEN) {
+ traces.add(key);
}
}
@@ -295,15 +285,12 @@
//
// Setup the trace points
//
- Enumeration enumTraces = traces.elements();
-
- while ( enumTraces.hasMoreElements() ) {
- String key = (String)enumTraces.nextElement();
- String trace = key.substring(PROP_CTRACE_LEN+1);
+ for (String key : traces) {
+ String trace = key.substring(PROP_CTRACE_LEN+1);
String filespec;
String linespec;
- int delim= trace.indexOf('@');
- boolean enabled;
+ int delim= trace.indexOf('@');
+ boolean enabled;
// parse out the filename and linenumber from the property name
filespec = delim != -1 ? trace.substring(0, delim) : trace;
--- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java Tue Dec 20 15:26:23 2011 -0800
@@ -180,6 +180,7 @@
* reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
* add listeners in show() and remove them in hide().
*/
+ @SuppressWarnings("deprecation")
public void show() {
if (appletKFM != null) {
addTraversingOutListeners(appletKFM);
@@ -193,6 +194,7 @@
* reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
* add listeners in show() and remove them in hide().
*/
+ @SuppressWarnings("deprecation")
public void hide() {
if (appletKFM != null) {
removeTraversingOutListeners(appletKFM);
@@ -212,8 +214,8 @@
// belongs to. That's why we can't use public methods to find current focus cycle
// root. Instead, we access KFM's private field directly.
if (currentCycleRoot == null) {
- currentCycleRoot = (Field)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ currentCycleRoot = AccessController.doPrivileged(new PrivilegedAction<Field>() {
+ public Field run() {
try {
Field unaccessibleRoot = KeyboardFocusManager.class.
getDeclaredField("currentFocusCycleRoot");
@@ -257,7 +259,7 @@
}
AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
- Set toTest;
+ Set<AWTKeyStroke> toTest;
Component currentFocused = e.getComponent();
toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
@@ -357,6 +359,7 @@
return true;
}
+ @SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
if (getPeer() == null) {
@@ -367,6 +370,7 @@
}
// These three functions consitute RFE 4100710. Do not remove.
+ @SuppressWarnings("deprecation")
public void setCursorAllowed(boolean isCursorAllowed) {
this.isCursorAllowed = isCursorAllowed;
getPeer().updateCursorImmediately();
@@ -380,27 +384,28 @@
: Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
- protected void setPeer(final ComponentPeer p){
+ @SuppressWarnings("deprecation")
+ protected void setPeer(final ComponentPeer p){
if (fieldPeer == null) {
- fieldPeer = (Field)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- try {
- Field lnkPeer = Component.class.getDeclaredField("peer");
- if (lnkPeer != null) {
- lnkPeer.setAccessible(true);
- }
- return lnkPeer;
- } catch (NoSuchFieldException e) {
- assert false;
- } catch (SecurityException e) {
- assert false;
+ fieldPeer = AccessController.doPrivileged(new PrivilegedAction<Field>() {
+ public Field run() {
+ try {
+ Field lnkPeer = Component.class.getDeclaredField("peer");
+ if (lnkPeer != null) {
+ lnkPeer.setAccessible(true);
}
- return null;
- }//run
- });
+ return lnkPeer;
+ } catch (NoSuchFieldException e) {
+ assert false;
+ } catch (SecurityException e) {
+ assert false;
+ }
+ return null;
+ }//run
+ });
}
try{
- if (fieldPeer !=null){
+ if (fieldPeer != null){
fieldPeer.set(EmbeddedFrame.this, p);
}
} catch (IllegalAccessException e) {
@@ -507,6 +512,7 @@
* @see #getBoundsPrivate
* @since 1.5
*/
+ @SuppressWarnings("deprecation")
protected void setBoundsPrivate(int x, int y, int width, int height) {
final FramePeer peer = (FramePeer)getPeer();
if (peer != null) {
@@ -538,6 +544,7 @@
* @see #setBoundsPrivate
* @since 1.6
*/
+ @SuppressWarnings("deprecation")
protected Rectangle getBoundsPrivate() {
final FramePeer peer = (FramePeer)getPeer();
if (peer != null) {
--- a/jdk/src/share/classes/sun/awt/EventListenerAggregate.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/EventListenerAggregate.java Tue Dec 20 15:26:23 2011 -0800
@@ -53,20 +53,15 @@
* @throws ClassCastException if <code>listenerClass</code> is not
* assignable to <code>java.util.EventListener</code>
*/
- public EventListenerAggregate(Class listenerClass) {
+ public EventListenerAggregate(Class<? extends EventListener> listenerClass) {
if (listenerClass == null) {
throw new NullPointerException("listener class is null");
}
- if (!EventListener.class.isAssignableFrom(listenerClass)) {
- throw new ClassCastException("listener class " + listenerClass +
- " is not assignable to EventListener");
- }
-
listenerList = (EventListener[])Array.newInstance(listenerClass, 0);
}
- private Class getListenerClass() {
+ private Class<?> getListenerClass() {
return listenerList.getClass().getComponentType();
}
@@ -80,7 +75,7 @@
* in the constructor
*/
public synchronized void add(EventListener listener) {
- Class listenerClass = getListenerClass();
+ Class<?> listenerClass = getListenerClass();
if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
throw new ClassCastException("listener " + listener + " is not " +
@@ -107,7 +102,7 @@
* in the constructor
*/
public synchronized boolean remove(EventListener listener) {
- Class listenerClass = getListenerClass();
+ Class<?> listenerClass = getListenerClass();
if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
throw new ClassCastException("listener " + listener + " is not " +
@@ -155,7 +150,7 @@
* array if there are no listeners)
*/
public synchronized EventListener[] getListenersCopy() {
- return (listenerList.length == 0) ? listenerList : (EventListener[])listenerList.clone();
+ return (listenerList.length == 0) ? listenerList : listenerList.clone();
}
/**
--- a/jdk/src/share/classes/sun/awt/FocusingTextField.java Wed Jul 05 17:57:50 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * FocusingTextField: a subclass of java.awt.TextField that handles moving the
- * input focus from field to field, as when the user hits 'return.'
- *
- * @author Herb Jellinek
- */
-
-public class FocusingTextField extends TextField {
-
- /** The field to move to on 'return' - can be null. */
- TextField next;
-
- /** If true, select the contents of the field when it gets the focus. */
- boolean willSelect;
-
- /**
- * Create a FocusingTextField.
- * @param cols number of columns of text.
- */
- public FocusingTextField(int cols) {
- super("", cols);
- }
-
- /**
- * Create a FocusingTextField.
- * @param cols number of columns of text.
- * @param willSelect if true, will select all contents of field when
- * focus is gained.
- */
- public FocusingTextField(int cols, boolean willSelect) {
- this(cols);
- this.willSelect = willSelect;
- }
-
- public void setWillSelect(boolean will) {
- willSelect = will;
- }
-
- public boolean getWillSelect() {
- return willSelect;
- }
-
- /**
- * Call this to set the next field to receive the input focus.
- * @param next the next TextField in order - can be null.
- */
- public void setNextField(TextField next) {
- this.next = next;
- }
-
- /**
- * We got the focus. If willSelect is true, select everything.
- */
- public boolean gotFocus(Event e, Object arg) {
- if (willSelect) {
- select(0, getText().length());
- }
- return true;
- }
-
- /**
- * We lost the focus. If willSelect is true, deselect everything.
- */
- public boolean lostFocus(Event e, Object arg) {
- if (willSelect) {
- select(0, 0);
- }
- return true;
- }
-
- /**
- * Pass the focus to the next guy, if any.
- */
- public void nextFocus() {
- if (next != null) {
- next.requestFocus();
- }
- super.nextFocus();
- }
-}
--- a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java Tue Dec 20 15:26:23 2011 -0800
@@ -396,6 +396,7 @@
/*
* Fonts
*/
+ @SuppressWarnings("deprecation")
public FontPeer getFontPeer(String name, int style) {
if (componentFactory != null) {
return componentFactory.getFontPeer(name, style);
@@ -403,10 +404,12 @@
return null;
}
+ @SuppressWarnings("deprecation")
public FontMetrics getFontMetrics(Font font) {
return tk.getFontMetrics(font);
}
+ @SuppressWarnings("deprecation")
public String[] getFontList() {
return tk.getFontList();
}
--- a/jdk/src/share/classes/sun/awt/HorizBagLayout.java Wed Jul 05 17:57:50 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * A horizontal 'bag' of Components. Allocates space for each Component
- * from left to right.
- *
- * @author Herb Jellinek
- */
-public class HorizBagLayout implements LayoutManager {
-
- int hgap;
-
- /**
- * Constructs a new HorizBagLayout.
- */
- public HorizBagLayout() {
- this(0);
- }
-
- /**
- * Constructs a HorizBagLayout with the specified gaps.
- * @param hgap the horizontal gap
- */
- public HorizBagLayout(int hgap) {
- this.hgap = hgap;
- }
-
- /**
- * Adds the specified named component to the layout.
- * @param name the String name
- * @param comp the component to be added
- */
- public void addLayoutComponent(String name, Component comp) {
- }
-
- /**
- * Removes the specified component from the layout.
- * @param comp the component to be removed
- */
- public void removeLayoutComponent(Component comp) {
- }
-
- /**
- * Returns the minimum dimensions needed to lay out the components
- * contained in the specified target container.
- * @param target the Container on which to do the layout
- * @see Container
- * @see #preferredLayoutSize
- */
- public Dimension minimumLayoutSize(Container target) {
- Dimension dim = new Dimension();
-
- for (int i = 0; i < target.countComponents(); i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- Dimension d = comp.minimumSize();
- dim.width += d.width + hgap;
- dim.height = Math.max(d.height, dim.height);
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Returns the preferred dimensions for this layout given the components
- * in the specified target container.
- * @param target the component which needs to be laid out
- * @see Container
- * @see #minimumLayoutSize
- */
- public Dimension preferredLayoutSize(Container target) {
- Dimension dim = new Dimension();
-
- for (int i = 0; i < target.countComponents(); i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- Dimension d = comp.preferredSize();
- dim.width += d.width + hgap;
- dim.height = Math.max(dim.height, d.height);
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Lays out the specified container. This method will actually reshape the
- * components in the specified target container in order to satisfy the
- * constraints of the HorizBagLayout object.
- * @param target the component being laid out
- * @see Container
- */
- public void layoutContainer(Container target) {
- Insets insets = target.insets();
- int top = insets.top;
- int bottom = target.size().height - insets.bottom;
- int left = insets.left;
- int right = target.size().width - insets.right;
-
- for (int i = 0; i < target.countComponents(); i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- int compWidth = comp.size().width;
- comp.resize(compWidth, bottom - top);
- Dimension d = comp.preferredSize();
- comp.reshape(left, top, d.width, bottom - top);
- left += d.width + hgap;
- }
- }
- }
-
- /**
- * Returns the String representation of this HorizBagLayout's values.
- */
- public String toString() {
- return getClass().getName() + "[hgap=" + hgap + "]";
- }
-}
--- a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java Tue Dec 20 15:26:23 2011 -0800
@@ -80,6 +80,7 @@
* 1) accepts focus on click (in general)
* 2) may be a focus owner (in particular)
*/
+ @SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
boolean acceptFocusOnClick = false;
@@ -110,6 +111,7 @@
/*
* Posts proper lost/gain focus events to the event queue.
*/
+ @SuppressWarnings("deprecation")
public static boolean deliverFocus(Component lightweightChild,
Component target,
boolean temporary,
@@ -119,7 +121,7 @@
Component currentFocusOwner) // provided by the descendant peers
{
if (lightweightChild == null) {
- lightweightChild = (Component)target;
+ lightweightChild = target;
}
Component currentOwner = currentFocusOwner;
--- a/jdk/src/share/classes/sun/awt/ModalityEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/ModalityEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -30,6 +30,7 @@
/**
* Event object describing changes in AWT modality
*/
+@SuppressWarnings("serial")
public class ModalityEvent extends AWTEvent implements ActiveEvent {
public static final int MODALITY_PUSHED = 1300;
--- a/jdk/src/share/classes/sun/awt/OrientableFlowLayout.java Wed Jul 05 17:57:50 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * Extends the FlowLayout class to support both vertical and horizontal
- * layout of components. Orientation can be changed dynamically after
- * creation by calling either of the methods @method orientHorizontally or
- * @method orientVertically. Separate values for alignment, vertical gap,
- * and horizontal gap can be specified for horizontal and vertical
- * orientation.
- *
- * @author Terry Cline
- */
-public class OrientableFlowLayout extends FlowLayout {
- /**
- * The horizontal orientation constant.
- */
- public static final int HORIZONTAL = 0;
-
- /**
- * The vertical orientation constant.
- */
- public static final int VERTICAL = 1;
-
- /**
- * The top vertical alignment constant.
- */
- public static final int TOP = 0;
-
- /**
- * The bottom vertical alignment constant.
- */
- public static final int BOTTOM = 2; // CENTER == 1
-
- int orientation;
- int vAlign;
- int vHGap;
- int vVGap;
-
- /**
- * Constructs a new flow layout with a horizontal orientation and
- * centered alignment.
- */
- public OrientableFlowLayout() {
- this(HORIZONTAL, CENTER, CENTER, 5, 5, 5, 5);
- }
-
- /**
- * Constructs a new flow layout with the specified orientation and
- * a centered alignment.
- *
- * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
- */
- public OrientableFlowLayout(int orientation) {
- this(orientation, CENTER, CENTER, 5, 5, 5, 5);
- }
-
- /**
- * Constructs a new flow layout with the specified orientation and
- * alignment.
- *
- * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
- * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT.
- * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM.
- */
- public OrientableFlowLayout(int orientation, int hAlign, int vAlign) {
- this(orientation, hAlign, vAlign, 5, 5, 5, 5);
- }
-
- /**
- * Constructs a new flow layout with the specified orientation,
- * alignment, and gap values.
- *
- * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
- * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT.
- * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM.
- * @param hHGap the horizontal gap between components in HORIZONTAL.
- * @param hVGap the vertical gap between components in HORIZONTAL.
- * @param vHGap the horizontal gap between components in VERTICAL.
- * @param vVGap the vertical gap between components in VERTICAL.
- */
- public OrientableFlowLayout(int orientation, int hAlign, int vAlign, int hHGap, int hVGap, int vHGap, int vVGap) {
- super(hAlign, hHGap, hVGap);
- this.orientation = orientation;
- this.vAlign = vAlign;
- this.vHGap = vHGap;
- this.vVGap = vVGap;
- }
-
- /**
- * Set the layout's current orientation to horizontal.
- */
- public synchronized void orientHorizontally() {
- orientation = HORIZONTAL;
- }
-
- /**
- * Set the layout's current orientation to vertical.
- */
- public synchronized void orientVertically() {
- orientation = VERTICAL;
- }
-
- /**
- * Returns the preferred dimensions for this layout given the
- * components in the specified target container.
- *
- * @param target the component which needs to be laid out.
- * @see Container
- * @see FlowLayout
- * @see #minimumLayoutSize
- */
- public Dimension preferredLayoutSize(Container target) {
- if (orientation == HORIZONTAL) {
- return super.preferredLayoutSize(target);
- }
- else {
- Dimension dim = new Dimension(0, 0);
-
- int n = target.countComponents();
- for (int i = 0; i < n; i++) {
- Component c = target.getComponent(i);
- if (c.isVisible()) {
- Dimension cDim = c.preferredSize();
- dim.width = Math.max(dim.width, cDim.width);
- if (i > 0) {
- dim.height += vVGap;
- }
- dim.height += cDim.height;
- }
- }
-
- Insets insets = target.insets();;
- dim.width += insets.left + insets.right + vHGap*2;
- dim.height += insets.top + insets.bottom + vVGap*2;
-
- return dim;
- }
- }
-
- /**
- * Returns the minimum dimensions needed to layout the components
- * contained in the specified target container.
- *
- * @param target the component which needs to be laid out.
- * @see #preferredLayoutSize.
- */
- public Dimension minimumLayoutSize(Container target) {
- if (orientation == HORIZONTAL) {
- return super.minimumLayoutSize(target);
- }
- else {
- Dimension dim = new Dimension(0, 0);
-
- int n = target.countComponents();
- for (int i = 0; i < n; i++) {
- Component c = target.getComponent(i);
- if (c.isVisible()) {
- Dimension cDim = c.minimumSize();
- dim.width = Math.max(dim.width, cDim.width);
- if (i > 0) {
- dim.height += vVGap;
- }
- dim.height += cDim.height;
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right + vHGap*2;
- dim.height += insets.top + insets.bottom + vVGap*2;
-
- return dim;
- }
- }
-
- /**
- * Lays out the container. This method will reshape the
- * components in the target to satisfy the constraints of the
- * layout.
- *
- * @param target the specified component being laid out.
- * @see Container.
- */
- public void layoutContainer(Container target) {
- if (orientation == HORIZONTAL) {
- super.layoutContainer(target);
- }
- else {
- Insets insets = target.insets();
- Dimension targetDim = target.size();
- int maxHeight = targetDim.height - (insets.top + insets.bottom + vVGap*2);
- int x = insets.left + vHGap;
- int y = 0;
- int colWidth = 0;
- int start = 0;
-
- int n = target.countComponents();
- for (int i = 0; i < n; i++) {
- Component c = target.getComponent(i);
- if (c.isVisible()) {
- Dimension cDim = c.preferredSize();
- c.resize(cDim.width, cDim.height);
-
- if ((y == 0) || ((y + cDim.height) <= maxHeight)) {
- if (y > 0) {
- y += vVGap;
- }
- y += cDim.height;
- colWidth = Math.max(colWidth, cDim.width);
- }
- else {
- moveComponents(target,
- x,
- insets.top + vVGap,
- colWidth,
- maxHeight - y,
- start,
- i);
- x += vHGap + colWidth;
- y = cDim.width;
- colWidth = cDim.width;
- start = i;
- }
- }
- }
-
- moveComponents(target,
- x,
- insets.top + vVGap,
- colWidth,
- maxHeight - y,
- start,
- n);
- }
- }
-
- /**
- * Aligns the components vertically if there is any slack.
- *
- * @param target the container whose components need to be moved.
- * @param x the x coordinate.
- * @param y the y coordinate.
- * @param width the width available.
- * @param height the height available.
- * @param colStart the beginning of the column.
- * @param colEnd the end of the column.
- */
- private void moveComponents(Container target, int x, int y, int width, int height, int colStart, int colEnd) {
- switch (vAlign) {
- case TOP:
- break;
- case CENTER:
- y += height/2;
- break;
- case BOTTOM:
- y += height;
- }
-
- for (int i = colStart; i < colEnd; i++) {
- Component c = target.getComponent(i);
- Dimension cDim = c.size();
- if (c.isVisible()) {
- c.move(x + (width - cDim.width)/2, y);
- y += vVGap + cDim.height;
- }
- }
- }
-
- /**
- * Returns the String representation of this layout's values.
- */
- public String toString() {
- String str = "";
- switch (orientation) {
- case HORIZONTAL:
- str = "orientation=horizontal, ";
- break;
- case VERTICAL:
- str = "orientation=vertical, ";
- break;
- }
-
- return getClass().getName() + "[" + str + super.toString() + "]";
- }
-}
--- a/jdk/src/share/classes/sun/awt/PaintEventDispatcher.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/PaintEventDispatcher.java Tue Dec 20 15:26:23 2011 -0800
@@ -77,7 +77,7 @@
public PaintEvent createPaintEvent(Component target, int x, int y, int w,
int h) {
- return new PaintEvent((Component)target, PaintEvent.PAINT,
+ return new PaintEvent(target, PaintEvent.PAINT,
new Rectangle(x, y, w, h));
}
--- a/jdk/src/share/classes/sun/awt/PeerEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/PeerEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -27,7 +27,9 @@
import java.awt.event.InvocationEvent;
+@SuppressWarnings("serial")
public class PeerEvent extends InvocationEvent {
+
public static final long PRIORITY_EVENT = 0x01;
public static final long ULTIMATE_PRIORITY_EVENT = 0x02;
public static final long LOW_PRIORITY_EVENT = 0x04;
--- a/jdk/src/share/classes/sun/awt/SunDisplayChanger.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/SunDisplayChanger.java Tue Dec 20 15:26:23 2011 -0800
@@ -28,9 +28,10 @@
import java.awt.IllegalComponentStateException;
import java.util.Collections;
import java.util.Iterator;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.HashMap;
import java.util.WeakHashMap;
import sun.util.logging.PlatformLogger;
@@ -54,12 +55,14 @@
* screen to another on a system equipped with multiple displays.
*/
public class SunDisplayChanger {
+
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.multiscreen.SunDisplayChanger");
- // Create a new synchronizedMap with initial capacity of one listener.
+ // Create a new synchronized map with initial capacity of one listener.
// It is asserted that the most common case is to have one GraphicsDevice
// and one top-level Window.
- private Map listeners = Collections.synchronizedMap(new WeakHashMap(1));
+ private Map<DisplayChangedListener, Void> listeners =
+ Collections.synchronizedMap(new WeakHashMap<DisplayChangedListener, Void>(1));
public SunDisplayChanger() {}
@@ -113,18 +116,15 @@
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it. -bchristi 7/10/2001
- HashMap listClone;
- Set cloneSet;
+ Set<DisplayChangedListener> cloneSet;
synchronized(listeners) {
- listClone = new HashMap(listeners);
+ cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
}
- cloneSet = listClone.keySet();
- Iterator itr = cloneSet.iterator();
+ Iterator<DisplayChangedListener> itr = cloneSet.iterator();
while (itr.hasNext()) {
- DisplayChangedListener current =
- (DisplayChangedListener) itr.next();
+ DisplayChangedListener current = itr.next();
try {
if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("displayChanged for listener: " + current);
@@ -160,17 +160,14 @@
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it. -bchristi 7/10/2001
- HashMap listClone;
- Set cloneSet;
+ Set<DisplayChangedListener> cloneSet;
synchronized (listeners) {
- listClone = new HashMap(listeners);
+ cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
}
- cloneSet = listClone.keySet();
- Iterator itr = cloneSet.iterator();
+ Iterator<DisplayChangedListener> itr = cloneSet.iterator();
while (itr.hasNext()) {
- DisplayChangedListener current =
- (DisplayChangedListener) itr.next();
+ DisplayChangedListener current = itr.next();
try {
if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("paletteChanged for listener: " + current);
--- a/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java Tue Dec 20 15:26:23 2011 -0800
@@ -47,6 +47,7 @@
g.clipRect(0, 0, bounds.width, bounds.height);
}
+ @SuppressWarnings("deprecation")
public final void runOneComponent(Component comp, Rectangle bounds,
Graphics g, Shape clip,
int weightFlags) {
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java Tue Dec 20 15:26:23 2011 -0800
@@ -101,30 +101,28 @@
*/
public final static int MAX_BUTTONS_SUPPORTED = 20;
- public SunToolkit() {
- Runnable initEQ = new Runnable() {
- public void run () {
- EventQueue eventQueue;
+ private static void initEQ(AppContext appContext) {
+ EventQueue eventQueue;
- String eqName = System.getProperty("AWT.EventQueueClass",
- "java.awt.EventQueue");
+ String eqName = System.getProperty("AWT.EventQueueClass",
+ "java.awt.EventQueue");
- try {
- eventQueue = (EventQueue)Class.forName(eqName).newInstance();
- } catch (Exception e) {
- e.printStackTrace();
- System.err.println("Failed loading " + eqName + ": " + e);
- eventQueue = new EventQueue();
- }
- AppContext appContext = AppContext.getAppContext();
- appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
+ try {
+ eventQueue = (EventQueue)Class.forName(eqName).newInstance();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.err.println("Failed loading " + eqName + ": " + e);
+ eventQueue = new EventQueue();
+ }
+ appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
- PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
- appContext.put(POST_EVENT_QUEUE_KEY, postEventQueue);
- }
- };
+ PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
+ appContext.put(POST_EVENT_QUEUE_KEY, postEventQueue);
+ }
- initEQ.run();
+ public SunToolkit() {
+ // 7122796: Always create an EQ for the main AppContext
+ initEQ(AppContext.getMainAppContext());
}
public boolean useBufferPerWindow() {
@@ -197,6 +195,7 @@
public abstract boolean isTraySupported();
+ @SuppressWarnings("deprecation")
public abstract FontPeer getFontPeer(String name, int style);
public abstract RobotPeer createRobot(Robot target, GraphicsDevice screen)
@@ -288,24 +287,12 @@
// return correct values
AppContext appContext = new AppContext(threadGroup);
- EventQueue eventQueue;
- String eqName = System.getProperty("AWT.EventQueueClass",
- "java.awt.EventQueue");
- try {
- eventQueue = (EventQueue)Class.forName(eqName).newInstance();
- } catch (Exception e) {
- System.err.println("Failed loading " + eqName + ": " + e);
- eventQueue = new EventQueue();
- }
- appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
-
- PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
- appContext.put(POST_EVENT_QUEUE_KEY, postEventQueue);
+ initEQ(appContext);
return appContext;
}
- public static Field getField(final Class klass, final String fieldName) {
+ public static Field getField(final Class<?> klass, final String fieldName) {
return AccessController.doPrivileged(new PrivilegedAction<Field>() {
public Field run() {
try {
@@ -325,8 +312,8 @@
static void wakeupEventQueue(EventQueue q, boolean isShutdown){
if (wakeupMethod == null){
- wakeupMethod = (Method)AccessController.doPrivileged(new PrivilegedAction(){
- public Object run(){
+ wakeupMethod = AccessController.doPrivileged(new PrivilegedAction<Method>() {
+ public Method run() {
try {
Method method = EventQueue.class.getDeclaredMethod("wakeup",new Class [] {Boolean.TYPE} );
if (method != null) {
@@ -386,8 +373,8 @@
// Maps from non-Component/MenuComponent to AppContext.
// WeakHashMap<Component,AppContext>
- private static final Map appContextMap =
- Collections.synchronizedMap(new WeakHashMap());
+ private static final Map<Object, AppContext> appContextMap =
+ Collections.synchronizedMap(new WeakHashMap<Object, AppContext>());
/**
* Sets the appContext field of target. If target is not a Component or
@@ -437,7 +424,7 @@
if (context == null) {
// target is not a Component/MenuComponent, try the
// appContextMap.
- context = (AppContext)appContextMap.get(target);
+ context = appContextMap.get(target);
}
return context;
}
@@ -519,9 +506,9 @@
private static FocusTraversalPolicy createLayoutPolicy() {
FocusTraversalPolicy policy = null;
try {
- Class layoutPolicyClass =
+ Class<?> layoutPolicyClass =
Class.forName("javax.swing.LayoutFocusTraversalPolicy");
- policy = (FocusTraversalPolicy) layoutPolicyClass.newInstance();
+ policy = (FocusTraversalPolicy)layoutPolicyClass.newInstance();
}
catch (ClassNotFoundException e) {
assert false;
@@ -642,11 +629,13 @@
* Fixed 5064013: the InvocationEvent time should be equals
* the time of the ActionEvent
*/
+ @SuppressWarnings("serial")
public static void executeOnEventHandlerThread(Object target,
Runnable runnable,
final long when) {
- executeOnEventHandlerThread(new PeerEvent(target, runnable, PeerEvent.PRIORITY_EVENT){
- public long getWhen(){
+ executeOnEventHandlerThread(
+ new PeerEvent(target, runnable, PeerEvent.PRIORITY_EVENT) {
+ public long getWhen() {
return when;
}
});
@@ -727,10 +716,12 @@
protected abstract int getScreenWidth();
protected abstract int getScreenHeight();
+ @SuppressWarnings("deprecation")
public FontMetrics getFontMetrics(Font font) {
return FontDesignMetrics.getMetrics(font);
}
+ @SuppressWarnings("deprecation")
public String[] getFontList() {
String[] hardwiredFontList = {
Font.DIALOG, Font.SANS_SERIF, Font.SERIF, Font.MONOSPACED,
@@ -1156,10 +1147,10 @@
public static Locale getStartupLocale() {
if (startupLocale == null) {
String language, region, country, variant;
- language = (String) AccessController.doPrivileged(
+ language = AccessController.doPrivileged(
new GetPropertyAction("user.language", "en"));
// for compatibility, check for old user.region property
- region = (String) AccessController.doPrivileged(
+ region = AccessController.doPrivileged(
new GetPropertyAction("user.region"));
if (region != null) {
// region can be of form country, country_variant, or _variant
@@ -1172,9 +1163,9 @@
variant = "";
}
} else {
- country = (String) AccessController.doPrivileged(
+ country = AccessController.doPrivileged(
new GetPropertyAction("user.country", ""));
- variant = (String) AccessController.doPrivileged(
+ variant = AccessController.doPrivileged(
new GetPropertyAction("user.variant", ""));
}
startupLocale = new Locale(language, country, variant);
@@ -1254,7 +1245,7 @@
* @return <code>true</code>, if XEmbed is needed, <code>false</code> otherwise
*/
public static boolean needsXEmbed() {
- String noxembed = (String) AccessController.
+ String noxembed = AccessController.
doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false"));
if ("true".equals(noxembed)) {
return false;
@@ -1466,7 +1457,7 @@
|| comp instanceof Window);
}
- public static Method getMethod(final Class clz, final String methodName, final Class[] params) {
+ public static Method getMethod(final Class<?> clz, final String methodName, final Class[] params) {
Method res = null;
try {
res = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
@@ -1482,6 +1473,7 @@
return res;
}
+ @SuppressWarnings("serial")
public static class OperationTimedOut extends RuntimeException {
public OperationTimedOut(String msg) {
super(msg);
@@ -1489,9 +1481,12 @@
public OperationTimedOut() {
}
}
+
+ @SuppressWarnings("serial")
public static class InfiniteLoop extends RuntimeException {
}
+ @SuppressWarnings("serial")
public static class IllegalThreadException extends RuntimeException {
public IllegalThreadException(String msg) {
super(msg);
@@ -1648,6 +1643,7 @@
* Should return <code>true</code> if more processing is
* necessary, <code>false</code> otherwise.
*/
+ @SuppressWarnings("serial")
protected final boolean waitForIdle(final long timeout) {
flushPendingEvents();
boolean queueWasEmpty = isEQEmpty();
@@ -1831,7 +1827,7 @@
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
systemAAFonts =
- (String)AccessController.doPrivileged(
+ AccessController.doPrivileged(
new GetPropertyAction("awt.useSystemAAFontSettings"));
}
if (systemAAFonts != null) {
@@ -1898,7 +1894,7 @@
if (consumeNextKeyTypedMethod == null) {
consumeNextKeyTypedMethod = getMethod(DefaultKeyboardFocusManager.class,
"consumeNextKeyTyped",
- new Class[] {KeyEvent.class});
+ new Class<?>[] {KeyEvent.class});
}
try {
consumeNextKeyTypedMethod.invoke(KeyboardFocusManager.getCurrentKeyboardFocusManager(),
@@ -1930,8 +1926,8 @@
* Returns the value of the system property indicated by the specified key.
*/
public static String getSystemProperty(final String key) {
- return (String)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
return System.getProperty(key);
}
});
@@ -1941,8 +1937,7 @@
* Returns the boolean value of the system property indicated by the specified key.
*/
protected static Boolean getBooleanSystemProperty(String key) {
- return Boolean.valueOf(AccessController.
- doPrivileged(new GetBooleanAction(key)));
+ return AccessController.doPrivileged(new GetBooleanAction(key));
}
private static Boolean sunAwtDisableMixing = null;
@@ -2015,7 +2010,7 @@
*/
public static boolean isContainingTopLevelTranslucent(Component c) {
Window w = getContainingWindow(c);
- return w != null && ((Window)w).getOpacity() < 1.0f;
+ return w != null && w.getOpacity() < 1.0f;
}
/**
@@ -2057,14 +2052,14 @@
return isInstanceOf(obj.getClass(), type);
}
- private static boolean isInstanceOf(Class cls, String type) {
+ private static boolean isInstanceOf(Class<?> cls, String type) {
if (cls == null) return false;
if (cls.getName().equals(type)) {
return true;
}
- for (Class c : cls.getInterfaces()) {
+ for (Class<?> c : cls.getInterfaces()) {
if (c.getName().equals(type)) {
return true;
}
--- a/jdk/src/share/classes/sun/awt/UngrabEvent.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/UngrabEvent.java Tue Dec 20 15:26:23 2011 -0800
@@ -39,7 +39,9 @@
* <p>Notice that this event is not generated on mouse click inside of the window area.
* <p>To listen for this event, install AWTEventListener with {@value sun.awt.SunToolkit#GRAB_EVENT_MASK}
*/
+@SuppressWarnings("serial")
public class UngrabEvent extends AWTEvent {
+
private final static int UNGRAB_EVENT_ID = 1998;
public UngrabEvent(Component source) {
--- a/jdk/src/share/classes/sun/awt/VariableGridLayout.java Wed Jul 05 17:57:50 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-import java.util.BitSet;
-
-
-/**
- * A layout manager for a container that lays out grids. Allows setting
- * the relative sizes of rows and columns.
- *
- * @author Herb Jellinek
- */
-
-
-public class VariableGridLayout extends GridLayout {
-
- BitSet rowsSet = new BitSet();
- double rowFractions[] = null;
-
- BitSet colsSet = new BitSet();
- double colFractions[] = null;
-
- int rows;
- int cols;
- int hgap;
- int vgap;
-
- /**
- * Creates a grid layout with the specified rows and specified columns.
- * @param rows the rows
- * @param cols the columns
- */
- public VariableGridLayout(int rows, int cols) {
- this(rows, cols, 0, 0);
-
- if (rows != 0) {
- rowsSet = new BitSet(rows);
- stdRowFractions(rows);
- }
-
- if (cols != 0) {
- colsSet = new BitSet(cols);
- stdColFractions(cols);
- }
- }
-
- /**
- * Creates a grid layout with the specified rows, columns,
- * horizontal gap, and vertical gap.
- * @param rows the rows
- * @param cols the columns
- * @param hgap the horizontal gap variable
- * @param vgap the vertical gap variable
- * @exception IllegalArgumentException If the rows and columns are invalid.
- */
- public VariableGridLayout(int rows, int cols, int hgap, int vgap) {
- super(rows, cols, hgap, vgap);
-
- this.rows = rows;
- this.cols = cols;
- this.hgap = hgap;
- this.vgap = vgap;
-
- if (rows != 0) {
- rowsSet = new BitSet(rows);
- stdRowFractions(rows);
- }
-
- if (cols != 0) {
- colsSet = new BitSet(cols);
- stdColFractions(cols);
- }
- }
-
- void stdRowFractions(int nrows) {
- rowFractions = new double[nrows];
- for (int i = 0; i < nrows; i++) {
- rowFractions[i] = 1.0 / nrows;
- }
- }
-
- void stdColFractions(int ncols) {
- colFractions = new double[ncols];
- for (int i = 0; i < ncols; i++) {
- colFractions[i] = 1.0 / ncols;
- }
- }
-
- public void setRowFraction(int rowNum, double fraction) {
- rowsSet.set(rowNum);
- rowFractions[rowNum] = fraction;
- }
-
- public void setColFraction(int colNum, double fraction) {
- colsSet.set(colNum);
- colFractions[colNum] = fraction;
- }
-
- public double getRowFraction(int rowNum) {
- return rowFractions[rowNum];
- }
-
- public double getColFraction(int colNum) {
- return colFractions[colNum];
- }
-
- void allocateExtraSpace(double vec[], BitSet userSet) {
- // collect the space that's been explicitly allocated...
- double total = 0.0;
- int unallocated = 0;
- int i;
- for (i = 0; i < vec.length; i++) {
- if (userSet.get(i)) {
- total += vec[i];
- } else {
- unallocated++;
- }
- }
-
- // ... then spread the extra space
- if (unallocated != 0) {
- double space = (1.0 - total) / unallocated;
- for (i = 0; i < vec.length; i++) {
- if (!userSet.get(i)) {
- vec[i] = space;
- userSet.set(i);
- }
- }
- }
- }
-
-
- void allocateExtraSpace() {
- allocateExtraSpace(rowFractions, rowsSet);
- allocateExtraSpace(colFractions, colsSet);
- }
-
- /**
- * Lays out the container in the specified panel.
- * @param parent the specified component being laid out
- * @see Container
- */
- public void layoutContainer(Container parent) {
- Insets insets = parent.insets();
- int ncomponents = parent.countComponents();
- int nrows = rows;
- int ncols = cols;
-
- if (nrows > 0) {
- ncols = (ncomponents + nrows - 1) / nrows;
- } else {
- nrows = (ncomponents + ncols - 1) / ncols;
- }
-
- if (rows == 0) {
- stdRowFractions(nrows);
- }
- if (cols == 0) {
- stdColFractions(ncols);
- }
-
- Dimension size = parent.size();
- int w = size.width - (insets.left + insets.right);
- int h = size.height - (insets.top + insets.bottom);
-
- w = (w - (ncols - 1) * hgap);
- h = (h - (nrows - 1) * vgap);
-
- allocateExtraSpace();
-
- for (int c = 0, x = insets.left ; c < ncols ; c++) {
- int colWidth = (int)(getColFraction(c) * w);
- for (int r = 0, y = insets.top ; r < nrows ; r++) {
- int i = r * ncols + c;
- int rowHeight = (int)(getRowFraction(r) * h);
-
- if (i < ncomponents) {
- parent.getComponent(i).reshape(x, y, colWidth, rowHeight);
- }
- y += rowHeight + vgap;
- }
- x += colWidth + hgap;
- }
- }
-
- static String fracsToString(double array[]) {
- String result = "["+array.length+"]";
-
- for (int i = 0; i < array.length; i++) {
- result += "<"+array[i]+">";
- }
- return result;
- }
-
- /**
- * Returns the String representation of this VariableGridLayout's values.
- */
- public String toString() {
- return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap +
- ",rows=" + rows + ",cols=" + cols +
- ",rowFracs=" +
- fracsToString(rowFractions) +
- ",colFracs=" +
- fracsToString(colFractions) + "]";
- }
-}
--- a/jdk/src/share/classes/sun/awt/VerticalBagLayout.java Wed Jul 05 17:57:50 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-
-/**
- * A vertical 'bag' of Components. Allocates space for each Component from
- * top to bottom.
- *
- * @author Herb Jellinek
- */
-public class VerticalBagLayout implements LayoutManager {
-
- int vgap;
-
- /**
- * Constructs a new VerticalBagLayout.
- */
- public VerticalBagLayout() {
- this(0);
- }
-
- /**
- * Constructs a VerticalBagLayout with the specified gaps.
- * @param vgap the vertical gap
- */
- public VerticalBagLayout(int vgap) {
- this.vgap = vgap;
- }
-
- /**
- * Adds the specified named component to the layout.
- * @param name the String name
- * @param comp the component to be added
- */
- public void addLayoutComponent(String name, Component comp) {
- }
-
- /**
- * Removes the specified component from the layout.
- * @param comp the component to be removed
- */
- public void removeLayoutComponent(Component comp) {
- }
-
- /**
- * Returns the minimum dimensions needed to lay out the components
- * contained in the specified target container.
- * @param target the Container on which to do the layout
- * @see Container
- * @see #preferredLayoutSize
- */
- public Dimension minimumLayoutSize(Container target) {
- Dimension dim = new Dimension();
- int nmembers = target.countComponents();
-
- for (int i = 0; i < nmembers; i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- Dimension d = comp.minimumSize();
- dim.width = Math.max(d.width, dim.width);
- dim.height += d.height + vgap;
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Returns the preferred dimensions for this layout given the components
- * in the specified target container.
- * @param target the component which needs to be laid out
- * @see Container
- * @see #minimumLayoutSize
- */
- public Dimension preferredLayoutSize(Container target) {
- Dimension dim = new Dimension();
- int nmembers = target.countComponents();
-
- for (int i = 0; i < nmembers; i++) {
- Component comp = target.getComponent(i);
- if (true || comp.isVisible()) {
- Dimension d = comp.preferredSize();
- dim.width = Math.max(d.width, dim.width);
- dim.height += d.height + vgap;
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Lays out the specified container. This method will actually reshape the
- * components in the specified target container in order to satisfy the
- * constraints of the VerticalBagLayout object.
- * @param target the component being laid out
- * @see Container
- */
- public void layoutContainer(Container target) {
- Insets insets = target.insets();
- int top = insets.top;
- int bottom = target.size().height - insets.bottom;
- int left = insets.left;
- int right = target.size().width - insets.right;
- int nmembers = target.countComponents();
-
- for (int i = 0; i < nmembers; i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- int compHeight = comp.size().height;
- comp.resize(right - left, compHeight);
- Dimension d = comp.preferredSize();
- comp.reshape(left, top, right - left, d.height);
- top += d.height + vgap;
- }
- }
- }
-
- /**
- * Returns the String representation of this VerticalBagLayout's values.
- */
- public String toString() {
- return getClass().getName() + "[vgap=" + vgap + "]";
- }
-}
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Tue Dec 20 15:26:23 2011 -0800
@@ -649,8 +649,9 @@
* The map keys are sorted according to the native formats preference
* order.
*/
- public SortedMap getFormatsForTransferable(Transferable contents,
- FlavorTable map) {
+ public SortedMap<Long,DataFlavor> getFormatsForTransferable(
+ Transferable contents, FlavorTable map)
+ {
DataFlavor[] flavors = contents.getTransferDataFlavors();
if (flavors == null) {
return new TreeMap();
@@ -686,9 +687,13 @@
* DataFlavors and data formats
* @throws NullPointerException if flavors or map is <code>null</code>
*/
- public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
- Map formatMap = new HashMap(flavors.length);
- Map textPlainMap = new HashMap(flavors.length);
+ public SortedMap <Long, DataFlavor> getFormatsForFlavors(
+ DataFlavor[] flavors, FlavorTable map)
+ {
+ Map <Long,DataFlavor> formatMap =
+ new HashMap <> (flavors.length);
+ Map <Long,DataFlavor> textPlainMap =
+ new HashMap <> (flavors.length);
// Maps formats to indices that will be used to sort the formats
// according to the preference order.
// Larger index value corresponds to the more preferable format.
--- a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -52,6 +52,7 @@
import sun.awt.SunToolkit;
import sun.awt.datatransfer.DataTransferer;
+import java.awt.datatransfer.DataFlavor;
/**
* <p>
@@ -126,9 +127,9 @@
dragImageOffset = p;
Transferable transferable = getDragSourceContext().getTransferable();
- SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
- (transferable, DataTransferer.adaptFlavorMap
- (getTrigger().getDragSource().getFlavorMap()));
+ SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
+ getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
+ (getTrigger().getDragSource().getFlavorMap()));
long[] formats = DataTransferer.getInstance().
keysToLongArray(formatMap);
startDrag(transferable, formats, formatMap);
--- a/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java Tue Dec 20 15:26:23 2011 -0800
@@ -26,6 +26,7 @@
package sun.awt.X11;
import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
import java.util.SortedMap;
import java.io.IOException;
import java.security.AccessController;
@@ -83,7 +84,8 @@
}
protected synchronized void setContentsNative(Transferable contents) {
- SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
+ SortedMap<Long,DataFlavor> formatMap =
+ DataTransferer.getInstance().getFormatsForTransferable
(contents, DataTransferer.adaptFlavorMap(flavorMap));
long[] formats = DataTransferer.keysToLongArray(formatMap);
--- a/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java Tue Dec 20 15:26:23 2011 -0800
@@ -40,6 +40,7 @@
import sun.java2d.InvalidPipeException;
import sun.java2d.Surface;
import sun.java2d.pipe.RenderQueue;
+import sun.java2d.pipe.BufferedContext;
import sun.java2d.pipe.hw.AccelGraphicsConfig;
import sun.java2d.pipe.hw.AccelSurface;
import sun.security.action.GetPropertyAction;
@@ -310,7 +311,7 @@
RenderQueue rq = as.getContext().getRenderQueue();
rq.lock();
try {
- as.getContext().validateContext(as);
+ BufferedContext.validateContext(as);
rq.flushAndInvokeNow(new Runnable() {
public void run() {
long psdops = as.getNativeOps();
--- a/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java Tue Dec 20 15:26:23 2011 -0800
@@ -37,7 +37,7 @@
*/
public class WBufferStrategy {
- private static native void initIDs(Class componentClass);
+ private static native void initIDs(Class <?> componentClass);
static {
initIDs(Component.class);
--- a/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -84,6 +84,7 @@
native void create(WComponentPeer parent);
+ @SuppressWarnings("deprecation")
void initialize() {
Choice opt = (Choice)target;
int itemCount = opt.getItemCount();
@@ -116,6 +117,7 @@
super.initialize();
}
+ @SuppressWarnings("deprecation")
protected void disposeImpl() {
// TODO: we should somehow reset the listener when the choice
// is moved to another toplevel without destroying its peer.
--- a/jdk/src/windows/classes/sun/awt/windows/WClipboard.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WClipboard.java Tue Dec 20 15:26:23 2011 -0800
@@ -71,17 +71,14 @@
// Get all of the target formats into which the Transferable can be
// translated. Then, for each format, translate the data and post
// it to the Clipboard.
- Map formatMap = WDataTransferer.getInstance().
+ Map <Long, DataFlavor> formatMap = WDataTransferer.getInstance().
getFormatsForTransferable(contents, flavorMap);
openClipboard(this);
try {
- for (Iterator iter = formatMap.keySet().iterator();
- iter.hasNext(); ) {
- Long lFormat = (Long)iter.next();
- long format = lFormat.longValue();
- DataFlavor flavor = (DataFlavor)formatMap.get(lFormat);
+ for (Long format : formatMap.keySet()) {
+ DataFlavor flavor = formatMap.get(format);
try {
byte[] bytes = WDataTransferer.getInstance().
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -222,7 +222,7 @@
updateWindow();
// make sure paint events are transferred to main event queue
// for coalescing
- WToolkit.getWToolkit().flushPendingEvents();
+ SunToolkit.flushPendingEvents();
// paint the damaged area
paintArea.paint(target, shouldClearRectBeforePaint());
}
@@ -320,6 +320,7 @@
native void nativeHandleEvent(AWTEvent e);
+ @SuppressWarnings("fallthrough")
public void handleEvent(AWTEvent e) {
int id = e.getID();
@@ -549,6 +550,7 @@
// fallback default font object
final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
+ @SuppressWarnings("deprecation")
public Graphics getGraphics() {
if (isDisposed()) {
return null;
@@ -656,6 +658,7 @@
}
// TODO: consider moving it to KeyboardFocusManagerPeerImpl
+ @SuppressWarnings("deprecation")
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
CausedFocusEvent.Cause cause)
@@ -1058,6 +1061,7 @@
// in the browser on Vista when DWM is enabled.
// @return true if the toplevel container is not an EmbeddedFrame or
// if this EmbeddedFrame is acceleration capable, false otherwise
+ @SuppressWarnings("deprecation")
private static final boolean isContainingTopLevelAccelCapable(Component c) {
while (c != null && !(c instanceof WEmbeddedFrame)) {
c = c.getParent();
@@ -1072,6 +1076,7 @@
* Applies the shape to the native component window.
* @since 1.7
*/
+ @SuppressWarnings("deprecation")
public void applyShape(Region shape) {
if (shapeLog.isLoggable(PlatformLogger.FINER)) {
shapeLog.finer(
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Tue Dec 20 15:26:23 2011 -0800
@@ -107,13 +107,15 @@
"DIBV5"
};
- private static final Map predefinedClipboardNameMap;
+ private static final Map <String, Long> predefinedClipboardNameMap;
static {
- Map tempMap = new HashMap(predefinedClipboardNames.length, 1.0f);
+ Map <String,Long> tempMap =
+ new HashMap <> (predefinedClipboardNames.length, 1.0f);
for (int i = 1; i < predefinedClipboardNames.length; i++) {
tempMap.put(predefinedClipboardNames[i], Long.valueOf(i));
}
- predefinedClipboardNameMap = Collections.synchronizedMap(tempMap);
+ predefinedClipboardNameMap =
+ Collections.synchronizedMap(tempMap);
}
/**
@@ -135,7 +137,7 @@
public static final long CF_FILEGROUPDESCRIPTORA = registerClipboardFormat("FileGroupDescriptor");
//CF_FILECONTENTS supported as mandatory associated clipboard
- private static final Long L_CF_LOCALE = (Long)
+ private static final Long L_CF_LOCALE =
predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]);
private static final DirectColorModel directColorModel =
@@ -168,8 +170,11 @@
return transferer;
}
- public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
- SortedMap retval = super.getFormatsForFlavors(flavors, map);
+ public SortedMap <Long, DataFlavor> getFormatsForFlavors(
+ DataFlavor[] flavors, FlavorTable map)
+ {
+ SortedMap <Long, DataFlavor> retval =
+ super.getFormatsForFlavors(flavors, map);
// The Win32 native code does not support exporting LOCALE data, nor
// should it.
@@ -266,7 +271,7 @@
}
protected Long getFormatForNativeAsLong(String str) {
- Long format = (Long)predefinedClipboardNameMap.get(str);
+ Long format = predefinedClipboardNameMap.get(str);
if (format == null) {
format = Long.valueOf(registerClipboardFormat(str));
}
--- a/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java Tue Dec 20 15:26:23 2011 -0800
@@ -238,6 +238,7 @@
* Called by WToolkit when Windows settings change-- we (re)load properties and
* set new values.
*/
+ @SuppressWarnings("unchecked")
synchronized Map<String, Object> getProperties() {
ThemeReader.flush();
--- a/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -87,6 +87,7 @@
}
}
+ @SuppressWarnings("deprecation")
public void hide() {
Dialog dlg = (Dialog)target;
if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
--- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java Tue Dec 20 15:26:23 2011 -0800
@@ -27,14 +27,12 @@
import sun.awt.*;
import java.awt.*;
-import java.awt.event.*;
import java.awt.peer.ComponentPeer;
-import java.util.*;
-import java.awt.color.*;
import java.awt.image.*;
import sun.awt.image.ByteInterleavedRaster;
import sun.security.action.GetPropertyAction;
-import java.lang.reflect.*;
+import java.security.PrivilegedAction;
+import java.security.AccessController;
public class WEmbeddedFrame extends EmbeddedFrame {
@@ -52,8 +50,8 @@
private static int pScale = 0;
private static final int MAX_BAND_SIZE = (1024*30);
- private static String printScale = (String) java.security.AccessController
- .doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
+ private static String printScale = AccessController.doPrivileged(
+ new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
public WEmbeddedFrame() {
this((long)0);
@@ -75,6 +73,7 @@
}
}
+ @SuppressWarnings("deprecation")
public void addNotify() {
if (getPeer() == null) {
WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
@@ -134,8 +133,8 @@
bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight);
- imgWid = (int)(bandWidth * xscale);
- imgHgt = (int)(bandHeight * yscale);
+ imgWid = bandWidth * xscale;
+ imgHgt = bandHeight * yscale;
bandImage = new BufferedImage(imgWid, imgHgt,
BufferedImage.TYPE_3BYTE_BGR);
}
@@ -159,7 +158,7 @@
if ((bandTop+bandHeight) > frameHeight) {
// last band
currBandHeight = frameHeight - bandTop;
- currImgHeight = (int)(currBandHeight*yscale);
+ currImgHeight = currBandHeight*yscale;
// multiply by 3 because the image is a 3 byte BGR
imageOffset = imgWid*(imgHgt-currImgHeight)*3;
@@ -179,9 +178,9 @@
if (printScale == null) {
// if no system property is specified,
// check for environment setting
- printScale = (String) java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ printScale = AccessController.doPrivileged(
+ new PrivilegedAction<String>() {
+ public String run() {
return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE");
}
}
@@ -226,6 +225,7 @@
public void activateEmbeddingTopLevel() {
}
+ @SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean doActivate) {
if (!doActivate || EventQueue.isDispatchThread()) {
((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate);
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -167,7 +167,7 @@
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
public void run() {
- fileDialog.hide();
+ fileDialog.setVisible(false);
}
});
} // handleSelected()
@@ -182,16 +182,16 @@
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
public void run() {
- fileDialog.hide();
+ fileDialog.setVisible(false);
}
});
} // handleCancel()
//This whole static block is a part of 4152317 fix
static {
- String filterString = (String) AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ String filterString = AccessController.doPrivileged(
+ new PrivilegedAction<String>() {
+ public String run() {
try {
ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
return rb.getString("allFiles");
--- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -24,25 +24,12 @@
*/
package sun.awt.windows;
-import java.util.Vector;
-
import java.awt.*;
import java.awt.peer.*;
-import java.awt.image.ImageObserver;
-
-import java.awt.image.Raster;
-import java.awt.image.DataBuffer;
-import java.awt.image.DataBufferInt;
-import java.awt.image.BufferedImage;
-
-import java.awt.image.ColorModel;
-
-import sun.awt.image.ImageRepresentation;
-import sun.awt.image.IntegerComponentRaster;
-import sun.awt.image.ToolkitImage;
-import sun.awt.im.*;
-import sun.awt.Win32GraphicsDevice;
import sun.awt.AWTAccessor;
+import sun.awt.im.InputMethodManager;
+import java.security.AccessController;
+import sun.security.action.GetPropertyAction;
class WFramePeer extends WWindowPeer implements FramePeer {
@@ -71,9 +58,9 @@
private native void clearMaximizedBounds();
private static final boolean keepOnMinimize = "true".equals(
- (String)java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction(
- "sun.awt.keepWorkingSetOnMinimize")));
+ AccessController.doPrivileged(
+ new GetPropertyAction(
+ "sun.awt.keepWorkingSetOnMinimize")));
public void setMaximizedBounds(Rectangle b) {
if (b == null) {
--- a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java Tue Dec 20 15:26:23 2011 -0800
@@ -82,12 +82,12 @@
private final static boolean COMMIT_INPUT = true;
private final static boolean DISCARD_INPUT = false;
- private static Map[] highlightStyles;
+ private static Map<TextAttribute,Object> [] highlightStyles;
// Initialize highlight mapping table
static {
- Map styles[] = new Map[4];
- HashMap map;
+ Map<TextAttribute,Object> styles[] = new Map[4];
+ HashMap<TextAttribute,Object> map;
// UNSELECTED_RAW_TEXT_HIGHLIGHT
map = new HashMap(1);
@@ -410,7 +410,7 @@
/**
* @see java.awt.Toolkit#mapInputMethodHighlight
*/
- static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
+ static Map<TextAttribute,?> mapInputMethodHighlight(InputMethodHighlight highlight) {
int index;
int state = highlight.getState();
if (state == InputMethodHighlight.RAW_TEXT) {
--- a/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -158,9 +158,9 @@
private static Font defaultMenuFont;
static {
- defaultMenuFont = (Font) AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ defaultMenuFont = AccessController.doPrivileged(
+ new PrivilegedAction <Font> () {
+ public Font run() {
try {
ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
return Font.decode(rb.getString("menuFont"));
--- a/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java Tue Dec 20 15:26:23 2011 -0800
@@ -55,6 +55,7 @@
this.painter = painter;
}
+ @SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {
Container parent = getParent();
--- a/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -49,7 +49,7 @@
// but if it is we need to trap it so the thread does
// not hide is called and the thread doesn't hang.
}
- ((WPrintDialog)target).hide();
+ ((WPrintDialog)target).setVisible(false);
}
}).start();
}
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java Tue Dec 20 15:26:23 2011 -0800
@@ -53,6 +53,7 @@
// Use native code to circumvent access restrictions on Component.peer
protected native void setPeer(ComponentPeer peer);
+ @SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {
Container parent = getParent();
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -73,7 +73,7 @@
// but if it is we need to trap it so the thread does
// not hide is called and the thread doesn't hang.
}
- ((WPrintDialog)target).hide();
+ ((WPrintDialog)target).setVisible(false);
}
}).start();
}
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Tue Dec 20 15:26:23 2011 -0800
@@ -74,7 +74,7 @@
WClipboard clipboard;
// cache of font peers
- private Hashtable cacheFontPeer;
+ private Hashtable<String,FontPeer> cacheFontPeer;
// Windows properties
private WDesktopProperties wprops;
@@ -110,10 +110,10 @@
log.fine("Win version: " + getWindowsVersion());
}
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction()
+ AccessController.doPrivileged(
+ new PrivilegedAction <Void> ()
{
- public Object run() {
+ public Void run() {
String browserProp = System.getProperty("browser");
if (browserProp != null && browserProp.equals("sun.plugin")) {
disableCustomPalette();
@@ -261,8 +261,8 @@
}
private final void registerShutdownHook() {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
ThreadGroup currentTG =
Thread.currentThread().getThreadGroup();
ThreadGroup parentTG = currentTG.getParent();
@@ -399,6 +399,7 @@
return peer;
}
+ @SuppressWarnings("deprecation")
public void disableBackgroundErase(Canvas canvas) {
WCanvasPeer peer = (WCanvasPeer)canvas.getPeer();
if (peer == null) {
@@ -592,7 +593,7 @@
FontPeer retval = null;
String lcName = name.toLowerCase();
if (null != cacheFontPeer) {
- retval = (FontPeer)cacheFontPeer.get(lcName + style);
+ retval = cacheFontPeer.get(lcName + style);
if (null != retval) {
return retval;
}
@@ -600,7 +601,7 @@
retval = new WFontPeer(name, style);
if (retval != null) {
if (null == cacheFontPeer) {
- cacheFontPeer = new Hashtable(5, (float)0.9);
+ cacheFontPeer = new Hashtable<>(5, 0.9f);
}
if (null != cacheFontPeer) {
cacheFontPeer.put(lcName + style, retval);
@@ -698,7 +699,9 @@
/**
* Returns a style map for the input method highlight.
*/
- public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
+ public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
+ InputMethodHighlight highlight)
+ {
return WInputMethod.mapInputMethodHighlight(highlight);
}
@@ -968,12 +971,14 @@
return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
}
+ @SuppressWarnings("deprecation")
public void grab(Window w) {
if (w.getPeer() != null) {
((WWindowPeer)w.getPeer()).grab();
}
}
+ @SuppressWarnings("deprecation")
public void ungrab(Window w) {
if (w.getPeer() != null) {
((WWindowPeer)w.getPeer()).ungrab();
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Wed Jul 05 17:57:50 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Tue Dec 20 15:26:23 2011 -0800
@@ -92,7 +92,7 @@
}
// WComponentPeer overrides
-
+ @SuppressWarnings("unchecked")
protected void disposeImpl() {
AppContext appContext = SunToolkit.targetToAppContext(target);
synchronized (appContext) {
@@ -378,6 +378,7 @@
return modalBlocker != null;
}
+ @SuppressWarnings("deprecation")
public void setModalBlocked(Dialog dialog, boolean blocked) {
synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
{
@@ -417,6 +418,7 @@
* The list is sorted by the time of activation, so the latest
* active window is always at the end.
*/
+ @SuppressWarnings("unchecked")
public static long[] getActiveWindowHandles() {
AppContext appContext = AppContext.getAppContext();
synchronized (appContext) {
@@ -571,6 +573,7 @@
super.print(g);
}
+ @SuppressWarnings("deprecation")
private void replaceSurfaceDataRecursively(Component c) {
if (c instanceof Container) {
for (Component child : ((Container)c).getComponents()) {
@@ -691,13 +694,13 @@
// its shape only. To restore the correct visual appearance
// of the window (i.e. w/ the correct shape) we have to reset
// the shape.
- Shape shape = ((Window)target).getShape();
+ Shape shape = target.getShape();
if (shape != null) {
- ((Window)target).setShape(shape);
+ target.setShape(shape);
}
}
- if (((Window)target).isVisible()) {
+ if (target.isVisible()) {
updateWindow(true);
}
}
@@ -730,6 +733,7 @@
* then the method registers ActiveWindowListener, GuiDisposedListener listeners;
* it executes the initilialization only once per AppContext.
*/
+ @SuppressWarnings("unchecked")
private static void initActiveWindowsTracking(Window w) {
AppContext appContext = AppContext.getAppContext();
synchronized (appContext) {
@@ -774,6 +778,7 @@
* updates the list of active windows per AppContext, so the latest active
* window is always at the end of the list. The list is stored in AppContext.
*/
+ @SuppressWarnings( value = {"deprecation", "unchecked"})
private static class ActiveWindowListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) {
Window w = (Window)e.getNewValue();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/EventQueue/MainAppContext/MainAppContext.java Tue Dec 20 15:26:23 2011 -0800
@@ -0,0 +1,36 @@
+/*
+ * @test
+ * @bug 7122796
+ * @summary Tests 7122796
+ * @author anthony.petrov@oracle.com
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import sun.awt.*;
+
+public class MainAppContext {
+
+ public static void main(String[] args) {
+ ThreadGroup secondGroup = new ThreadGroup("test");
+ new Thread(secondGroup, new Runnable() {
+ public void run() {
+ SunToolkit.createNewAppContext();
+ test(true);
+ }
+ }).start();
+
+ // Sleep on the main thread so that the AWT Toolkit is initialized
+ // in a user AppContext first
+ try { Thread.sleep(2000); } catch (Exception e) {}
+
+ test(false);
+ }
+
+ private static void test(boolean userAppContext) {
+ if (Toolkit.getDefaultToolkit().getSystemEventQueue() == null) {
+ throw new RuntimeException("No EventQueue for the current app context! userAppContext: " + userAppContext);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java Tue Dec 20 15:26:23 2011 -0800
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4708809
+ * @summary JScrollBar functionality slightly different from native scrollbar
+ * @author Andrey Pikalev
+ * @run main bug4708809
+ */
+import javax.swing.*;
+import java.awt.*;
+import java.awt.Point;
+import java.awt.event.*;
+import sun.awt.SunToolkit;
+
+public class bug4708809 {
+
+ private static volatile boolean do_test = false;
+ private static volatile boolean passed = true;
+ private static JScrollPane spane;
+ private static JScrollBar sbar;
+
+ public static void main(String[] args) throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(350);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ spane.requestFocus();
+ sbar.setValue(sbar.getMaximum());
+ }
+ });
+
+ toolkit.realSync();
+
+ Point point = getClickPoint(0.5, 0.5);
+ robot.mouseMove(point.x, point.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ final int oldValue = sbar.getValue();
+ sbar.addAdjustmentListener(new AdjustmentListener() {
+
+ public void adjustmentValueChanged(AdjustmentEvent e) {
+ if (e.getValue() >= oldValue) {
+ passed = false;
+ }
+ do_test = true;
+ }
+ });
+
+ }
+ });
+
+ toolkit.realSync();
+
+ point = getClickPoint(0.5, 0.2);
+ robot.mouseMove(point.x, point.y);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (!do_test || !passed) {
+ throw new Exception("The scrollbar moved with incorrect direction");
+ }
+
+ }
+
+ private static Point getClickPoint(final double scaleX, final double scaleY) throws Exception {
+ final Point[] result = new Point[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ Point p = sbar.getLocationOnScreen();
+ Rectangle rect = sbar.getBounds();
+ result[0] = new Point((int) (p.x + scaleX * rect.width),
+ (int) (p.y + scaleY * rect.height));
+ }
+ });
+
+ return result[0];
+
+ }
+
+ private static void createAndShowGUI() {
+ JFrame fr = new JFrame("Test");
+
+ JLabel label = new JLabel("picture");
+ label.setPreferredSize(new Dimension(500, 500));
+ spane = new JScrollPane(label);
+ fr.getContentPane().add(spane);
+ sbar = spane.getVerticalScrollBar();
+
+ fr.setSize(200, 200);
+ fr.setVisible(true);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java Tue Dec 20 15:26:23 2011 -0800
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6416920
+ * @summary Ensures that selected tab is painted properly in the scroll tab layout
+ * under WindowsLookAndFeel in Windows' "Windows XP" theme.
+ * @author Mikhail Lapshin
+ * @run main bug6416920
+ */
+
+import javax.swing.plaf.basic.BasicTabbedPaneUI;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingConstants;
+import java.awt.Rectangle;
+import java.awt.Insets;
+import sun.awt.OSInfo;
+
+public class bug6416920 extends BasicTabbedPaneUI {
+ public AccessibleTabbedPaneLayout layout = new AccessibleTabbedPaneLayout();
+
+ public static void main(String[] args) {
+
+ if(OSInfo.getOSType() != OSInfo.OSType.WINDOWS){
+ return;
+ }
+
+ bug6416920 test = new bug6416920();
+ test.layout.padSelectedTab(SwingConstants.TOP, 0);
+ if (test.rects[0].width < 0) {
+ throw new RuntimeException("A selected tab isn't painted properly " +
+ "in the scroll tab layout under WindowsLookAndFeel " +
+ "in Windows' \"Windows XP\" theme.");
+ }
+ }
+
+ public bug6416920() {
+ super();
+
+ // Set parameters for the padSelectedTab() method
+ selectedTabPadInsets = new Insets(0, 0, 0, 0);
+
+ tabPane = new JTabbedPane();
+ tabPane.setSize(100, 0);
+ tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+
+ rects = new Rectangle[1];
+ rects[0] = new Rectangle(150, 0, 0, 0);
+ }
+
+ public class AccessibleTabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout {
+ public void padSelectedTab(int tabPlacement, int selectedIndex) {
+ super.padSelectedTab(tabPlacement, selectedIndex);
+ }
+ }
+}