From f5df1eca19672382021887714d62d7156164a5e3 Mon Sep 17 00:00:00 2001 From: Pete Brunet Date: Thu, 26 Jun 2014 12:05:57 +0400 Subject: [PATCH] 8048022: Fix raw and unchecked warnings in javax.accessibility Reviewed-by: pchelko --- .../javax/accessibility/AccessibleBundle.java | 24 +++++++++---------- .../accessibility/AccessibleRelationSet.java | 6 ++--- .../accessibility/AccessibleStateSet.java | 6 ++--- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java b/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java index 65ce81bed6f..936322af467 100644 --- a/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java +++ b/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java @@ -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> 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 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 resourceTable = new Hashtable<>(); ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName, locale); - Enumeration iter = bundle.getKeys(); + Enumeration iter = bundle.getKeys(); while(iter.hasMoreElements()) { - String key = (String)iter.nextElement(); + String key = iter.nextElement(); resourceTable.put(key, bundle.getObject(key)); } diff --git a/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java b/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java index 37f38aa8a40..613db08feb7 100644 --- a/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java +++ b/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java @@ -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]); diff --git a/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java b/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java index 5eb4f05e3b9..602b83855db 100644 --- a/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java +++ b/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java @@ -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])) {