提交 5614b91b 编写于 作者: A art

8022184: Fix static , Raw warnings in classes belonging to java.awt

Reviewed-by: art, anthony
Contributed-by: NSrikalyan Chandrashekar <srikalyan.chandrashekar@oracle.com>
上级 f817ceff
...@@ -67,7 +67,7 @@ import java.lang.reflect.Field; ...@@ -67,7 +67,7 @@ import java.lang.reflect.Field;
public class AWTKeyStroke implements Serializable { public class AWTKeyStroke implements Serializable {
static final long serialVersionUID = -6430539691155161871L; static final long serialVersionUID = -6430539691155161871L;
private static Map modifierKeywords; private static Map<String, Integer> modifierKeywords;
/** /**
* Associates VK_XXX (as a String) with code (as Integer). This is * Associates VK_XXX (as a String) with code (as Integer). This is
* done to avoid the overhead of the reflective call to find the * done to avoid the overhead of the reflective call to find the
...@@ -85,8 +85,8 @@ public class AWTKeyStroke implements Serializable { ...@@ -85,8 +85,8 @@ public class AWTKeyStroke implements Serializable {
* AWTKeyStroke class. * AWTKeyStroke class.
* Must be called under locked AWTKeyStro * Must be called under locked AWTKeyStro
*/ */
private static Class getAWTKeyStrokeClass() { private static Class<AWTKeyStroke> getAWTKeyStrokeClass() {
Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); Class<AWTKeyStroke> clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
if (clazz == null) { if (clazz == null) {
clazz = AWTKeyStroke.class; clazz = AWTKeyStroke.class;
AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class); AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
...@@ -182,7 +182,7 @@ public class AWTKeyStroke implements Serializable { ...@@ -182,7 +182,7 @@ public class AWTKeyStroke implements Serializable {
throw new IllegalArgumentException("subclass cannot be null"); throw new IllegalArgumentException("subclass cannot be null");
} }
synchronized (AWTKeyStroke.class) { synchronized (AWTKeyStroke.class) {
Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); Class<AWTKeyStroke> keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){ if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){
// Already registered // Already registered
return; return;
...@@ -229,8 +229,8 @@ public class AWTKeyStroke implements Serializable { ...@@ -229,8 +229,8 @@ public class AWTKeyStroke implements Serializable {
*/ */
private static Constructor getCtor(final Class clazz) private static Constructor getCtor(final Class clazz)
{ {
Object ctor = AccessController.doPrivileged(new PrivilegedAction() { Constructor ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor>() {
public Object run() { public Constructor run() {
try { try {
Constructor ctor = clazz.getDeclaredConstructor((Class[]) null); Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
if (ctor != null) { if (ctor != null) {
...@@ -249,17 +249,17 @@ public class AWTKeyStroke implements Serializable { ...@@ -249,17 +249,17 @@ public class AWTKeyStroke implements Serializable {
private static synchronized AWTKeyStroke getCachedStroke private static synchronized AWTKeyStroke getCachedStroke
(char keyChar, int keyCode, int modifiers, boolean onKeyRelease) (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
{ {
Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY); Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY); AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);
if (cache == null) { if (cache == null) {
cache = new HashMap(); cache = new HashMap<>();
AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache); AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache);
} }
if (cacheKey == null) { if (cacheKey == null) {
try { try {
Class clazz = getAWTKeyStrokeClass(); Class<AWTKeyStroke> clazz = getAWTKeyStrokeClass();
cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null); cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null);
AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey); AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey);
} catch (InstantiationException e) { } catch (InstantiationException e) {
...@@ -513,7 +513,7 @@ public class AWTKeyStroke implements Serializable { ...@@ -513,7 +513,7 @@ public class AWTKeyStroke implements Serializable {
synchronized (AWTKeyStroke.class) { synchronized (AWTKeyStroke.class) {
if (modifierKeywords == null) { if (modifierKeywords == null) {
Map uninitializedMap = new HashMap(8, 1.0f); Map<String, Integer> uninitializedMap = new HashMap<>(8, 1.0f);
uninitializedMap.put("shift", uninitializedMap.put("shift",
Integer.valueOf(InputEvent.SHIFT_DOWN_MASK Integer.valueOf(InputEvent.SHIFT_DOWN_MASK
|InputEvent.SHIFT_MASK)); |InputEvent.SHIFT_MASK));
...@@ -861,12 +861,12 @@ public class AWTKeyStroke implements Serializable { ...@@ -861,12 +861,12 @@ public class AWTKeyStroke implements Serializable {
} }
class VKCollection { class VKCollection {
Map code2name; Map<Integer, String> code2name;
Map name2code; Map<String, Integer> name2code;
public VKCollection() { public VKCollection() {
code2name = new HashMap(); code2name = new HashMap<>();
name2code = new HashMap(); name2code = new HashMap<>();
} }
public synchronized void put(String name, Integer code) { public synchronized void put(String name, Integer code) {
......
...@@ -66,7 +66,7 @@ public class CardLayout implements LayoutManager2, ...@@ -66,7 +66,7 @@ public class CardLayout implements LayoutManager2,
* pairs of components and their names. * pairs of components and their names.
* @see java.util.Vector * @see java.util.Vector
*/ */
Vector vector = new Vector(); Vector<Card> vector = new Vector<>();
/* /*
* A pair of Component and String that represents its name. * A pair of Component and String that represents its name.
...@@ -570,10 +570,10 @@ public class CardLayout implements LayoutManager2, ...@@ -570,10 +570,10 @@ public class CardLayout implements LayoutManager2,
if (f.defaulted("vector")) { if (f.defaulted("vector")) {
// pre-1.4 stream // pre-1.4 stream
Hashtable tab = (Hashtable)f.get("tab", null); Hashtable<String, Component> tab = (Hashtable)f.get("tab", null);
vector = new Vector(); vector = new Vector<>();
if (tab != null && !tab.isEmpty()) { if (tab != null && !tab.isEmpty()) {
for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) { for (Enumeration<String> e = tab.keys() ; e.hasMoreElements() ; ) {
String key = (String)e.nextElement(); String key = (String)e.nextElement();
Component comp = (Component)tab.get(key); Component comp = (Component)tab.get(key);
vector.add(new Card(key, comp)); vector.add(new Card(key, comp));
...@@ -594,7 +594,7 @@ public class CardLayout implements LayoutManager2, ...@@ -594,7 +594,7 @@ public class CardLayout implements LayoutManager2,
private void writeObject(ObjectOutputStream s) private void writeObject(ObjectOutputStream s)
throws IOException throws IOException
{ {
Hashtable tab = new Hashtable(); Hashtable<String, Component> tab = new Hashtable<>();
int ncomponents = vector.size(); int ncomponents = vector.size();
for (int i = 0; i < ncomponents; i++) { for (int i = 0; i < ncomponents; i++) {
Card card = (Card)vector.get(i); Card card = (Card)vector.get(i);
......
...@@ -85,7 +85,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy ...@@ -85,7 +85,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
* list should be reused if possible. * list should be reused if possible.
*/ */
transient private Container cachedRoot; transient private Container cachedRoot;
transient private List cachedCycle; transient private List<Component> cachedCycle;
/* /*
* We suppose to use getFocusTraversalCycle & getComponentIndex methods in order * We suppose to use getFocusTraversalCycle & getComponentIndex methods in order
...@@ -111,7 +111,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy ...@@ -111,7 +111,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
return cycle.indexOf(aComponent); return cycle.indexOf(aComponent);
} }
private void enumerateCycle(Container container, List cycle) { private void enumerateCycle(Container container, List<Component> cycle) {
if (!(container.isVisible() && container.isDisplayable())) { if (!(container.isVisible() && container.isDisplayable())) {
return; return;
} }
......
...@@ -808,13 +808,13 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -808,13 +808,13 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
} }
} }
boolean stopPostProcessing = false; boolean stopPostProcessing = false;
java.util.List processors = getKeyEventPostProcessors(); java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
if (processors != null) { if (processors != null) {
for (java.util.Iterator iter = processors.iterator(); for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
!stopPostProcessing && iter.hasNext(); ) !stopPostProcessing && iter.hasNext(); )
{ {
stopPostProcessing = (((KeyEventPostProcessor)(iter.next())). stopPostProcessing = iter.next().
postProcessKeyEvent(e)); postProcessKeyEvent(e);
} }
} }
if (!stopPostProcessing) { if (!stopPostProcessing) {
...@@ -1059,12 +1059,12 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -1059,12 +1059,12 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
return true; return true;
} }
java.util.List dispatchers = getKeyEventDispatchers(); java.util.List<KeyEventDispatcher> dispatchers = getKeyEventDispatchers();
if (dispatchers != null) { if (dispatchers != null) {
for (java.util.Iterator iter = dispatchers.iterator(); for (java.util.Iterator<KeyEventDispatcher> iter = dispatchers.iterator();
iter.hasNext(); ) iter.hasNext(); )
{ {
if (((KeyEventDispatcher)(iter.next())). if (iter.next().
dispatchKeyEvent(ke)) dispatchKeyEvent(ke))
{ {
return true; return true;
...@@ -1131,7 +1131,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -1131,7 +1131,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(), oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(),
stroke.getModifiers(), stroke.getModifiers(),
!stroke.isOnKeyRelease()); !stroke.isOnKeyRelease());
Set toTest; Set<AWTKeyStroke> toTest;
boolean contains, containsOpp; boolean contains, containsOpp;
toTest = focusedComponent.getFocusTraversalKeys( toTest = focusedComponent.getFocusTraversalKeys(
......
...@@ -41,7 +41,7 @@ class GradientPaintContext implements PaintContext { ...@@ -41,7 +41,7 @@ class GradientPaintContext implements PaintContext {
new DirectColorModel(24, 0x000000ff, 0x0000ff00, 0x00ff0000); new DirectColorModel(24, 0x000000ff, 0x0000ff00, 0x00ff0000);
static ColorModel cachedModel; static ColorModel cachedModel;
static WeakReference cached; static WeakReference<Raster> cached;
static synchronized Raster getCachedRaster(ColorModel cm, int w, int h) { static synchronized Raster getCachedRaster(ColorModel cm, int w, int h) {
if (cm == cachedModel) { if (cm == cachedModel) {
...@@ -76,7 +76,7 @@ class GradientPaintContext implements PaintContext { ...@@ -76,7 +76,7 @@ class GradientPaintContext implements PaintContext {
} }
} }
cachedModel = cm; cachedModel = cm;
cached = new WeakReference(ras); cached = new WeakReference<>(ras);
} }
double x1; double x1;
......
...@@ -95,18 +95,18 @@ public abstract class GraphicsEnvironment { ...@@ -95,18 +95,18 @@ public abstract class GraphicsEnvironment {
String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null)); String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
try { try {
// long t0 = System.currentTimeMillis(); // long t0 = System.currentTimeMillis();
Class geCls; Class<GraphicsEnvironment> geCls;
try { try {
// First we try if the bootclassloader finds the requested // First we try if the bootclassloader finds the requested
// class. This way we can avoid to run in a privileged block. // class. This way we can avoid to run in a privileged block.
geCls = Class.forName(nm); geCls = (Class<GraphicsEnvironment>)Class.forName(nm);
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
// If the bootclassloader fails, we try again with the // If the bootclassloader fails, we try again with the
// application classloader. // application classloader.
ClassLoader cl = ClassLoader.getSystemClassLoader(); ClassLoader cl = ClassLoader.getSystemClassLoader();
geCls = Class.forName(nm, true, cl); geCls = (Class<GraphicsEnvironment>)Class.forName(nm, true, cl);
} }
ge = (GraphicsEnvironment) geCls.newInstance(); ge = geCls.newInstance();
// long t1 = System.currentTimeMillis(); // long t1 = System.currentTimeMillis();
// System.out.println("GE creation took " + (t1-t0)+ "ms."); // System.out.println("GE creation took " + (t1-t0)+ "ms.");
if (isHeadless()) { if (isHeadless()) {
...@@ -161,7 +161,7 @@ public abstract class GraphicsEnvironment { ...@@ -161,7 +161,7 @@ public abstract class GraphicsEnvironment {
private static boolean getHeadlessProperty() { private static boolean getHeadlessProperty() {
if (headless == null) { if (headless == null) {
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<Object>() {
public Object run() { public Object run() {
String nm = System.getProperty("java.awt.headless"); String nm = System.getProperty("java.awt.headless");
......
...@@ -348,7 +348,7 @@ public abstract class KeyboardFocusManager ...@@ -348,7 +348,7 @@ public abstract class KeyboardFocusManager
* Component of those Windows that has no such array of its own explicitly * Component of those Windows that has no such array of its own explicitly
* set. * set.
*/ */
private Set[] defaultFocusTraversalKeys = new Set[4]; private Set<AWTKeyStroke>[] defaultFocusTraversalKeys = new Set[4];
/** /**
* The current focus cycle root. If the focus owner is itself a focus cycle * The current focus cycle root. If the focus owner is itself a focus cycle
...@@ -376,7 +376,7 @@ public abstract class KeyboardFocusManager ...@@ -376,7 +376,7 @@ public abstract class KeyboardFocusManager
* KeyEventDispatchers are registered, this field may be null or refer to * KeyEventDispatchers are registered, this field may be null or refer to
* a List of length 0. * a List of length 0.
*/ */
private java.util.LinkedList keyEventDispatchers; private java.util.LinkedList<KeyEventDispatcher> keyEventDispatchers;
/** /**
* This KeyboardFocusManager's KeyEventPostProcessor chain. The List does * This KeyboardFocusManager's KeyEventPostProcessor chain. The List does
...@@ -385,12 +385,12 @@ public abstract class KeyboardFocusManager ...@@ -385,12 +385,12 @@ public abstract class KeyboardFocusManager
* If no other KeyEventPostProcessors are registered, this field may be * If no other KeyEventPostProcessors are registered, this field may be
* null or refer to a List of length 0. * null or refer to a List of length 0.
*/ */
private java.util.LinkedList keyEventPostProcessors; private java.util.LinkedList<KeyEventPostProcessor> keyEventPostProcessors;
/** /**
* Maps Windows to those Windows' most recent focus owners. * Maps Windows to those Windows' most recent focus owners.
*/ */
private static java.util.Map mostRecentFocusOwners = new WeakHashMap(); private static java.util.Map<Window, WeakReference<Component>> mostRecentFocusOwners = new WeakHashMap<>();
/** /**
* We cache the permission used to verify that the calling thread is * We cache the permission used to verify that the calling thread is
...@@ -431,7 +431,7 @@ public abstract class KeyboardFocusManager ...@@ -431,7 +431,7 @@ public abstract class KeyboardFocusManager
*/ */
public KeyboardFocusManager() { public KeyboardFocusManager() {
for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) { for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) {
Set work_set = new HashSet(); Set<AWTKeyStroke> work_set = new HashSet<>();
for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) { for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) {
work_set.add(defaultFocusTraversalKeyStrokes[i][j]); work_set.add(defaultFocusTraversalKeyStrokes[i][j]);
} }
...@@ -1125,7 +1125,7 @@ public abstract class KeyboardFocusManager ...@@ -1125,7 +1125,7 @@ public abstract class KeyboardFocusManager
throw new IllegalArgumentException("cannot set null Set of default focus traversal keys"); throw new IllegalArgumentException("cannot set null Set of default focus traversal keys");
} }
Set oldKeys; Set<AWTKeyStroke> oldKeys;
synchronized (this) { synchronized (this) {
for (AWTKeyStroke keystroke : keystrokes) { for (AWTKeyStroke keystroke : keystrokes) {
...@@ -1153,7 +1153,7 @@ public abstract class KeyboardFocusManager ...@@ -1153,7 +1153,7 @@ public abstract class KeyboardFocusManager
oldKeys = defaultFocusTraversalKeys[id]; oldKeys = defaultFocusTraversalKeys[id];
defaultFocusTraversalKeys[id] = defaultFocusTraversalKeys[id] =
Collections.unmodifiableSet(new HashSet(keystrokes)); Collections.unmodifiableSet(new HashSet<>(keystrokes));
} }
firePropertyChange(defaultFocusTraversalKeyPropertyNames[id], firePropertyChange(defaultFocusTraversalKeyPropertyNames[id],
...@@ -1699,7 +1699,7 @@ public abstract class KeyboardFocusManager ...@@ -1699,7 +1699,7 @@ public abstract class KeyboardFocusManager
if (dispatcher != null) { if (dispatcher != null) {
synchronized (this) { synchronized (this) {
if (keyEventDispatchers == null) { if (keyEventDispatchers == null) {
keyEventDispatchers = new java.util.LinkedList(); keyEventDispatchers = new java.util.LinkedList<>();
} }
keyEventDispatchers.add(dispatcher); keyEventDispatchers.add(dispatcher);
} }
...@@ -1787,7 +1787,7 @@ public abstract class KeyboardFocusManager ...@@ -1787,7 +1787,7 @@ public abstract class KeyboardFocusManager
if (processor != null) { if (processor != null) {
synchronized (this) { synchronized (this) {
if (keyEventPostProcessors == null) { if (keyEventPostProcessors == null) {
keyEventPostProcessors = new java.util.LinkedList(); keyEventPostProcessors = new java.util.LinkedList<>();
} }
keyEventPostProcessors.add(processor); keyEventPostProcessors.add(processor);
} }
...@@ -1865,9 +1865,9 @@ public abstract class KeyboardFocusManager ...@@ -1865,9 +1865,9 @@ public abstract class KeyboardFocusManager
// of Component.parent fields. Since WeakHasMap refers to its // of Component.parent fields. Since WeakHasMap refers to its
// values strongly, we need to break the strong link from the // values strongly, we need to break the strong link from the
// value (component) back to its key (window). // value (component) back to its key (window).
WeakReference weakValue = null; WeakReference<Component> weakValue = null;
if (component != null) { if (component != null) {
weakValue = new WeakReference(component); weakValue = new WeakReference<>(component);
} }
mostRecentFocusOwners.put(window, weakValue); mostRecentFocusOwners.put(window, weakValue);
} }
...@@ -1906,7 +1906,7 @@ public abstract class KeyboardFocusManager ...@@ -1906,7 +1906,7 @@ public abstract class KeyboardFocusManager
* javax.swing.JComponent.runInputVerifier() using reflection. * javax.swing.JComponent.runInputVerifier() using reflection.
*/ */
static synchronized Component getMostRecentFocusOwner(Window window) { static synchronized Component getMostRecentFocusOwner(Window window) {
WeakReference weakValue = WeakReference<Component> weakValue =
(WeakReference)mostRecentFocusOwners.get(window); (WeakReference)mostRecentFocusOwners.get(window);
return weakValue == null ? null : (Component)weakValue.get(); return weakValue == null ? null : (Component)weakValue.get();
} }
...@@ -2649,11 +2649,11 @@ public abstract class KeyboardFocusManager ...@@ -2649,11 +2649,11 @@ public abstract class KeyboardFocusManager
Component lastFocusOwner = null; Component lastFocusOwner = null;
Component currentFocusOwner = null; Component currentFocusOwner = null;
for (Iterator iter = localLightweightRequests.iterator(); iter.hasNext(); ) { for (Iterator<KeyboardFocusManager.LightweightFocusRequest> iter = localLightweightRequests.iterator(); iter.hasNext(); ) {
currentFocusOwner = manager.getGlobalFocusOwner(); currentFocusOwner = manager.getGlobalFocusOwner();
LightweightFocusRequest lwFocusRequest = LightweightFocusRequest lwFocusRequest =
(LightweightFocusRequest)iter.next(); iter.next();
/* /*
* WARNING: This is based on DKFM's logic solely! * WARNING: This is based on DKFM's logic solely!
...@@ -2978,12 +2978,12 @@ public abstract class KeyboardFocusManager ...@@ -2978,12 +2978,12 @@ public abstract class KeyboardFocusManager
if (hwFocusRequest != null) { if (hwFocusRequest != null) {
heavyweightRequests.removeFirst(); heavyweightRequests.removeFirst();
if (hwFocusRequest.lightweightRequests != null) { if (hwFocusRequest.lightweightRequests != null) {
for (Iterator lwIter = hwFocusRequest.lightweightRequests. for (Iterator<KeyboardFocusManager.LightweightFocusRequest> lwIter = hwFocusRequest.lightweightRequests.
iterator(); iterator();
lwIter.hasNext(); ) lwIter.hasNext(); )
{ {
manager.dequeueKeyEvents manager.dequeueKeyEvents
(-1, ((LightweightFocusRequest)lwIter.next()). (-1, lwIter.next().
component); component);
} }
} }
...@@ -3063,8 +3063,8 @@ public abstract class KeyboardFocusManager ...@@ -3063,8 +3063,8 @@ public abstract class KeyboardFocusManager
// Accessor to private field isProxyActive of KeyEvent // Accessor to private field isProxyActive of KeyEvent
private static boolean isProxyActiveImpl(KeyEvent e) { private static boolean isProxyActiveImpl(KeyEvent e) {
if (proxyActive == null) { if (proxyActive == null) {
proxyActive = (Field) AccessController.doPrivileged(new PrivilegedAction() { proxyActive = AccessController.doPrivileged(new PrivilegedAction<Field>() {
public Object run() { public Field run() {
Field field = null; Field field = null;
try { try {
field = KeyEvent.class.getDeclaredField("isProxyActive"); field = KeyEvent.class.getDeclaredField("isProxyActive");
......
...@@ -49,7 +49,7 @@ class SequencedEvent extends AWTEvent implements ActiveEvent { ...@@ -49,7 +49,7 @@ class SequencedEvent extends AWTEvent implements ActiveEvent {
private static final int ID = private static final int ID =
java.awt.event.FocusEvent.FOCUS_LAST + 1; java.awt.event.FocusEvent.FOCUS_LAST + 1;
private static final LinkedList list = new LinkedList(); private static final LinkedList<SequencedEvent> list = new LinkedList<>();
private final AWTEvent nested; private final AWTEvent nested;
private AppContext appContext; private AppContext appContext;
......
...@@ -73,11 +73,11 @@ abstract class TexturePaintContext implements PaintContext { ...@@ -73,11 +73,11 @@ abstract class TexturePaintContext implements PaintContext {
WritableRaster raster = bufImg.getRaster(); WritableRaster raster = bufImg.getRaster();
ColorModel cm = bufImg.getColorModel(); ColorModel cm = bufImg.getColorModel();
int maxw = devBounds.width; int maxw = devBounds.width;
Object val = hints.get(hints.KEY_INTERPOLATION); Object val = hints.get(RenderingHints.KEY_INTERPOLATION);
boolean filter = boolean filter =
(val == null (val == null
? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY) ? (hints.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY)
: (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)); : (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
if (raster instanceof IntegerInterleavedRaster && if (raster instanceof IntegerInterleavedRaster &&
(!filter || isFilterableDCM(cm))) (!filter || isFilterableDCM(cm)))
{ {
...@@ -234,8 +234,8 @@ abstract class TexturePaintContext implements PaintContext { ...@@ -234,8 +234,8 @@ abstract class TexturePaintContext implements PaintContext {
return outRas; return outRas;
} }
private static WeakReference xrgbRasRef; private static WeakReference<Raster> xrgbRasRef;
private static WeakReference argbRasRef; private static WeakReference<Raster> argbRasRef;
synchronized static WritableRaster makeRaster(ColorModel cm, synchronized static WritableRaster makeRaster(ColorModel cm,
Raster srcRas, Raster srcRas,
...@@ -278,13 +278,13 @@ abstract class TexturePaintContext implements PaintContext { ...@@ -278,13 +278,13 @@ abstract class TexturePaintContext implements PaintContext {
return; return;
} }
if (xrgbmodel == cm) { if (xrgbmodel == cm) {
xrgbRasRef = new WeakReference(outRas); xrgbRasRef = new WeakReference<>(outRas);
} else if (argbmodel == cm) { } else if (argbmodel == cm) {
argbRasRef = new WeakReference(outRas); argbRasRef = new WeakReference<>(outRas);
} }
} }
private static WeakReference byteRasRef; private static WeakReference<Raster> byteRasRef;
synchronized static WritableRaster makeByteRaster(Raster srcRas, synchronized static WritableRaster makeByteRaster(Raster srcRas,
int w, int h) int w, int h)
...@@ -307,7 +307,7 @@ abstract class TexturePaintContext implements PaintContext { ...@@ -307,7 +307,7 @@ abstract class TexturePaintContext implements PaintContext {
if (outRas == null) { if (outRas == null) {
return; return;
} }
byteRasRef = new WeakReference(outRas); byteRasRef = new WeakReference<>(outRas);
} }
public abstract WritableRaster makeRaster(int w, int h); public abstract WritableRaster makeRaster(int w, int h);
......
...@@ -224,8 +224,8 @@ class WaitDispatchSupport implements SecondaryLoop { ...@@ -224,8 +224,8 @@ class WaitDispatchSupport implements SecondaryLoop {
// starts. Thus, the enter() method will not hang. // starts. Thus, the enter() method will not hang.
// //
// Event pump should be privileged. See 6300270. // Event pump should be privileged. See 6300270.
AccessController.doPrivileged(new PrivilegedAction() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Object run() { public Void run() {
run.run(); run.run();
return null; return null;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册