--- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java Mon Sep 02 14:06:24 2013 +0400
+++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java Mon Sep 02 16:48:51 2013 +0400
@@ -67,7 +67,7 @@
public class AWTKeyStroke implements Serializable {
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
* done to avoid the overhead of the reflective call to find the
@@ -85,8 +85,8 @@
* AWTKeyStroke class.
* Must be called under locked AWTKeyStro
*/
- private static Class getAWTKeyStrokeClass() {
- Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+ private static Class<AWTKeyStroke> getAWTKeyStrokeClass() {
+ Class<AWTKeyStroke> clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
if (clazz == null) {
clazz = AWTKeyStroke.class;
AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
@@ -182,7 +182,7 @@
throw new IllegalArgumentException("subclass cannot be null");
}
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)){
// Already registered
return;
@@ -229,8 +229,8 @@
*/
private static Constructor getCtor(final Class clazz)
{
- Object ctor = AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ Constructor ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor>() {
+ public Constructor run() {
try {
Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
if (ctor != null) {
@@ -249,17 +249,17 @@
private static synchronized AWTKeyStroke getCachedStroke
(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);
if (cache == null) {
- cache = new HashMap();
+ cache = new HashMap<>();
AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache);
}
if (cacheKey == null) {
try {
- Class clazz = getAWTKeyStrokeClass();
+ Class<AWTKeyStroke> clazz = getAWTKeyStrokeClass();
cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null);
AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey);
} catch (InstantiationException e) {
@@ -513,7 +513,7 @@
synchronized (AWTKeyStroke.class) {
if (modifierKeywords == null) {
- Map uninitializedMap = new HashMap(8, 1.0f);
+ Map<String, Integer> uninitializedMap = new HashMap<>(8, 1.0f);
uninitializedMap.put("shift",
Integer.valueOf(InputEvent.SHIFT_DOWN_MASK
|InputEvent.SHIFT_MASK));
@@ -861,12 +861,12 @@
}
class VKCollection {
- Map code2name;
- Map name2code;
+ Map<Integer, String> code2name;
+ Map<String, Integer> name2code;
public VKCollection() {
- code2name = new HashMap();
- name2code = new HashMap();
+ code2name = new HashMap<>();
+ name2code = new HashMap<>();
}
public synchronized void put(String name, Integer code) {