diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-06-17 16:53:54 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-06-17 16:53:54 +0000 |
commit | a7f344fa263c92a9e272cc9c33731eebbd0a3654 (patch) | |
tree | 9e0ab8d8575503da1c172c879321a86b426464f0 /javax | |
parent | b7445c313e41c069dbb69640d23735fcee0b86c2 (diff) | |
download | classpath-a7f344fa263c92a9e272cc9c33731eebbd0a3654.tar.gz |
2008-06-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/ObjectName.java,
* javax/management/StandardMBean.java:
Fix warnings due to use of generics.
Diffstat (limited to 'javax')
-rw-r--r-- | javax/management/ObjectName.java | 23 | ||||
-rw-r--r-- | javax/management/StandardMBean.java | 24 |
2 files changed, 20 insertions, 27 deletions
diff --git a/javax/management/ObjectName.java b/javax/management/ObjectName.java index e44b5c23a..d3ccd201f 100644 --- a/javax/management/ObjectName.java +++ b/javax/management/ObjectName.java @@ -306,17 +306,14 @@ public class ObjectName "character."); char[] keychars = new char[] { '\n', ':', ',', '*', '?', '=' }; char[] valchars = new char[] { '\n', ':', ',', '=' }; - Iterator i = properties.entrySet().iterator(); - while (i.hasNext()) + for (Map.Entry<String,String> entry : properties.entrySet()) { - Map.Entry entry = (Map.Entry) i.next(); - String key = (String) entry.getKey(); for (int a = 0; a < keychars.length; ++a) - if (key.indexOf(keychars[a]) != -1) + if (entry.getKey().indexOf(keychars[a]) != -1) throw new MalformedObjectNameException("A key contains a '" + keychars[a] + "' " + "character."); - String value = (String) entry.getValue(); + String value = entry.getValue(); int quote = value.indexOf('"'); if (quote == 0) { @@ -389,15 +386,13 @@ public class ObjectName if (isPropertyPattern()) { - Hashtable oProps = name.getKeyPropertyList(); - Iterator i = properties.entrySet().iterator(); - while (i.hasNext()) + Hashtable<String,String> oProps = name.getKeyPropertyList(); + for (Map.Entry<String,String> entry : properties.entrySet()) { - Map.Entry entry = (Map.Entry) i.next(); - String key = (String) entry.getKey(); + String key = entry.getKey(); if (!(oProps.containsKey(key))) return false; - String val = (String) entry.getValue(); + String val = entry.getValue(); if (!(val.equals(oProps.get(key)))) return false; } @@ -479,10 +474,10 @@ public class ObjectName public String getCanonicalKeyPropertyListString() { CPStringBuilder builder = new CPStringBuilder(); - Iterator i = properties.entrySet().iterator(); + Iterator<Map.Entry<String,String>> i = properties.entrySet().iterator(); while (i.hasNext()) { - Map.Entry entry = (Map.Entry) i.next(); + Map.Entry<String,String> entry = i.next(); builder.append(entry.getKey() + "=" + entry.getValue()); if (i.hasNext()) builder.append(","); diff --git a/javax/management/StandardMBean.java b/javax/management/StandardMBean.java index bd59c68ae..13e95bd39 100644 --- a/javax/management/StandardMBean.java +++ b/javax/management/StandardMBean.java @@ -569,8 +569,8 @@ public class StandardMBean if (info != null) return info; Method[] methods = iface.getMethods(); - Map attributes = new HashMap(); - List operations = new ArrayList(); + Map<String,Method[]> attributes = new HashMap<String,Method[]>(); + List<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>(); for (int a = 0; a < methods.length; ++a) { String name = methods[a].getName(); @@ -614,16 +614,14 @@ public class StandardMBean operations.add(new MBeanOperationInfo(methods[a].getName(), methods[a])); } - List attribs = new ArrayList(attributes.size()); - Iterator it = attributes.entrySet().iterator(); - while (it.hasNext()) + List<MBeanAttributeInfo> attribs = new ArrayList<MBeanAttributeInfo>(attributes.size()); + for (Map.Entry<String,Method[]> entry : attributes.entrySet()) { - Map.Entry entry = (Map.Entry) it.next(); - Method[] amethods = (Method[]) entry.getValue(); + Method[] amethods = entry.getValue(); try { - attribs.add(new MBeanAttributeInfo((String) entry.getKey(), - (String) entry.getKey(), + attribs.add(new MBeanAttributeInfo(entry.getKey(), + entry.getKey(), amethods[0], amethods[1])); } catch (IntrospectionException e) @@ -646,7 +644,7 @@ public class StandardMBean oldInfo.isWritable(), oldInfo.isIs()); } - Constructor[] cons = impl.getClass().getConstructors(); + Constructor<?>[] cons = impl.getClass().getConstructors(); MBeanConstructorInfo[] cinfo = new MBeanConstructorInfo[cons.length]; for (int a = 0; a < cinfo.length; ++a) { @@ -778,10 +776,10 @@ public class StandardMBean "Invocation of an attribute " + "method is disallowed."); ClassLoader loader = getClass().getClassLoader(); - Class[] sigTypes; + Class<?>[] sigTypes; if (signature != null) { - sigTypes = new Class[signature.length]; + sigTypes = new Class<?>[signature.length]; for (int a = 0; a < signature.length; ++a) try { @@ -892,7 +890,7 @@ public class StandardMBean public AttributeList setAttributes(AttributeList attributes) { AttributeList list = new AttributeList(attributes.size()); - Iterator it = attributes.iterator(); + Iterator<Object> it = attributes.iterator(); while (it.hasNext()) { try |