summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--javax/management/openmbean/TabularDataSupport.java30
-rw-r--r--javax/management/openmbean/TabularType.java5
3 files changed, 21 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 53a27cf23..8422d2745 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-06-15 Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * javax/management/openmbean/TabularDataSupport.java,
+ * javax/management/openmbean/TabularType.java:
+ Fix warnings due to use of generics.
+
+2008-06-15 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
PR classpath/36522:
* gnu/java/security/PolicyFile.java:
Correct typo changing seperator to separator.
diff --git a/javax/management/openmbean/TabularDataSupport.java b/javax/management/openmbean/TabularDataSupport.java
index 1d340e86f..04eff1733 100644
--- a/javax/management/openmbean/TabularDataSupport.java
+++ b/javax/management/openmbean/TabularDataSupport.java
@@ -68,7 +68,7 @@ public class TabularDataSupport
*
* @serial the map of rows to column values.
*/
- private Map<Object,Object> dataMap;
+ private HashMap<Object,Object> dataMap;
/**
* The tabular type which represents this tabular data instance.
@@ -141,14 +141,10 @@ public class TabularDataSupport
throw new InvalidOpenTypeException("The type of the given value " +
"does not match the row type " +
"of this instance.");
- List indexNames = tabularType.getIndexNames();
- List matchingIndicies = new ArrayList(indexNames.size());
- Iterator it = indexNames.iterator();
- while (it.hasNext())
- {
- String name = (String) it.next();
- matchingIndicies.add(val.get(name));
- }
+ List<String> indexNames = tabularType.getIndexNames();
+ List<String> matchingIndicies = new ArrayList<String>(indexNames.size());
+ for (String name : indexNames)
+ matchingIndicies.add(val.get(name).toString());
return matchingIndicies.toArray();
}
@@ -173,7 +169,7 @@ public class TabularDataSupport
try
{
clone = (TabularDataSupport) super.clone();
- clone.setMap((HashMap) ((HashMap) dataMap).clone());
+ clone.setMap((HashMap<Object,Object>) dataMap.clone());
}
catch (CloneNotSupportedException e)
{
@@ -390,11 +386,11 @@ public class TabularDataSupport
*/
private boolean isKeyValid(Object[] key)
{
- Iterator it = tabularType.getIndexNames().iterator();
+ Iterator<String> it = tabularType.getIndexNames().iterator();
CompositeType rowType = tabularType.getRowType();
for (int a = 0; it.hasNext(); ++a)
{
- OpenType type = rowType.getType((String) it.next());
+ OpenType<?> type = rowType.getType(it.next());
if (!(type.isValue(key[a])))
return false;
}
@@ -496,7 +492,7 @@ public class TabularDataSupport
{
if (vals == null || vals.length == 0)
return;
- Map mapToAdd = new HashMap(vals.length);
+ Map<Object,Object> mapToAdd = new HashMap<Object,Object>(vals.length);
for (int a = 0; a < vals.length; ++a)
{
Object[] key = calculateIndex(vals[a]);
@@ -539,9 +535,9 @@ public class TabularDataSupport
{
if (m == null || m.size() == 0)
return;
- Collection vals = m.values();
+ Collection<?> vals = m.values();
CompositeData[] data = new CompositeData[vals.size()];
- Iterator it = vals.iterator();
+ Iterator<?> it = vals.iterator();
for (int a = 0; it.hasNext(); ++a)
{
data[a] = (CompositeData) it.next();
@@ -591,12 +587,12 @@ public class TabularDataSupport
}
/**
- * Package-private method to set the internal {@link java.util.Map}
+ * Private method to set the internal {@link java.util.Map}
* instance (used in cloning).
*
* @param map the new map used.
*/
- void setMap(Map map)
+ private void setMap(HashMap<Object,Object> map)
{
dataMap = map;
}
diff --git a/javax/management/openmbean/TabularType.java b/javax/management/openmbean/TabularType.java
index 9a0881e0f..5a861d061 100644
--- a/javax/management/openmbean/TabularType.java
+++ b/javax/management/openmbean/TabularType.java
@@ -206,9 +206,8 @@ public class TabularType
if (hashCode == null)
{
int elementTotal = 0;
- Iterator it = indexNames.iterator();
- while (it.hasNext())
- elementTotal += it.next().hashCode();
+ for (String s : indexNames)
+ elementTotal += s.hashCode();
hashCode = Integer.valueOf(elementTotal
+ getTypeName().hashCode()
+ rowType.hashCode());