7117011: Reduce number of warnings in sun/awt/windows and sun/awt/datatransfer

Reviewed-by: art
This commit is contained in:
Denis Fokin 2011-12-19 16:44:36 +04:00
parent 3704715569
commit 1258946332
22 changed files with 102 additions and 83 deletions

View File

@ -649,8 +649,9 @@ public abstract class DataTransferer {
* The map keys are sorted according to the native formats preference * The map keys are sorted according to the native formats preference
* order. * order.
*/ */
public SortedMap getFormatsForTransferable(Transferable contents, public SortedMap<Long,DataFlavor> getFormatsForTransferable(
FlavorTable map) { Transferable contents, FlavorTable map)
{
DataFlavor[] flavors = contents.getTransferDataFlavors(); DataFlavor[] flavors = contents.getTransferDataFlavors();
if (flavors == null) { if (flavors == null) {
return new TreeMap(); return new TreeMap();
@ -686,9 +687,13 @@ public abstract class DataTransferer {
* DataFlavors and data formats * DataFlavors and data formats
* @throws NullPointerException if flavors or map is <code>null</code> * @throws NullPointerException if flavors or map is <code>null</code>
*/ */
public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) { public SortedMap <Long, DataFlavor> getFormatsForFlavors(
Map formatMap = new HashMap(flavors.length); DataFlavor[] flavors, FlavorTable map)
Map textPlainMap = new HashMap(flavors.length); {
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 // Maps formats to indices that will be used to sort the formats
// according to the preference order. // according to the preference order.
// Larger index value corresponds to the more preferable format. // Larger index value corresponds to the more preferable format.

View File

@ -52,6 +52,7 @@ import java.util.SortedMap;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.awt.datatransfer.DataTransferer; import sun.awt.datatransfer.DataTransferer;
import java.awt.datatransfer.DataFlavor;
/** /**
* <p> * <p>
@ -126,9 +127,9 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
dragImageOffset = p; dragImageOffset = p;
Transferable transferable = getDragSourceContext().getTransferable(); Transferable transferable = getDragSourceContext().getTransferable();
SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
(transferable, DataTransferer.adaptFlavorMap getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
(getTrigger().getDragSource().getFlavorMap())); (getTrigger().getDragSource().getFlavorMap()));
long[] formats = DataTransferer.getInstance(). long[] formats = DataTransferer.getInstance().
keysToLongArray(formatMap); keysToLongArray(formatMap);
startDrag(transferable, formats, formatMap); startDrag(transferable, formats, formatMap);

View File

@ -26,6 +26,7 @@
package sun.awt.X11; package sun.awt.X11;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import java.util.SortedMap; import java.util.SortedMap;
import java.io.IOException; import java.io.IOException;
import java.security.AccessController; import java.security.AccessController;
@ -83,7 +84,8 @@ public final class XClipboard extends SunClipboard implements OwnershipListener
} }
protected synchronized void setContentsNative(Transferable contents) { protected synchronized void setContentsNative(Transferable contents) {
SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable SortedMap<Long,DataFlavor> formatMap =
DataTransferer.getInstance().getFormatsForTransferable
(contents, DataTransferer.adaptFlavorMap(flavorMap)); (contents, DataTransferer.adaptFlavorMap(flavorMap));
long[] formats = DataTransferer.keysToLongArray(formatMap); long[] formats = DataTransferer.keysToLongArray(formatMap);

View File

@ -40,6 +40,7 @@ import sun.java2d.DestSurfaceProvider;
import sun.java2d.InvalidPipeException; import sun.java2d.InvalidPipeException;
import sun.java2d.Surface; import sun.java2d.Surface;
import sun.java2d.pipe.RenderQueue; import sun.java2d.pipe.RenderQueue;
import sun.java2d.pipe.BufferedContext;
import sun.java2d.pipe.hw.AccelGraphicsConfig; import sun.java2d.pipe.hw.AccelGraphicsConfig;
import sun.java2d.pipe.hw.AccelSurface; import sun.java2d.pipe.hw.AccelSurface;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
@ -310,7 +311,7 @@ public abstract class TranslucentWindowPainter {
RenderQueue rq = as.getContext().getRenderQueue(); RenderQueue rq = as.getContext().getRenderQueue();
rq.lock(); rq.lock();
try { try {
as.getContext().validateContext(as); BufferedContext.validateContext(as);
rq.flushAndInvokeNow(new Runnable() { rq.flushAndInvokeNow(new Runnable() {
public void run() { public void run() {
long psdops = as.getNativeOps(); long psdops = as.getNativeOps();

View File

@ -37,7 +37,7 @@ import java.awt.Component;
*/ */
public class WBufferStrategy { public class WBufferStrategy {
private static native void initIDs(Class componentClass); private static native void initIDs(Class <?> componentClass);
static { static {
initIDs(Component.class); initIDs(Component.class);

View File

@ -84,6 +84,7 @@ class WChoicePeer extends WComponentPeer implements ChoicePeer {
native void create(WComponentPeer parent); native void create(WComponentPeer parent);
@SuppressWarnings("deprecation")
void initialize() { void initialize() {
Choice opt = (Choice)target; Choice opt = (Choice)target;
int itemCount = opt.getItemCount(); int itemCount = opt.getItemCount();
@ -116,6 +117,7 @@ class WChoicePeer extends WComponentPeer implements ChoicePeer {
super.initialize(); super.initialize();
} }
@SuppressWarnings("deprecation")
protected void disposeImpl() { protected void disposeImpl() {
// TODO: we should somehow reset the listener when the choice // TODO: we should somehow reset the listener when the choice
// is moved to another toplevel without destroying its peer. // is moved to another toplevel without destroying its peer.

View File

@ -71,17 +71,14 @@ public class WClipboard extends SunClipboard {
// Get all of the target formats into which the Transferable can be // Get all of the target formats into which the Transferable can be
// translated. Then, for each format, translate the data and post // translated. Then, for each format, translate the data and post
// it to the Clipboard. // it to the Clipboard.
Map formatMap = WDataTransferer.getInstance(). Map <Long, DataFlavor> formatMap = WDataTransferer.getInstance().
getFormatsForTransferable(contents, flavorMap); getFormatsForTransferable(contents, flavorMap);
openClipboard(this); openClipboard(this);
try { try {
for (Iterator iter = formatMap.keySet().iterator(); for (Long format : formatMap.keySet()) {
iter.hasNext(); ) { DataFlavor flavor = formatMap.get(format);
Long lFormat = (Long)iter.next();
long format = lFormat.longValue();
DataFlavor flavor = (DataFlavor)formatMap.get(lFormat);
try { try {
byte[] bytes = WDataTransferer.getInstance(). byte[] bytes = WDataTransferer.getInstance().

View File

@ -222,7 +222,7 @@ public abstract class WComponentPeer extends WObjectPeer
updateWindow(); updateWindow();
// make sure paint events are transferred to main event queue // make sure paint events are transferred to main event queue
// for coalescing // for coalescing
WToolkit.getWToolkit().flushPendingEvents(); SunToolkit.flushPendingEvents();
// paint the damaged area // paint the damaged area
paintArea.paint(target, shouldClearRectBeforePaint()); paintArea.paint(target, shouldClearRectBeforePaint());
} }
@ -320,6 +320,7 @@ public abstract class WComponentPeer extends WObjectPeer
native void nativeHandleEvent(AWTEvent e); native void nativeHandleEvent(AWTEvent e);
@SuppressWarnings("fallthrough")
public void handleEvent(AWTEvent e) { public void handleEvent(AWTEvent e) {
int id = e.getID(); int id = e.getID();
@ -549,6 +550,7 @@ public abstract class WComponentPeer extends WObjectPeer
// fallback default font object // fallback default font object
final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
@SuppressWarnings("deprecation")
public Graphics getGraphics() { public Graphics getGraphics() {
if (isDisposed()) { if (isDisposed()) {
return null; return null;
@ -656,6 +658,7 @@ public abstract class WComponentPeer extends WObjectPeer
} }
// TODO: consider moving it to KeyboardFocusManagerPeerImpl // TODO: consider moving it to KeyboardFocusManagerPeerImpl
@SuppressWarnings("deprecation")
public boolean requestFocus(Component lightweightChild, boolean temporary, public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time, boolean focusedWindowChangeAllowed, long time,
CausedFocusEvent.Cause cause) CausedFocusEvent.Cause cause)
@ -1058,6 +1061,7 @@ public abstract class WComponentPeer extends WObjectPeer
// in the browser on Vista when DWM is enabled. // in the browser on Vista when DWM is enabled.
// @return true if the toplevel container is not an EmbeddedFrame or // @return true if the toplevel container is not an EmbeddedFrame or
// if this EmbeddedFrame is acceleration capable, false otherwise // if this EmbeddedFrame is acceleration capable, false otherwise
@SuppressWarnings("deprecation")
private static final boolean isContainingTopLevelAccelCapable(Component c) { private static final boolean isContainingTopLevelAccelCapable(Component c) {
while (c != null && !(c instanceof WEmbeddedFrame)) { while (c != null && !(c instanceof WEmbeddedFrame)) {
c = c.getParent(); c = c.getParent();
@ -1072,6 +1076,7 @@ public abstract class WComponentPeer extends WObjectPeer
* Applies the shape to the native component window. * Applies the shape to the native component window.
* @since 1.7 * @since 1.7
*/ */
@SuppressWarnings("deprecation")
public void applyShape(Region shape) { public void applyShape(Region shape) {
if (shapeLog.isLoggable(PlatformLogger.FINER)) { if (shapeLog.isLoggable(PlatformLogger.FINER)) {
shapeLog.finer( shapeLog.finer(

View File

@ -107,13 +107,15 @@ public class WDataTransferer extends DataTransferer {
"DIBV5" "DIBV5"
}; };
private static final Map predefinedClipboardNameMap; private static final Map <String, Long> predefinedClipboardNameMap;
static { 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++) { for (int i = 1; i < predefinedClipboardNames.length; i++) {
tempMap.put(predefinedClipboardNames[i], Long.valueOf(i)); tempMap.put(predefinedClipboardNames[i], Long.valueOf(i));
} }
predefinedClipboardNameMap = Collections.synchronizedMap(tempMap); predefinedClipboardNameMap =
Collections.synchronizedMap(tempMap);
} }
/** /**
@ -135,7 +137,7 @@ public class WDataTransferer extends DataTransferer {
public static final long CF_FILEGROUPDESCRIPTORA = registerClipboardFormat("FileGroupDescriptor"); public static final long CF_FILEGROUPDESCRIPTORA = registerClipboardFormat("FileGroupDescriptor");
//CF_FILECONTENTS supported as mandatory associated clipboard //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]); predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]);
private static final DirectColorModel directColorModel = private static final DirectColorModel directColorModel =
@ -168,8 +170,11 @@ public class WDataTransferer extends DataTransferer {
return transferer; return transferer;
} }
public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) { public SortedMap <Long, DataFlavor> getFormatsForFlavors(
SortedMap retval = super.getFormatsForFlavors(flavors, map); DataFlavor[] flavors, FlavorTable map)
{
SortedMap <Long, DataFlavor> retval =
super.getFormatsForFlavors(flavors, map);
// The Win32 native code does not support exporting LOCALE data, nor // The Win32 native code does not support exporting LOCALE data, nor
// should it. // should it.
@ -266,7 +271,7 @@ public class WDataTransferer extends DataTransferer {
} }
protected Long getFormatForNativeAsLong(String str) { protected Long getFormatForNativeAsLong(String str) {
Long format = (Long)predefinedClipboardNameMap.get(str); Long format = predefinedClipboardNameMap.get(str);
if (format == null) { if (format == null) {
format = Long.valueOf(registerClipboardFormat(str)); format = Long.valueOf(registerClipboardFormat(str));
} }

View File

@ -238,6 +238,7 @@ class WDesktopProperties {
* Called by WToolkit when Windows settings change-- we (re)load properties and * Called by WToolkit when Windows settings change-- we (re)load properties and
* set new values. * set new values.
*/ */
@SuppressWarnings("unchecked")
synchronized Map<String, Object> getProperties() { synchronized Map<String, Object> getProperties() {
ThemeReader.flush(); ThemeReader.flush();

View File

@ -87,6 +87,7 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
} }
} }
@SuppressWarnings("deprecation")
public void hide() { public void hide() {
Dialog dlg = (Dialog)target; Dialog dlg = (Dialog)target;
if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) { if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {

View File

@ -27,14 +27,12 @@ package sun.awt.windows;
import sun.awt.*; import sun.awt.*;
import java.awt.*; import java.awt.*;
import java.awt.event.*;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.util.*;
import java.awt.color.*;
import java.awt.image.*; import java.awt.image.*;
import sun.awt.image.ByteInterleavedRaster; import sun.awt.image.ByteInterleavedRaster;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
import java.lang.reflect.*; import java.security.PrivilegedAction;
import java.security.AccessController;
public class WEmbeddedFrame extends EmbeddedFrame { public class WEmbeddedFrame extends EmbeddedFrame {
@ -52,8 +50,8 @@ public class WEmbeddedFrame extends EmbeddedFrame {
private static int pScale = 0; private static int pScale = 0;
private static final int MAX_BAND_SIZE = (1024*30); private static final int MAX_BAND_SIZE = (1024*30);
private static String printScale = (String) java.security.AccessController private static String printScale = AccessController.doPrivileged(
.doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor")); new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
public WEmbeddedFrame() { public WEmbeddedFrame() {
this((long)0); this((long)0);
@ -75,6 +73,7 @@ public class WEmbeddedFrame extends EmbeddedFrame {
} }
} }
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
if (getPeer() == null) { if (getPeer() == null) {
WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit(); WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
@ -134,8 +133,8 @@ public class WEmbeddedFrame extends EmbeddedFrame {
bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight); bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight);
imgWid = (int)(bandWidth * xscale); imgWid = bandWidth * xscale;
imgHgt = (int)(bandHeight * yscale); imgHgt = bandHeight * yscale;
bandImage = new BufferedImage(imgWid, imgHgt, bandImage = new BufferedImage(imgWid, imgHgt,
BufferedImage.TYPE_3BYTE_BGR); BufferedImage.TYPE_3BYTE_BGR);
} }
@ -159,7 +158,7 @@ public class WEmbeddedFrame extends EmbeddedFrame {
if ((bandTop+bandHeight) > frameHeight) { if ((bandTop+bandHeight) > frameHeight) {
// last band // last band
currBandHeight = frameHeight - bandTop; currBandHeight = frameHeight - bandTop;
currImgHeight = (int)(currBandHeight*yscale); currImgHeight = currBandHeight*yscale;
// multiply by 3 because the image is a 3 byte BGR // multiply by 3 because the image is a 3 byte BGR
imageOffset = imgWid*(imgHgt-currImgHeight)*3; imageOffset = imgWid*(imgHgt-currImgHeight)*3;
@ -179,9 +178,9 @@ public class WEmbeddedFrame extends EmbeddedFrame {
if (printScale == null) { if (printScale == null) {
// if no system property is specified, // if no system property is specified,
// check for environment setting // check for environment setting
printScale = (String) java.security.AccessController.doPrivileged( printScale = AccessController.doPrivileged(
new java.security.PrivilegedAction() { new PrivilegedAction<String>() {
public Object run() { public String run() {
return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE"); return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE");
} }
} }
@ -226,6 +225,7 @@ public class WEmbeddedFrame extends EmbeddedFrame {
public void activateEmbeddingTopLevel() { public void activateEmbeddingTopLevel() {
} }
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean doActivate) { public void synthesizeWindowActivation(final boolean doActivate) {
if (!doActivate || EventQueue.isDispatchThread()) { if (!doActivate || EventQueue.isDispatchThread()) {
((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate); ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate);

View File

@ -167,7 +167,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
public void run() { public void run() {
fileDialog.hide(); fileDialog.setVisible(false);
} }
}); });
} // handleSelected() } // handleSelected()
@ -182,16 +182,16 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
public void run() { public void run() {
fileDialog.hide(); fileDialog.setVisible(false);
} }
}); });
} // handleCancel() } // handleCancel()
//This whole static block is a part of 4152317 fix //This whole static block is a part of 4152317 fix
static { static {
String filterString = (String) AccessController.doPrivileged( String filterString = AccessController.doPrivileged(
new PrivilegedAction() { new PrivilegedAction<String>() {
public Object run() { public String run() {
try { try {
ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization"); ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
return rb.getString("allFiles"); return rb.getString("allFiles");

View File

@ -24,25 +24,12 @@
*/ */
package sun.awt.windows; package sun.awt.windows;
import java.util.Vector;
import java.awt.*; import java.awt.*;
import java.awt.peer.*; 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.AWTAccessor;
import sun.awt.im.InputMethodManager;
import java.security.AccessController;
import sun.security.action.GetPropertyAction;
class WFramePeer extends WWindowPeer implements FramePeer { class WFramePeer extends WWindowPeer implements FramePeer {
@ -71,9 +58,9 @@ class WFramePeer extends WWindowPeer implements FramePeer {
private native void clearMaximizedBounds(); private native void clearMaximizedBounds();
private static final boolean keepOnMinimize = "true".equals( private static final boolean keepOnMinimize = "true".equals(
(String)java.security.AccessController.doPrivileged( AccessController.doPrivileged(
new sun.security.action.GetPropertyAction( new GetPropertyAction(
"sun.awt.keepWorkingSetOnMinimize"))); "sun.awt.keepWorkingSetOnMinimize")));
public void setMaximizedBounds(Rectangle b) { public void setMaximizedBounds(Rectangle b) {
if (b == null) { if (b == null) {

View File

@ -82,12 +82,12 @@ public class WInputMethod extends InputMethodAdapter
private final static boolean COMMIT_INPUT = true; private final static boolean COMMIT_INPUT = true;
private final static boolean DISCARD_INPUT = false; private final static boolean DISCARD_INPUT = false;
private static Map[] highlightStyles; private static Map<TextAttribute,Object> [] highlightStyles;
// Initialize highlight mapping table // Initialize highlight mapping table
static { static {
Map styles[] = new Map[4]; Map<TextAttribute,Object> styles[] = new Map[4];
HashMap map; HashMap<TextAttribute,Object> map;
// UNSELECTED_RAW_TEXT_HIGHLIGHT // UNSELECTED_RAW_TEXT_HIGHLIGHT
map = new HashMap(1); map = new HashMap(1);
@ -410,7 +410,7 @@ public class WInputMethod extends InputMethodAdapter
/** /**
* @see java.awt.Toolkit#mapInputMethodHighlight * @see java.awt.Toolkit#mapInputMethodHighlight
*/ */
static Map mapInputMethodHighlight(InputMethodHighlight highlight) { static Map<TextAttribute,?> mapInputMethodHighlight(InputMethodHighlight highlight) {
int index; int index;
int state = highlight.getState(); int state = highlight.getState();
if (state == InputMethodHighlight.RAW_TEXT) { if (state == InputMethodHighlight.RAW_TEXT) {

View File

@ -158,9 +158,9 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
private static Font defaultMenuFont; private static Font defaultMenuFont;
static { static {
defaultMenuFont = (Font) AccessController.doPrivileged( defaultMenuFont = AccessController.doPrivileged(
new PrivilegedAction() { new PrivilegedAction <Font> () {
public Object run() { public Font run() {
try { try {
ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization"); ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
return Font.decode(rb.getString("menuFont")); return Font.decode(rb.getString("menuFont"));

View File

@ -55,6 +55,7 @@ public class WPageDialog extends WPrintDialog {
this.painter = painter; this.painter = painter;
} }
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
Container parent = getParent(); Container parent = getParent();

View File

@ -49,7 +49,7 @@ public class WPageDialogPeer extends WPrintDialogPeer {
// but if it is we need to trap it so the thread does // but if it is we need to trap it so the thread does
// not hide is called and the thread doesn't hang. // not hide is called and the thread doesn't hang.
} }
((WPrintDialog)target).hide(); ((WPrintDialog)target).setVisible(false);
} }
}).start(); }).start();
} }

View File

@ -53,6 +53,7 @@ public class WPrintDialog extends Dialog {
// Use native code to circumvent access restrictions on Component.peer // Use native code to circumvent access restrictions on Component.peer
protected native void setPeer(ComponentPeer peer); protected native void setPeer(ComponentPeer peer);
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
Container parent = getParent(); Container parent = getParent();

View File

@ -73,7 +73,7 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
// but if it is we need to trap it so the thread does // but if it is we need to trap it so the thread does
// not hide is called and the thread doesn't hang. // not hide is called and the thread doesn't hang.
} }
((WPrintDialog)target).hide(); ((WPrintDialog)target).setVisible(false);
} }
}).start(); }).start();
} }

View File

@ -74,7 +74,7 @@ public class WToolkit extends SunToolkit implements Runnable {
WClipboard clipboard; WClipboard clipboard;
// cache of font peers // cache of font peers
private Hashtable cacheFontPeer; private Hashtable<String,FontPeer> cacheFontPeer;
// Windows properties // Windows properties
private WDesktopProperties wprops; private WDesktopProperties wprops;
@ -110,10 +110,10 @@ public class WToolkit extends SunToolkit implements Runnable {
log.fine("Win version: " + getWindowsVersion()); log.fine("Win version: " + getWindowsVersion());
} }
java.security.AccessController.doPrivileged( AccessController.doPrivileged(
new java.security.PrivilegedAction() new PrivilegedAction <Void> ()
{ {
public Object run() { public Void run() {
String browserProp = System.getProperty("browser"); String browserProp = System.getProperty("browser");
if (browserProp != null && browserProp.equals("sun.plugin")) { if (browserProp != null && browserProp.equals("sun.plugin")) {
disableCustomPalette(); disableCustomPalette();
@ -261,8 +261,8 @@ public class WToolkit extends SunToolkit implements Runnable {
} }
private final void registerShutdownHook() { private final void registerShutdownHook() {
AccessController.doPrivileged(new PrivilegedAction() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Object run() { public Void run() {
ThreadGroup currentTG = ThreadGroup currentTG =
Thread.currentThread().getThreadGroup(); Thread.currentThread().getThreadGroup();
ThreadGroup parentTG = currentTG.getParent(); ThreadGroup parentTG = currentTG.getParent();
@ -399,6 +399,7 @@ public class WToolkit extends SunToolkit implements Runnable {
return peer; return peer;
} }
@SuppressWarnings("deprecation")
public void disableBackgroundErase(Canvas canvas) { public void disableBackgroundErase(Canvas canvas) {
WCanvasPeer peer = (WCanvasPeer)canvas.getPeer(); WCanvasPeer peer = (WCanvasPeer)canvas.getPeer();
if (peer == null) { if (peer == null) {
@ -592,7 +593,7 @@ public class WToolkit extends SunToolkit implements Runnable {
FontPeer retval = null; FontPeer retval = null;
String lcName = name.toLowerCase(); String lcName = name.toLowerCase();
if (null != cacheFontPeer) { if (null != cacheFontPeer) {
retval = (FontPeer)cacheFontPeer.get(lcName + style); retval = cacheFontPeer.get(lcName + style);
if (null != retval) { if (null != retval) {
return retval; return retval;
} }
@ -600,7 +601,7 @@ public class WToolkit extends SunToolkit implements Runnable {
retval = new WFontPeer(name, style); retval = new WFontPeer(name, style);
if (retval != null) { if (retval != null) {
if (null == cacheFontPeer) { if (null == cacheFontPeer) {
cacheFontPeer = new Hashtable(5, (float)0.9); cacheFontPeer = new Hashtable<>(5, 0.9f);
} }
if (null != cacheFontPeer) { if (null != cacheFontPeer) {
cacheFontPeer.put(lcName + style, retval); cacheFontPeer.put(lcName + style, retval);
@ -698,7 +699,9 @@ public class WToolkit extends SunToolkit implements Runnable {
/** /**
* Returns a style map for the input method highlight. * 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); return WInputMethod.mapInputMethodHighlight(highlight);
} }
@ -968,12 +971,14 @@ public class WToolkit extends SunToolkit implements Runnable {
return !Win32GraphicsEnvironment.isDWMCompositionEnabled(); return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
} }
@SuppressWarnings("deprecation")
public void grab(Window w) { public void grab(Window w) {
if (w.getPeer() != null) { if (w.getPeer() != null) {
((WWindowPeer)w.getPeer()).grab(); ((WWindowPeer)w.getPeer()).grab();
} }
} }
@SuppressWarnings("deprecation")
public void ungrab(Window w) { public void ungrab(Window w) {
if (w.getPeer() != null) { if (w.getPeer() != null) {
((WWindowPeer)w.getPeer()).ungrab(); ((WWindowPeer)w.getPeer()).ungrab();

View File

@ -92,7 +92,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
} }
// WComponentPeer overrides // WComponentPeer overrides
@SuppressWarnings("unchecked")
protected void disposeImpl() { protected void disposeImpl() {
AppContext appContext = SunToolkit.targetToAppContext(target); AppContext appContext = SunToolkit.targetToAppContext(target);
synchronized (appContext) { synchronized (appContext) {
@ -378,6 +378,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
return modalBlocker != null; return modalBlocker != null;
} }
@SuppressWarnings("deprecation")
public void setModalBlocked(Dialog dialog, boolean blocked) { public void setModalBlocked(Dialog dialog, boolean blocked) {
synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
{ {
@ -417,6 +418,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* The list is sorted by the time of activation, so the latest * The list is sorted by the time of activation, so the latest
* active window is always at the end. * active window is always at the end.
*/ */
@SuppressWarnings("unchecked")
public static long[] getActiveWindowHandles() { public static long[] getActiveWindowHandles() {
AppContext appContext = AppContext.getAppContext(); AppContext appContext = AppContext.getAppContext();
synchronized (appContext) { synchronized (appContext) {
@ -571,6 +573,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
super.print(g); super.print(g);
} }
@SuppressWarnings("deprecation")
private void replaceSurfaceDataRecursively(Component c) { private void replaceSurfaceDataRecursively(Component c) {
if (c instanceof Container) { if (c instanceof Container) {
for (Component child : ((Container)c).getComponents()) { for (Component child : ((Container)c).getComponents()) {
@ -691,13 +694,13 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
// its shape only. To restore the correct visual appearance // its shape only. To restore the correct visual appearance
// of the window (i.e. w/ the correct shape) we have to reset // of the window (i.e. w/ the correct shape) we have to reset
// the shape. // the shape.
Shape shape = ((Window)target).getShape(); Shape shape = target.getShape();
if (shape != null) { if (shape != null) {
((Window)target).setShape(shape); target.setShape(shape);
} }
} }
if (((Window)target).isVisible()) { if (target.isVisible()) {
updateWindow(true); updateWindow(true);
} }
} }
@ -730,6 +733,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* then the method registers ActiveWindowListener, GuiDisposedListener listeners; * then the method registers ActiveWindowListener, GuiDisposedListener listeners;
* it executes the initilialization only once per AppContext. * it executes the initilialization only once per AppContext.
*/ */
@SuppressWarnings("unchecked")
private static void initActiveWindowsTracking(Window w) { private static void initActiveWindowsTracking(Window w) {
AppContext appContext = AppContext.getAppContext(); AppContext appContext = AppContext.getAppContext();
synchronized (appContext) { synchronized (appContext) {
@ -774,6 +778,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* updates the list of active windows per AppContext, so the latest active * 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. * 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 { private static class ActiveWindowListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) { public void propertyChange(PropertyChangeEvent e) {
Window w = (Window)e.getNewValue(); Window w = (Window)e.getNewValue();