提交 55f2f042 编写于 作者: N naoto

7117465: Warning cleanup for IMF classes

Reviewed-by: okutsu
上级 b79c3ab0
...@@ -190,6 +190,6 @@ public class InputMethodHighlight { ...@@ -190,6 +190,6 @@ public class InputMethodHighlight {
private boolean selected; private boolean selected;
private int state; private int state;
private int variation; private int variation;
private Map style; private Map<TextAttribute, ?> style;
}; };
...@@ -313,4 +313,7 @@ public final class CompositionArea extends JPanel implements InputMethodListener ...@@ -313,4 +313,7 @@ public final class CompositionArea extends JPanel implements InputMethodListener
compositionWindow.pack(); compositionWindow.pack();
} }
// Proclaim serial compatibility with 1.7.0
private static final long serialVersionUID = -1057247068746557444L;
} }
...@@ -257,7 +257,7 @@ class CompositionAreaHandler implements InputMethodListener, ...@@ -257,7 +257,7 @@ class CompositionAreaHandler implements InputMethodListener,
*/ */
InputMethodRequests getClientInputMethodRequests() { InputMethodRequests getClientInputMethodRequests() {
if (clientComponent != null) { if (clientComponent != null) {
return (InputMethodRequests) clientComponent.getInputMethodRequests(); return clientComponent.getInputMethodRequests();
} }
return null; return null;
......
...@@ -79,7 +79,7 @@ public class InputContext extends java.awt.im.InputContext ...@@ -79,7 +79,7 @@ public class InputContext extends java.awt.im.InputContext
private boolean inputMethodCreationFailed; private boolean inputMethodCreationFailed;
// holding bin for previously used input method instances, but not the current one // holding bin for previously used input method instances, but not the current one
private HashMap usedInputMethods; private HashMap<InputMethodLocator, InputMethod> usedInputMethods;
// the current client component is kept until the user focusses on a different // the current client component is kept until the user focusses on a different
// client component served by the same input context. When that happens, we call // client component served by the same input context. When that happens, we call
...@@ -106,7 +106,7 @@ public class InputContext extends java.awt.im.InputContext ...@@ -106,7 +106,7 @@ public class InputContext extends java.awt.im.InputContext
// cache location notification // cache location notification
private Rectangle clientWindowLocation = null; private Rectangle clientWindowLocation = null;
// holding the state of clientWindowNotificationEnabled of only non-current input methods // holding the state of clientWindowNotificationEnabled of only non-current input methods
private HashMap perInputMethodState; private HashMap<InputMethod, Boolean> perInputMethodState;
// Input Method selection hot key stuff // Input Method selection hot key stuff
private static AWTKeyStroke inputMethodSelectionKey; private static AWTKeyStroke inputMethodSelectionKey;
...@@ -219,6 +219,7 @@ public class InputContext extends java.awt.im.InputContext ...@@ -219,6 +219,7 @@ public class InputContext extends java.awt.im.InputContext
/** /**
* @see java.awt.im.InputContext#dispatchEvent * @see java.awt.im.InputContext#dispatchEvent
*/ */
@SuppressWarnings("fallthrough")
public void dispatchEvent(AWTEvent event) { public void dispatchEvent(AWTEvent event) {
if (event instanceof InputMethodEvent) { if (event instanceof InputMethodEvent) {
...@@ -394,7 +395,7 @@ public class InputContext extends java.awt.im.InputContext ...@@ -394,7 +395,7 @@ public class InputContext extends java.awt.im.InputContext
isInputMethodActive = true; isInputMethodActive = true;
if (perInputMethodState != null) { if (perInputMethodState != null) {
Boolean state = (Boolean) perInputMethodState.remove(inputMethod); Boolean state = perInputMethodState.remove(inputMethod);
if (state != null) { if (state != null) {
clientWindowNotificationEnabled = state.booleanValue(); clientWindowNotificationEnabled = state.booleanValue();
} }
...@@ -549,10 +550,10 @@ public class InputContext extends java.awt.im.InputContext ...@@ -549,10 +550,10 @@ public class InputContext extends java.awt.im.InputContext
// keep the input method instance around for future use // keep the input method instance around for future use
if (usedInputMethods == null) { if (usedInputMethods == null) {
usedInputMethods = new HashMap(5); usedInputMethods = new HashMap<>(5);
} }
if (perInputMethodState == null) { if (perInputMethodState == null) {
perInputMethodState = new HashMap(5); perInputMethodState = new HashMap<>(5);
} }
usedInputMethods.put(inputMethodLocator.deriveLocator(null), inputMethod); usedInputMethods.put(inputMethodLocator.deriveLocator(null), inputMethod);
perInputMethodState.put(inputMethod, perInputMethodState.put(inputMethod,
...@@ -689,10 +690,10 @@ public class InputContext extends java.awt.im.InputContext ...@@ -689,10 +690,10 @@ public class InputContext extends java.awt.im.InputContext
} }
inputMethodLocator = null; inputMethodLocator = null;
if (usedInputMethods != null && !usedInputMethods.isEmpty()) { if (usedInputMethods != null && !usedInputMethods.isEmpty()) {
Iterator iterator = usedInputMethods.values().iterator(); Iterator<InputMethod> iterator = usedInputMethods.values().iterator();
usedInputMethods = null; usedInputMethods = null;
while (iterator.hasNext()) { while (iterator.hasNext()) {
((InputMethod) iterator.next()).dispose(); iterator.next().dispose();
} }
} }
...@@ -830,13 +831,13 @@ public class InputContext extends java.awt.im.InputContext ...@@ -830,13 +831,13 @@ public class InputContext extends java.awt.im.InputContext
// see whether we have a previously used input method // see whether we have a previously used input method
if (usedInputMethods != null) { if (usedInputMethods != null) {
inputMethodInstance = (InputMethod) usedInputMethods.remove(locator.deriveLocator(null)); inputMethodInstance = usedInputMethods.remove(locator.deriveLocator(null));
if (inputMethodInstance != null) { if (inputMethodInstance != null) {
if (locale != null) { if (locale != null) {
inputMethodInstance.setLocale(locale); inputMethodInstance.setLocale(locale);
} }
inputMethodInstance.setCharacterSubsets(characterSubsets); inputMethodInstance.setCharacterSubsets(characterSubsets);
Boolean state = (Boolean) perInputMethodState.remove(inputMethodInstance); Boolean state = perInputMethodState.remove(inputMethodInstance);
if (state != null) { if (state != null) {
enableClientWindowNotification(inputMethodInstance, state.booleanValue()); enableClientWindowNotification(inputMethodInstance, state.booleanValue());
} }
...@@ -919,7 +920,7 @@ public class InputContext extends java.awt.im.InputContext ...@@ -919,7 +920,7 @@ public class InputContext extends java.awt.im.InputContext
// method becomes the current one. // method becomes the current one.
if (requester != inputMethod) { if (requester != inputMethod) {
if (perInputMethodState == null) { if (perInputMethodState == null) {
perInputMethodState = new HashMap(5); perInputMethodState = new HashMap<>(5);
} }
perInputMethodState.put(requester, Boolean.valueOf(enable)); perInputMethodState.put(requester, Boolean.valueOf(enable));
return; return;
...@@ -1029,7 +1030,7 @@ public class InputContext extends java.awt.im.InputContext ...@@ -1029,7 +1030,7 @@ public class InputContext extends java.awt.im.InputContext
* Initializes the input method selection key definition in preference trees * Initializes the input method selection key definition in preference trees
*/ */
private void initializeInputMethodSelectionKey() { private void initializeInputMethodSelectionKey() {
AccessController.doPrivileged(new PrivilegedAction() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() { public Object run() {
// Look in user's tree // Look in user's tree
Preferences root = Preferences.userRoot(); Preferences root = Preferences.userRoot();
......
...@@ -72,12 +72,11 @@ public class InputMethodContext ...@@ -72,12 +72,11 @@ public class InputMethodContext
static { static {
// check whether we should use below-the-spot input // check whether we should use below-the-spot input
// get property from command line // get property from command line
String inputStyle = (String) AccessController.doPrivileged String inputStyle = AccessController.doPrivileged
(new GetPropertyAction("java.awt.im.style", null)); (new GetPropertyAction("java.awt.im.style", null));
// get property from awt.properties file // get property from awt.properties file
if (inputStyle == null) { if (inputStyle == null) {
inputStyle = Toolkit.getDefaultToolkit(). inputStyle = Toolkit.getProperty("java.awt.im.style", null);
getProperty("java.awt.im.style", null);
} }
belowTheSpotInputRequested = "below-the-spot".equals(inputStyle); belowTheSpotInputRequested = "below-the-spot".equals(inputStyle);
} }
......
...@@ -68,4 +68,7 @@ public class InputMethodJFrame ...@@ -68,4 +68,7 @@ public class InputMethodJFrame
return super.getInputContext(); return super.getInputContext();
} }
} }
// Proclaim serial compatibility with 1.7.0
private static final long serialVersionUID = -4705856747771842549L;
} }
...@@ -270,7 +270,7 @@ class ExecutableInputMethodManager extends InputMethodManager ...@@ -270,7 +270,7 @@ class ExecutableInputMethodManager extends InputMethodManager
// IM preference stuff // IM preference stuff
private static final String preferredIMNode = "/sun/awt/im/preferredInputMethod"; private static final String preferredIMNode = "/sun/awt/im/preferredInputMethod";
private static final String descriptorKey = "descriptor"; private static final String descriptorKey = "descriptor";
private Hashtable preferredLocatorCache = new Hashtable(); private Hashtable<String, InputMethodLocator> preferredLocatorCache = new Hashtable<>();
private Preferences userRoot; private Preferences userRoot;
ExecutableInputMethodManager() { ExecutableInputMethodManager() {
...@@ -430,7 +430,7 @@ class ExecutableInputMethodManager extends InputMethodManager ...@@ -430,7 +430,7 @@ class ExecutableInputMethodManager extends InputMethodManager
synchronized (javaInputMethodLocatorList) { synchronized (javaInputMethodLocatorList) {
javaInputMethodLocatorList.clear(); javaInputMethodLocatorList.clear();
try { try {
AccessController.doPrivileged(new PrivilegedExceptionAction() { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() { public Object run() {
for (InputMethodDescriptor descriptor : for (InputMethodDescriptor descriptor :
ServiceLoader.loadInstalled(InputMethodDescriptor.class)) { ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
...@@ -611,7 +611,7 @@ class ExecutableInputMethodManager extends InputMethodManager ...@@ -611,7 +611,7 @@ class ExecutableInputMethodManager extends InputMethodManager
} }
// look for the cached preference first. // look for the cached preference first.
preferredLocator = (InputMethodLocator)preferredLocatorCache.get(locale.toString().intern()); preferredLocator = preferredLocatorCache.get(locale.toString().intern());
if (preferredLocator != null) { if (preferredLocator != null) {
return preferredLocator; return preferredLocator;
} }
...@@ -767,8 +767,8 @@ class ExecutableInputMethodManager extends InputMethodManager ...@@ -767,8 +767,8 @@ class ExecutableInputMethodManager extends InputMethodManager
} }
private Preferences getUserRoot() { private Preferences getUserRoot() {
return (Preferences)AccessController.doPrivileged(new PrivilegedAction() { return AccessController.doPrivileged(new PrivilegedAction<Preferences>() {
public Object run() { public Preferences run() {
return Preferences.userRoot(); return Preferences.userRoot();
} }
}); });
......
...@@ -61,4 +61,7 @@ public class SimpleInputMethodWindow ...@@ -61,4 +61,7 @@ public class SimpleInputMethodWindow
return super.getInputContext(); return super.getInputContext();
} }
} }
// Proclaim serial compatibility with 1.7.0
private static final long serialVersionUID = 5093376647036461555L;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册