8048022: Fix raw and unchecked warnings in javax.accessibility

Reviewed-by: pchelko
This commit is contained in:
Pete Brunet 2014-06-26 12:05:57 +04:00
parent c0c1d91633
commit f5df1eca19
3 changed files with 17 additions and 19 deletions

View File

@ -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 @@ import java.util.ResourceBundle;
*/
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 @@ public abstract class AccessibleBundle {
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 @@ public abstract class AccessibleBundle {
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));
}

View File

@ -71,7 +71,7 @@ public class AccessibleRelationSet {
*/
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 class AccessibleRelationSet {
*/
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 class AccessibleRelationSet {
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]);

View File

@ -68,7 +68,7 @@ public class AccessibleStateSet {
*/
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 @@ public class AccessibleStateSet {
// 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 class AccessibleStateSet {
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])) {