mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-13 03:45:19 +00:00
8044551: Fix raw and unchecked lint warnings in platform-specific sun.awt files
8044396: Fix raw and unchecked lint warnings in platform-specific sun.java2d.* Reviewed-by: darcy, prr
This commit is contained in:
parent
57efe4955f
commit
8538800448
@ -42,8 +42,6 @@ import sun.awt.windows.WFontConfiguration;
|
||||
import sun.font.FontManager;
|
||||
import sun.font.SunFontManager;
|
||||
import sun.font.TrueTypeFont;
|
||||
import sun.java2d.HeadlessGraphicsEnvironment;
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
|
||||
/**
|
||||
* The X11 implementation of {@link FontManager}.
|
||||
@ -56,7 +54,7 @@ public class Win32FontManager extends SunFontManager {
|
||||
|
||||
static {
|
||||
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
|
||||
public Object run() {
|
||||
String eudcFile = getEUDCFontFile();
|
||||
@ -90,7 +88,7 @@ public class Win32FontManager extends SunFontManager {
|
||||
|
||||
public Win32FontManager() {
|
||||
super();
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
|
||||
/* Register the JRE fonts so that the native platform can
|
||||
@ -227,7 +225,7 @@ public class Win32FontManager extends SunFontManager {
|
||||
final String[] dirs = getPlatformFontDirs(true);
|
||||
if (dirs.length > 1) {
|
||||
String dir = (String)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
for (int i=0; i<dirs.length; i++) {
|
||||
String path =
|
||||
@ -272,7 +270,7 @@ public class Win32FontManager extends SunFontManager {
|
||||
fontsForPrinting = null;
|
||||
}
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction() {
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
File f1 = new File(pathName);
|
||||
String[] ls = f1.list(SunFontManager.getInstance().
|
||||
|
||||
@ -172,7 +172,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
|
||||
|
||||
int max = getMaxConfigs(screen);
|
||||
int defaultPixID = getDefaultPixID(screen);
|
||||
Vector v = new Vector( max );
|
||||
Vector<GraphicsConfiguration> v = new Vector<>( max );
|
||||
if (defaultPixID == 0) {
|
||||
// Workaround for failing GDI calls
|
||||
defaultConfig = Win32GraphicsConfig.getConfig(this,
|
||||
@ -437,7 +437,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
|
||||
protected native void configDisplayMode(int screen, WindowPeer w, int width,
|
||||
int height, int bitDepth,
|
||||
int refreshRate);
|
||||
protected native void enumDisplayModes(int screen, ArrayList modes);
|
||||
protected native void enumDisplayModes(int screen, ArrayList<DisplayMode> modes);
|
||||
|
||||
@Override
|
||||
public synchronized DisplayMode getDisplayMode() {
|
||||
@ -447,12 +447,12 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
|
||||
|
||||
@Override
|
||||
public synchronized DisplayMode[] getDisplayModes() {
|
||||
ArrayList modes = new ArrayList();
|
||||
ArrayList<DisplayMode> modes = new ArrayList<>();
|
||||
enumDisplayModes(screen, modes);
|
||||
int listSize = modes.size();
|
||||
DisplayMode[] retArray = new DisplayMode[listSize];
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
retArray[i] = (DisplayMode)modes.get(i);
|
||||
retArray[i] = modes.get(i);
|
||||
}
|
||||
return retArray;
|
||||
}
|
||||
|
||||
@ -894,10 +894,10 @@ final class Win32ShellFolder2 extends ShellFolder {
|
||||
|
||||
// Icons
|
||||
|
||||
private static Map smallSystemImages = new HashMap();
|
||||
private static Map largeSystemImages = new HashMap();
|
||||
private static Map smallLinkedSystemImages = new HashMap();
|
||||
private static Map largeLinkedSystemImages = new HashMap();
|
||||
private static Map<Integer, Image> smallSystemImages = new HashMap<>();
|
||||
private static Map<Integer, Image> largeSystemImages = new HashMap<>();
|
||||
private static Map<Integer, Image> smallLinkedSystemImages = new HashMap<>();
|
||||
private static Map<Integer, Image> largeLinkedSystemImages = new HashMap<>();
|
||||
|
||||
// NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
|
||||
private static native long getIShellIcon(long pIShellFolder);
|
||||
@ -970,13 +970,13 @@ final class Win32ShellFolder2 extends ShellFolder {
|
||||
// These are cached per type (using the index in the system image list)
|
||||
int index = getIconIndex(parentIShellIcon, relativePIDL);
|
||||
if (index > 0) {
|
||||
Map imageCache;
|
||||
Map<Integer, Image> imageCache;
|
||||
if (isLink()) {
|
||||
imageCache = getLargeIcon ? largeLinkedSystemImages : smallLinkedSystemImages;
|
||||
} else {
|
||||
imageCache = getLargeIcon ? largeSystemImages : smallSystemImages;
|
||||
}
|
||||
newIcon = (Image) imageCache.get(Integer.valueOf(index));
|
||||
newIcon = imageCache.get(Integer.valueOf(index));
|
||||
if (newIcon == null) {
|
||||
long hIcon = getIcon(getAbsolutePath(), getLargeIcon);
|
||||
newIcon = makeIcon(hIcon, getLargeIcon);
|
||||
|
||||
@ -414,14 +414,14 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static List topFolderList = null;
|
||||
private static List<Win32ShellFolder2> topFolderList = null;
|
||||
static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
|
||||
boolean special1 = sf1.isSpecial();
|
||||
boolean special2 = sf2.isSpecial();
|
||||
|
||||
if (special1 || special2) {
|
||||
if (topFolderList == null) {
|
||||
ArrayList tmpTopFolderList = new ArrayList();
|
||||
ArrayList<Win32ShellFolder2> tmpTopFolderList = new ArrayList<>();
|
||||
tmpTopFolderList.add(Win32ShellFolderManager2.getPersonal());
|
||||
tmpTopFolderList.add(Win32ShellFolderManager2.getDesktop());
|
||||
tmpTopFolderList.add(Win32ShellFolderManager2.getDrives());
|
||||
|
||||
@ -29,6 +29,7 @@ import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
|
||||
@ -76,8 +77,9 @@ final class WDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startDrag(Transferable trans,
|
||||
long[] formats, Map formatMap) {
|
||||
long[] formats, Map<Long, DataFlavor> formatMap) {
|
||||
|
||||
long nativeCtxtLocal = 0;
|
||||
|
||||
@ -153,7 +155,7 @@ final class WDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||
InputEvent nativeTrigger,
|
||||
int actions,
|
||||
long[] formats,
|
||||
Map formatMap);
|
||||
Map<Long, DataFlavor> formatMap);
|
||||
|
||||
/**
|
||||
* downcall into native code
|
||||
|
||||
@ -53,7 +53,7 @@ public final class WFontConfiguration extends FontConfiguration {
|
||||
@Override
|
||||
protected void initReorderMap() {
|
||||
if (encoding.equalsIgnoreCase("windows-31j")) {
|
||||
localeMap = new Hashtable();
|
||||
localeMap = new Hashtable<>();
|
||||
/* Substitute Mincho for Gothic in this one case.
|
||||
* Note the windows fontconfig files already contain the mapping:
|
||||
* filename.MS_Mincho=MSMINCHO.TTC
|
||||
@ -67,7 +67,7 @@ public final class WFontConfiguration extends FontConfiguration {
|
||||
localeMap.put("dialoginput.italic.japanese", "MS Mincho");
|
||||
localeMap.put("dialoginput.bolditalic.japanese", "MS Mincho");
|
||||
}
|
||||
reorderMap = new HashMap();
|
||||
reorderMap = new HashMap<>();
|
||||
reorderMap.put("UTF-8.hi", "devanagari");
|
||||
reorderMap.put("windows-1255", "hebrew");
|
||||
reorderMap.put("x-windows-874", "thai");
|
||||
@ -118,7 +118,7 @@ public final class WFontConfiguration extends FontConfiguration {
|
||||
|
||||
@Override
|
||||
protected String makeAWTFontName(String platformFontName, String characterSubsetName) {
|
||||
String windowsCharset = (String) subsetCharsetMap.get(characterSubsetName);
|
||||
String windowsCharset = subsetCharsetMap.get(characterSubsetName);
|
||||
if (windowsCharset == null) {
|
||||
windowsCharset = "DEFAULT_CHARSET";
|
||||
}
|
||||
@ -127,7 +127,7 @@ public final class WFontConfiguration extends FontConfiguration {
|
||||
|
||||
@Override
|
||||
protected String getEncoding(String awtFontName, String characterSubsetName) {
|
||||
String encoding = (String) subsetEncodingMap.get(characterSubsetName);
|
||||
String encoding = subsetEncodingMap.get(characterSubsetName);
|
||||
if (encoding == null) {
|
||||
encoding = "default";
|
||||
}
|
||||
@ -174,8 +174,8 @@ public final class WFontConfiguration extends FontConfiguration {
|
||||
return fontName;
|
||||
}
|
||||
|
||||
private static HashMap subsetCharsetMap = new HashMap();
|
||||
private static HashMap subsetEncodingMap = new HashMap();
|
||||
private static HashMap<String, String> subsetCharsetMap = new HashMap<>();
|
||||
private static HashMap<String, String> subsetEncodingMap = new HashMap<>();
|
||||
private static String textInputCharset;
|
||||
|
||||
private void initTables(String defaultEncoding) {
|
||||
|
||||
@ -199,10 +199,10 @@ final class WFontMetrics extends FontMetrics {
|
||||
|
||||
native void init();
|
||||
|
||||
static Hashtable table = new Hashtable();
|
||||
static Hashtable<Font, FontMetrics> table = new Hashtable<>();
|
||||
|
||||
static FontMetrics getFontMetrics(Font font) {
|
||||
FontMetrics fm = (FontMetrics)table.get(font);
|
||||
FontMetrics fm = table.get(font);
|
||||
if (fm == null) {
|
||||
table.put(font, fm = new WFontMetrics(font));
|
||||
}
|
||||
|
||||
@ -86,26 +86,27 @@ final class WInputMethod extends InputMethodAdapter
|
||||
|
||||
// Initialize highlight mapping table
|
||||
static {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
Map<TextAttribute,Object> styles[] = new Map[4];
|
||||
HashMap<TextAttribute,Object> map;
|
||||
|
||||
// UNSELECTED_RAW_TEXT_HIGHLIGHT
|
||||
map = new HashMap(1);
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
|
||||
styles[0] = Collections.unmodifiableMap(map);
|
||||
|
||||
// SELECTED_RAW_TEXT_HIGHLIGHT
|
||||
map = new HashMap(1);
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_GRAY);
|
||||
styles[1] = Collections.unmodifiableMap(map);
|
||||
|
||||
// UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||
map = new HashMap(1);
|
||||
map = new HashMap<>(1);
|
||||
map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
|
||||
styles[2] = Collections.unmodifiableMap(map);
|
||||
|
||||
// SELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||
map = new HashMap(4);
|
||||
map = new HashMap<>(4);
|
||||
Color navyBlue = new Color(0, 0, 128);
|
||||
map.put(TextAttribute.FOREGROUND, navyBlue);
|
||||
map.put(TextAttribute.BACKGROUND, Color.white);
|
||||
|
||||
@ -843,6 +843,7 @@ public final class WToolkit extends SunToolkit implements Runnable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends DragGestureRecognizer> T
|
||||
createDragGestureRecognizer(Class<T> abstractRecognizerClass,
|
||||
DragSource ds, Component c, int srcActions,
|
||||
|
||||
@ -717,7 +717,7 @@ class D3DTextureToSurfaceTransform extends TransformBlit {
|
||||
class D3DGeneralBlit extends Blit {
|
||||
|
||||
private Blit performop;
|
||||
private WeakReference srcTmp;
|
||||
private WeakReference<SurfaceData> srcTmp;
|
||||
|
||||
D3DGeneralBlit(SurfaceType dstType,
|
||||
CompositeType compType,
|
||||
@ -739,7 +739,7 @@ class D3DGeneralBlit extends Blit {
|
||||
SurfaceData cachedSrc = null;
|
||||
if (srcTmp != null) {
|
||||
// use cached intermediate surface, if available
|
||||
cachedSrc = (SurfaceData)srcTmp.get();
|
||||
cachedSrc = srcTmp.get();
|
||||
}
|
||||
|
||||
// convert source to IntArgbPre
|
||||
@ -752,7 +752,7 @@ class D3DGeneralBlit extends Blit {
|
||||
|
||||
if (src != cachedSrc) {
|
||||
// cache the intermediate surface
|
||||
srcTmp = new WeakReference(src);
|
||||
srcTmp = new WeakReference<>(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,6 @@ import sun.awt.Win32GraphicsDevice;
|
||||
import sun.awt.windows.WWindowPeer;
|
||||
import sun.java2d.pipe.hw.ContextCapabilities;
|
||||
import sun.java2d.windows.WindowsFlags;
|
||||
import static sun.java2d.pipe.BufferedOpCodes.*;
|
||||
import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
|
||||
import sun.java2d.d3d.D3DContext.D3DContextCaps;
|
||||
|
||||
@ -383,9 +382,9 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
|
||||
}
|
||||
|
||||
private static native void enumDisplayModesNative(int screen,
|
||||
ArrayList modes);
|
||||
ArrayList<DisplayMode> modes);
|
||||
@Override
|
||||
protected void enumDisplayModes(final int screen, final ArrayList modes) {
|
||||
protected void enumDisplayModes(final int screen, final ArrayList<DisplayMode> modes) {
|
||||
D3DRenderQueue rq = D3DRenderQueue.getInstance();
|
||||
rq.lock();
|
||||
try {
|
||||
|
||||
@ -75,7 +75,7 @@ public class GDIWindowSurfaceData extends SurfaceData {
|
||||
public static final SurfaceType ThreeByteBgrGdi =
|
||||
SurfaceType.ThreeByteBgr.deriveSubType(DESC_GDI);
|
||||
|
||||
private static native void initIDs(Class xorComp);
|
||||
private static native void initIDs(Class<?> xorComp);
|
||||
|
||||
static {
|
||||
initIDs(XORComposite.class);
|
||||
|
||||
@ -201,7 +201,7 @@ public class WindowsFlags {
|
||||
|
||||
private static void initJavaFlags() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction()
|
||||
new java.security.PrivilegedAction<Object>()
|
||||
{
|
||||
public Object run() {
|
||||
magPresent = getBooleanProp(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user