changeset 25553:1082bb71e6c5

8048022: Fix raw and unchecked warnings in javax.accessibility Reviewed-by: pchelko
author ptbrunet
date Thu, 26 Jun 2014 12:05:57 +0400
parents 96abb01815f6
children 8376663d83d7
files jdk/src/share/classes/javax/accessibility/AccessibleBundle.java jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java
diffstat 3 files changed, 17 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java	Wed Jun 25 19:10:32 2014 +0400
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java	Thu Jun 26 12:05:57 2014 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
  */
 public abstract class AccessibleBundle {
 
-    private static Hashtable table = new Hashtable();
+    private static Hashtable<Locale, Hashtable<String, Object>> table = new Hashtable<>();
     private final String defaultResourceBundleName
         = "com.sun.accessibility.internal.resources.accessibility";
 
@@ -85,14 +85,12 @@
         loadResourceBundle(resourceBundleName, locale);
 
         // returns the localized string
-        Object o = table.get(locale);
-        if (o != null && o instanceof Hashtable) {
-                Hashtable resourceTable = (Hashtable) o;
-                o = resourceTable.get(key);
-
-                if (o != null && o instanceof String) {
-                    return (String)o;
-                }
+        Hashtable<String, Object> ht = table.get(locale);
+        if (ht != null) {
+            Object o = ht.get(key);
+            if (o != null && o instanceof String) {
+                return (String)o;
+            }
         }
         return key;
     }
@@ -134,13 +132,13 @@
         if (! table.contains(locale)) {
 
             try {
-                Hashtable resourceTable = new Hashtable();
+                Hashtable<String, Object> resourceTable = new Hashtable<>();
 
                 ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName, locale);
 
-                Enumeration iter = bundle.getKeys();
+                Enumeration<String> iter = bundle.getKeys();
                 while(iter.hasMoreElements()) {
-                    String key = (String)iter.nextElement();
+                    String key = iter.nextElement();
                     resourceTable.put(key, bundle.getObject(key));
                 }
 
--- a/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java	Wed Jun 25 19:10:32 2014 +0400
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java	Thu Jun 26 12:05:57 2014 +0400
@@ -71,7 +71,7 @@
      */
     public AccessibleRelationSet(AccessibleRelation[] relations) {
         if (relations.length != 0) {
-            this.relations = new Vector(relations.length);
+            this.relations = new Vector<>(relations.length);
             for (int i = 0; i < relations.length; i++) {
                 add(relations[i]);
             }
@@ -90,7 +90,7 @@
      */
     public boolean add(AccessibleRelation relation) {
         if (relations == null) {
-            relations = new Vector();
+            relations = new Vector<>();
         }
 
         // Merge the relation targets if the key exists
@@ -125,7 +125,7 @@
     public void addAll(AccessibleRelation[] relations) {
         if (relations.length != 0) {
             if (this.relations == null) {
-                this.relations = new Vector(relations.length);
+                this.relations = new Vector<>(relations.length);
             }
             for (int i = 0; i < relations.length; i++) {
                 add(relations[i]);
--- a/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java	Wed Jun 25 19:10:32 2014 +0400
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java	Thu Jun 26 12:05:57 2014 +0400
@@ -68,7 +68,7 @@
      */
     public AccessibleStateSet(AccessibleState[] states) {
         if (states.length != 0) {
-            this.states = new Vector(states.length);
+            this.states = new Vector<>(states.length);
             for (int i = 0; i < states.length; i++) {
                 if (!this.states.contains(states[i])) {
                     this.states.addElement(states[i]);
@@ -92,7 +92,7 @@
         // to always use a vector of states.  It could be improved by
         // caching the states as a bit set.]]]
         if (states == null) {
-            states = new Vector();
+            states = new Vector<>();
         }
 
         if (!states.contains(state)) {
@@ -111,7 +111,7 @@
     public void addAll(AccessibleState[] states) {
         if (states.length != 0) {
             if (this.states == null) {
-                this.states = new Vector(states.length);
+                this.states = new Vector<>(states.length);
             }
             for (int i = 0; i < states.length; i++) {
                 if (!this.states.contains(states[i])) {