提交 93792750 编写于 作者: M mcherkas

8005492: Reduce number of warnings in sun/awt/* classes

Reviewed-by: art, anthony
上级 47aaa327
...@@ -300,7 +300,7 @@ public class Button extends Component implements Accessible { ...@@ -300,7 +300,7 @@ public class Button extends Component implements Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized ActionListener[] getActionListeners() { public synchronized ActionListener[] getActionListeners() {
return (ActionListener[]) (getListeners(ActionListener.class)); return getListeners(ActionListener.class);
} }
/** /**
......
...@@ -470,7 +470,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible { ...@@ -470,7 +470,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized ItemListener[] getItemListeners() { public synchronized ItemListener[] getItemListeners() {
return (ItemListener[]) (getListeners(ItemListener.class)); return getListeners(ItemListener.class);
} }
/** /**
......
...@@ -85,7 +85,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { ...@@ -85,7 +85,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
* @see #insert(String, int) * @see #insert(String, int)
* @see #remove(String) * @see #remove(String)
*/ */
Vector pItems; Vector<String> pItems;
/** /**
* The index of the current choice for this <code>Choice</code> * The index of the current choice for this <code>Choice</code>
...@@ -129,7 +129,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { ...@@ -129,7 +129,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
*/ */
public Choice() throws HeadlessException { public Choice() throws HeadlessException {
GraphicsEnvironment.checkHeadless(); GraphicsEnvironment.checkHeadless();
pItems = new Vector(); pItems = new Vector<>();
} }
/** /**
...@@ -191,7 +191,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { ...@@ -191,7 +191,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
* be called on the toolkit thread. * be called on the toolkit thread.
*/ */
final String getItemImpl(int index) { final String getItemImpl(int index) {
return (String)pItems.elementAt(index); return pItems.elementAt(index);
} }
/** /**
...@@ -524,7 +524,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { ...@@ -524,7 +524,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized ItemListener[] getItemListeners() { public synchronized ItemListener[] getItemListeners() {
return (ItemListener[])(getListeners(ItemListener.class)); return getListeners(ItemListener.class);
} }
/** /**
......
...@@ -7287,6 +7287,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -7287,6 +7287,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
final Set<AWTKeyStroke> getFocusTraversalKeys_NoIDCheck(int id) { final Set<AWTKeyStroke> getFocusTraversalKeys_NoIDCheck(int id) {
// Okay to return Set directly because it is an unmodifiable view // Okay to return Set directly because it is an unmodifiable view
@SuppressWarnings("unchecked")
Set<AWTKeyStroke> keystrokes = (focusTraversalKeys != null) Set<AWTKeyStroke> keystrokes = (focusTraversalKeys != null)
? focusTraversalKeys[id] ? focusTraversalKeys[id]
: null; : null;
......
...@@ -161,7 +161,7 @@ public class Container extends Component { ...@@ -161,7 +161,7 @@ public class Container extends Component {
private boolean focusTraversalPolicyProvider; private boolean focusTraversalPolicyProvider;
// keeps track of the threads that are printing this component // keeps track of the threads that are printing this component
private transient Set printingThreads; private transient Set<Thread> printingThreads;
// True if there is at least one thread that's printing this component // True if there is at least one thread that's printing this component
private transient boolean printing = false; private transient boolean printing = false;
...@@ -275,7 +275,7 @@ public class Container extends Component { ...@@ -275,7 +275,7 @@ public class Container extends Component {
*/ */
public Container() { public Container() {
} }
@SuppressWarnings({"unchecked","rawtypes"})
void initializeFocusTraversalKeys() { void initializeFocusTraversalKeys() {
focusTraversalKeys = new Set[4]; focusTraversalKeys = new Set[4];
} }
...@@ -2006,7 +2006,7 @@ public class Container extends Component { ...@@ -2006,7 +2006,7 @@ public class Container extends Component {
try { try {
synchronized (getObjectLock()) { synchronized (getObjectLock()) {
if (printingThreads == null) { if (printingThreads == null) {
printingThreads = new HashSet(); printingThreads = new HashSet<>();
} }
printingThreads.add(t); printingThreads.add(t);
printing = true; printing = true;
...@@ -2148,7 +2148,7 @@ public class Container extends Component { ...@@ -2148,7 +2148,7 @@ public class Container extends Component {
* @since 1.4 * @since 1.4
*/ */
public synchronized ContainerListener[] getContainerListeners() { public synchronized ContainerListener[] getContainerListeners() {
return (ContainerListener[]) (getListeners(ContainerListener.class)); return getListeners(ContainerListener.class);
} }
/** /**
...@@ -2599,9 +2599,9 @@ public class Container extends Component { ...@@ -2599,9 +2599,9 @@ public class Container extends Component {
if (GraphicsEnvironment.isHeadless()) { if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException(); throw new HeadlessException();
} }
PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged( PointerInfo pi = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<PointerInfo>() {
public Object run() { public PointerInfo run() {
return MouseInfo.getPointerInfo(); return MouseInfo.getPointerInfo();
} }
} }
...@@ -2682,7 +2682,7 @@ public class Container extends Component { ...@@ -2682,7 +2682,7 @@ public class Container extends Component {
y - comp.y, y - comp.y,
ignoreEnabled); ignoreEnabled);
} else { } else {
comp = comp.locate(x - comp.x, y - comp.y); comp = comp.getComponentAt(x - comp.x, y - comp.y);
} }
if (comp != null && comp.visible && if (comp != null && comp.visible &&
(ignoreEnabled || comp.enabled)) (ignoreEnabled || comp.enabled))
...@@ -2700,7 +2700,7 @@ public class Container extends Component { ...@@ -2700,7 +2700,7 @@ public class Container extends Component {
y - comp.y, y - comp.y,
ignoreEnabled); ignoreEnabled);
} else { } else {
comp = comp.locate(x - comp.x, y - comp.y); comp = comp.getComponentAt(x - comp.x, y - comp.y);
} }
if (comp != null && comp.visible && if (comp != null && comp.visible &&
(ignoreEnabled || comp.enabled)) (ignoreEnabled || comp.enabled))
...@@ -4637,7 +4637,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener { ...@@ -4637,7 +4637,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
private void startListeningForOtherDrags() { private void startListeningForOtherDrags() {
//System.out.println("Adding AWTEventListener"); //System.out.println("Adding AWTEventListener");
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<Object>() {
public Object run() { public Object run() {
nativeContainer.getToolkit().addAWTEventListener( nativeContainer.getToolkit().addAWTEventListener(
LightweightDispatcher.this, LightweightDispatcher.this,
...@@ -4652,7 +4652,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener { ...@@ -4652,7 +4652,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
private void stopListeningForOtherDrags() { private void stopListeningForOtherDrags() {
//System.out.println("Removing AWTEventListener"); //System.out.println("Removing AWTEventListener");
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<Object>() {
public Object run() { public Object run() {
nativeContainer.getToolkit().removeAWTEventListener(LightweightDispatcher.this); nativeContainer.getToolkit().removeAWTEventListener(LightweightDispatcher.this);
return null; return null;
......
...@@ -1047,9 +1047,9 @@ public class Dialog extends Window { ...@@ -1047,9 +1047,9 @@ public class Dialog extends Window {
// if this dialog is toolkit-modal, the filter should be added // if this dialog is toolkit-modal, the filter should be added
// to all EDTs (for all AppContexts) // to all EDTs (for all AppContexts)
if (modalityType == ModalityType.TOOLKIT_MODAL) { if (modalityType == ModalityType.TOOLKIT_MODAL) {
Iterator it = AppContext.getAppContexts().iterator(); Iterator<AppContext> it = AppContext.getAppContexts().iterator();
while (it.hasNext()) { while (it.hasNext()) {
AppContext appContext = (AppContext)it.next(); AppContext appContext = it.next();
if (appContext == showAppContext) { if (appContext == showAppContext) {
continue; continue;
} }
...@@ -1084,9 +1084,9 @@ public class Dialog extends Window { ...@@ -1084,9 +1084,9 @@ public class Dialog extends Window {
// if this dialog is toolkit-modal, its filter must be removed // if this dialog is toolkit-modal, its filter must be removed
// from all EDTs (for all AppContexts) // from all EDTs (for all AppContexts)
if (modalityType == ModalityType.TOOLKIT_MODAL) { if (modalityType == ModalityType.TOOLKIT_MODAL) {
Iterator it = AppContext.getAppContexts().iterator(); Iterator<AppContext> it = AppContext.getAppContexts().iterator();
while (it.hasNext()) { while (it.hasNext()) {
AppContext appContext = (AppContext)it.next(); AppContext appContext = it.next();
if (appContext == showAppContext) { if (appContext == showAppContext) {
continue; continue;
} }
...@@ -1396,7 +1396,7 @@ public class Dialog extends Window { ...@@ -1396,7 +1396,7 @@ public class Dialog extends Window {
if (d.shouldBlock(this)) { if (d.shouldBlock(this)) {
Window w = d; Window w = d;
while ((w != null) && (w != this)) { while ((w != null) && (w != this)) {
w = (Window)(w.getOwner_NoClientCode()); w = w.getOwner_NoClientCode();
} }
if ((w == this) || !shouldBlock(d) || (modalityType.compareTo(d.getModalityType()) < 0)) { if ((w == this) || !shouldBlock(d) || (modalityType.compareTo(d.getModalityType()) < 0)) {
blockers.add(d); blockers.add(d);
...@@ -1611,7 +1611,7 @@ public class Dialog extends Window { ...@@ -1611,7 +1611,7 @@ public class Dialog extends Window {
setModal(modal); setModal(modal);
} }
blockedWindows = new IdentityArrayList(); blockedWindows = new IdentityArrayList<>();
} }
/* /*
......
...@@ -353,7 +353,7 @@ public class Frame extends Window implements MenuContainer { ...@@ -353,7 +353,7 @@ public class Frame extends Window implements MenuContainer {
* @serial * @serial
* @see java.awt.Window#ownedWindowList * @see java.awt.Window#ownedWindowList
*/ */
Vector ownedWindows; Vector<Window> ownedWindows;
private static final String base = "frame"; private static final String base = "frame";
private static int nameCounter = 0; private static int nameCounter = 0;
...@@ -1242,7 +1242,7 @@ public class Frame extends Window implements MenuContainer { ...@@ -1242,7 +1242,7 @@ public class Frame extends Window implements MenuContainer {
// //
if (ownedWindows != null) { if (ownedWindows != null) {
for (int i = 0; i < ownedWindows.size(); i++) { for (int i = 0; i < ownedWindows.size(); i++) {
connectOwnedWindow((Window) ownedWindows.elementAt(i)); connectOwnedWindow(ownedWindows.elementAt(i));
} }
ownedWindows = null; ownedWindows = null;
} }
......
...@@ -416,7 +416,7 @@ public abstract class KeyboardFocusManager ...@@ -416,7 +416,7 @@ public abstract class KeyboardFocusManager
} }
} }
static Set initFocusTraversalKeysSet(String value, Set targetSet) { static Set<AWTKeyStroke> initFocusTraversalKeysSet(String value, Set<AWTKeyStroke> targetSet) {
StringTokenizer tokens = new StringTokenizer(value, ","); StringTokenizer tokens = new StringTokenizer(value, ",");
while (tokens.hasMoreTokens()) { while (tokens.hasMoreTokens()) {
targetSet.add(AWTKeyStroke.getAWTKeyStroke(tokens.nextToken())); targetSet.add(AWTKeyStroke.getAWTKeyStroke(tokens.nextToken()));
......
...@@ -1012,7 +1012,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible { ...@@ -1012,7 +1012,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized AdjustmentListener[] getAdjustmentListeners() { public synchronized AdjustmentListener[] getAdjustmentListeners() {
return (AdjustmentListener[])(getListeners(AdjustmentListener.class)); return getListeners(AdjustmentListener.class);
} }
/** /**
......
...@@ -123,7 +123,7 @@ public class TextArea extends TextComponent { ...@@ -123,7 +123,7 @@ public class TextArea extends TextComponent {
* Cache the Sets of forward and backward traversal keys so we need not * Cache the Sets of forward and backward traversal keys so we need not
* look them up each time. * look them up each time.
*/ */
private static Set forwardTraversalKeys, backwardTraversalKeys; private static Set<AWTKeyStroke> forwardTraversalKeys, backwardTraversalKeys;
/* /*
* JDK 1.1 serialVersionUID * JDK 1.1 serialVersionUID
...@@ -143,10 +143,10 @@ public class TextArea extends TextComponent { ...@@ -143,10 +143,10 @@ public class TextArea extends TextComponent {
} }
forwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet( forwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet(
"ctrl TAB", "ctrl TAB",
new HashSet()); new HashSet<AWTKeyStroke>());
backwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet( backwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet(
"ctrl shift TAB", "ctrl shift TAB",
new HashSet()); new HashSet<AWTKeyStroke>());
} }
/** /**
......
...@@ -606,7 +606,7 @@ public class TextComponent extends Component implements Accessible { ...@@ -606,7 +606,7 @@ public class TextComponent extends Component implements Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized TextListener[] getTextListeners() { public synchronized TextListener[] getTextListeners() {
return (TextListener[])(getListeners(TextListener.class)); return getListeners(TextListener.class);
} }
/** /**
......
...@@ -507,7 +507,7 @@ public class TextField extends TextComponent { ...@@ -507,7 +507,7 @@ public class TextField extends TextComponent {
* @since 1.4 * @since 1.4
*/ */
public synchronized ActionListener[] getActionListeners() { public synchronized ActionListener[] getActionListeners() {
return (ActionListener[])(getListeners(ActionListener.class)); return getListeners(ActionListener.class);
} }
/** /**
......
...@@ -863,7 +863,7 @@ public abstract class Toolkit { ...@@ -863,7 +863,7 @@ public abstract class Toolkit {
new java.security.PrivilegedAction<Void>() { new java.security.PrivilegedAction<Void>() {
public Void run() { public Void run() {
String nm = null; String nm = null;
Class cls = null; Class<?> cls = null;
try { try {
nm = System.getProperty("awt.toolkit"); nm = System.getProperty("awt.toolkit");
try { try {
......
...@@ -441,7 +441,7 @@ public class Window extends Container implements Accessible { ...@@ -441,7 +441,7 @@ public class Window extends Container implements Accessible {
transient Object anchor = new Object(); transient Object anchor = new Object();
static class WindowDisposerRecord implements sun.java2d.DisposerRecord { static class WindowDisposerRecord implements sun.java2d.DisposerRecord {
final WeakReference<Window> owner; final WeakReference<Window> owner;
final WeakReference weakThis; final WeakReference<Window> weakThis;
final WeakReference<AppContext> context; final WeakReference<AppContext> context;
WindowDisposerRecord(AppContext context, Window victim) { WindowDisposerRecord(AppContext context, Window victim) {
owner = new WeakReference<Window>(victim.getOwner()); owner = new WeakReference<Window>(victim.getOwner());
...@@ -1542,6 +1542,7 @@ public class Window extends Container implements Accessible { ...@@ -1542,6 +1542,7 @@ public class Window extends Container implements Accessible {
private static Window[] getWindows(AppContext appContext) { private static Window[] getWindows(AppContext appContext) {
synchronized (Window.class) { synchronized (Window.class) {
Window realCopy[]; Window realCopy[];
@SuppressWarnings("unchecked")
Vector<WeakReference<Window>> windowList = Vector<WeakReference<Window>> windowList =
(Vector<WeakReference<Window>>)appContext.get(Window.class); (Vector<WeakReference<Window>>)appContext.get(Window.class);
if (windowList != null) { if (windowList != null) {
...@@ -1866,7 +1867,7 @@ public class Window extends Container implements Accessible { ...@@ -1866,7 +1867,7 @@ public class Window extends Container implements Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized WindowListener[] getWindowListeners() { public synchronized WindowListener[] getWindowListeners() {
return (WindowListener[])(getListeners(WindowListener.class)); return getListeners(WindowListener.class);
} }
/** /**
...@@ -1882,7 +1883,7 @@ public class Window extends Container implements Accessible { ...@@ -1882,7 +1883,7 @@ public class Window extends Container implements Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized WindowFocusListener[] getWindowFocusListeners() { public synchronized WindowFocusListener[] getWindowFocusListeners() {
return (WindowFocusListener[])(getListeners(WindowFocusListener.class)); return getListeners(WindowFocusListener.class);
} }
/** /**
...@@ -1898,7 +1899,7 @@ public class Window extends Container implements Accessible { ...@@ -1898,7 +1899,7 @@ public class Window extends Container implements Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized WindowStateListener[] getWindowStateListeners() { public synchronized WindowStateListener[] getWindowStateListeners() {
return (WindowStateListener[])(getListeners(WindowStateListener.class)); return getListeners(WindowStateListener.class);
} }
...@@ -2014,7 +2015,6 @@ public class Window extends Container implements Accessible { ...@@ -2014,7 +2015,6 @@ public class Window extends Container implements Accessible {
break; break;
case WindowEvent.WINDOW_STATE_CHANGED: case WindowEvent.WINDOW_STATE_CHANGED:
processWindowStateEvent((WindowEvent)e); processWindowStateEvent((WindowEvent)e);
default:
break; break;
} }
return; return;
...@@ -2382,12 +2382,14 @@ public class Window extends Container implements Accessible { ...@@ -2382,12 +2382,14 @@ public class Window extends Container implements Accessible {
* KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
* @since 1.4 * @since 1.4
*/ */
@SuppressWarnings("unchecked")
public Set<AWTKeyStroke> getFocusTraversalKeys(int id) { public Set<AWTKeyStroke> getFocusTraversalKeys(int id) {
if (id < 0 || id >= KeyboardFocusManager.TRAVERSAL_KEY_LENGTH) { if (id < 0 || id >= KeyboardFocusManager.TRAVERSAL_KEY_LENGTH) {
throw new IllegalArgumentException("invalid focus traversal key identifier"); throw new IllegalArgumentException("invalid focus traversal key identifier");
} }
// Okay to return Set directly because it is an unmodifiable view // Okay to return Set directly because it is an unmodifiable view
@SuppressWarnings("rawtypes")
Set keystrokes = (focusTraversalKeys != null) Set keystrokes = (focusTraversalKeys != null)
? focusTraversalKeys[id] ? focusTraversalKeys[id]
: null; : null;
...@@ -2765,7 +2767,7 @@ public class Window extends Container implements Accessible { ...@@ -2765,7 +2767,7 @@ public class Window extends Container implements Accessible {
/* /*
* Support for tracking all windows owned by this window * Support for tracking all windows owned by this window
*/ */
void addOwnedWindow(WeakReference weakWindow) { void addOwnedWindow(WeakReference<Window> weakWindow) {
if (weakWindow != null) { if (weakWindow != null) {
synchronized(ownedWindowList) { synchronized(ownedWindowList) {
// this if statement should really be an assert, but we don't // this if statement should really be an assert, but we don't
...@@ -2777,7 +2779,7 @@ public class Window extends Container implements Accessible { ...@@ -2777,7 +2779,7 @@ public class Window extends Container implements Accessible {
} }
} }
void removeOwnedWindow(WeakReference weakWindow) { void removeOwnedWindow(WeakReference<Window> weakWindow) {
if (weakWindow != null) { if (weakWindow != null) {
// synchronized block not required since removeElement is // synchronized block not required since removeElement is
// already synchronized // already synchronized
...@@ -2792,6 +2794,7 @@ public class Window extends Container implements Accessible { ...@@ -2792,6 +2794,7 @@ public class Window extends Container implements Accessible {
private void addToWindowList() { private void addToWindowList() {
synchronized (Window.class) { synchronized (Window.class) {
@SuppressWarnings("unchecked")
Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)appContext.get(Window.class); Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)appContext.get(Window.class);
if (windowList == null) { if (windowList == null) {
windowList = new Vector<WeakReference<Window>>(); windowList = new Vector<WeakReference<Window>>();
...@@ -2801,8 +2804,9 @@ public class Window extends Container implements Accessible { ...@@ -2801,8 +2804,9 @@ public class Window extends Container implements Accessible {
} }
} }
private static void removeFromWindowList(AppContext context, WeakReference weakThis) { private static void removeFromWindowList(AppContext context, WeakReference<Window> weakThis) {
synchronized (Window.class) { synchronized (Window.class) {
@SuppressWarnings("unchecked")
Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)context.get(Window.class); Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)context.get(Window.class);
if (windowList != null) { if (windowList != null) {
windowList.remove(weakThis); windowList.remove(weakThis);
...@@ -2945,7 +2949,7 @@ public class Window extends Container implements Accessible { ...@@ -2945,7 +2949,7 @@ public class Window extends Container implements Accessible {
// Deserialized Windows are not yet visible. // Deserialized Windows are not yet visible.
visible = false; visible = false;
weakThis = new WeakReference(this); weakThis = new WeakReference<>(this);
anchor = new Object(); anchor = new Object();
sun.java2d.Disposer.addRecord(anchor, new WindowDisposerRecord(appContext, this)); sun.java2d.Disposer.addRecord(anchor, new WindowDisposerRecord(appContext, this));
...@@ -2956,7 +2960,7 @@ public class Window extends Container implements Accessible { ...@@ -2956,7 +2960,7 @@ public class Window extends Container implements Accessible {
private void deserializeResources(ObjectInputStream s) private void deserializeResources(ObjectInputStream s)
throws ClassNotFoundException, IOException, HeadlessException { throws ClassNotFoundException, IOException, HeadlessException {
ownedWindowList = new Vector(); ownedWindowList = new Vector<>();
if (windowSerializedDataVersion < 2) { if (windowSerializedDataVersion < 2) {
// Translate old-style focus tracking to new model. For 1.4 and // Translate old-style focus tracking to new model. For 1.4 and
......
...@@ -88,7 +88,7 @@ public abstract class SurfaceManager { ...@@ -88,7 +88,7 @@ public abstract class SurfaceManager {
imgaccessor.setSurfaceManager(img, mgr); imgaccessor.setSurfaceManager(img, mgr);
} }
private ConcurrentHashMap cacheMap; private ConcurrentHashMap<Object,Object> cacheMap;
/** /**
* Return an arbitrary cached object for an arbitrary cache key. * Return an arbitrary cached object for an arbitrary cache key.
...@@ -123,7 +123,7 @@ public abstract class SurfaceManager { ...@@ -123,7 +123,7 @@ public abstract class SurfaceManager {
if (cacheMap == null) { if (cacheMap == null) {
synchronized (this) { synchronized (this) {
if (cacheMap == null) { if (cacheMap == null) {
cacheMap = new ConcurrentHashMap(2); cacheMap = new ConcurrentHashMap<>(2);
} }
} }
} }
...@@ -245,7 +245,7 @@ public abstract class SurfaceManager { ...@@ -245,7 +245,7 @@ public abstract class SurfaceManager {
synchronized void flush(boolean deaccelerate) { synchronized void flush(boolean deaccelerate) {
if (cacheMap != null) { if (cacheMap != null) {
Iterator i = cacheMap.values().iterator(); Iterator<Object> i = cacheMap.values().iterator();
while (i.hasNext()) { while (i.hasNext()) {
Object o = i.next(); Object o = i.next();
if (o instanceof FlushableCacheData) { if (o instanceof FlushableCacheData) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册